Module: AudioPlayback::Playback

Defined in:
lib/audio-playback/playback.rb,
lib/audio-playback/playback/frame.rb,
lib/audio-playback/playback/mixer.rb,
lib/audio-playback/playback/frame_set.rb,
lib/audio-playback/playback/stream_data.rb

Defined Under Namespace

Classes: Action, Frame, FrameSet, InvalidChannels, InvalidTruncation, Mixer, StreamData

Constant Summary collapse

DEFAULT =
{
  :buffer_size => 2**12
}.freeze
FRAME_SIZE =
FFI::TYPE_FLOAT32.size
METADATA =
[:size, :num_channels, :start_frame, :end_frame, :is_looping, :pointer, :is_eof].freeze

Class Method Summary collapse

Class Method Details

.new(*args) ⇒ Playback::Action

Shortcut to Action.new

Returns:



257
258
259
# File 'lib/audio-playback/playback.rb', line 257

def self.new(*args)
  Action.new(*args)
end

.play(sound, output, options = {}) ⇒ Playback

Parameters:

  • sound (Sound)
  • output (Output)
  • options (Hash) (defaults to: {})

Options Hash (options):

  • :buffer_size (Integer)
  • :channels (Array<Integer>, Integer) — default: or: :channel
  • :logger (IO)
  • :stream (Stream)

Returns:



269
270
271
272
# File 'lib/audio-playback/playback.rb', line 269

def self.play(sound, output, options = {})
  playback = Action.new(sound, output, options)
  playback.start
end