Module: AudioStream::AudioInput
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#fx, #mono, #notify_complete, #notify_next, #send_to, #stereo, #subscribe, #subscribe_on_next
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
7
8
9
|
# File 'lib/audio_stream/audio_input.rb', line 7
def connection
@connection
end
|
Class Method Details
.buffer(buf) ⇒ Object
52
53
54
|
# File 'lib/audio_stream/audio_input.rb', line 52
def self.buffer(buf)
AudioInputBuffer.new(buf)
end
|
.device(soundinfo:) ⇒ Object
.file(fname, soundinfo:) ⇒ Object
48
49
50
|
# File 'lib/audio_stream/audio_input.rb', line 48
def self.file(fname, soundinfo:)
AudioInputFile.new(fname, soundinfo: soundinfo)
end
|
Instance Method Details
#connect ⇒ Object
27
28
29
|
# File 'lib/audio_stream/audio_input.rb', line 27
def connect
nil
end
|
#connected? ⇒ Boolean
39
40
41
|
# File 'lib/audio_stream/audio_input.rb', line 39
def connected?
nil
end
|
#disconnect ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/audio_stream/audio_input.rb', line 31
def disconnect
if @connection
@connection.kill
@connection = nil
end
self
end
|
#publish ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# 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? ⇒ Boolean
43
44
45
|
# File 'lib/audio_stream/audio_input.rb', line 43
def published?
!!@connection
end
|
#sync ⇒ Object
9
10
11
|
# File 'lib/audio_stream/audio_input.rb', line 9
def sync
@sync ||= Sync.new
end
|