module AudioStream::AudioInput

Attributes

connection[R]

Public Class Methods

buffer(buf) click to toggle source
# File lib/audio_stream/audio_input.rb, line 52
def self.buffer(buf)
  AudioInputBuffer.new(buf)
end
device(soundinfo:) click to toggle source
# File lib/audio_stream/audio_input.rb, line 56
def self.device(soundinfo:)
  AudioInputDevice.default_device(soundinfo: soundinfo)
end
file(fname, soundinfo:) click to toggle source
# File lib/audio_stream/audio_input.rb, line 48
def self.file(fname, soundinfo:)
  AudioInputFile.new(fname, soundinfo: soundinfo)
end

Public Instance Methods

connect() click to toggle source
# File lib/audio_stream/audio_input.rb, line 27
def connect
  nil
end
connected?() click to toggle source
# File lib/audio_stream/audio_input.rb, line 39
def connected?
  nil
end
disconnect() click to toggle source
# File lib/audio_stream/audio_input.rb, line 31
def disconnect
  if @connection
    @connection.kill
    @connection = nil
  end
  self
end
publish() click to toggle source
# File lib/audio_stream/audio_input.rb, line 13
def publish
  @connection = Thread.start {
    each {|input|
      sync.resume_wait
      notify_next(input)
      sync.yield
    }
    sync.resume_wait
    notify_complete
    sync.finish
  }
  self
end
published?() click to toggle source
# File lib/audio_stream/audio_input.rb, line 43
def published?
  !!@connection
end
sync() click to toggle source
# File lib/audio_stream/audio_input.rb, line 9
def sync
  @sync ||= Sync.new
end