Class: Mumble::AudioStream

Inherits:
Object
  • Object
show all
Defined in:
lib/mumble-ruby/audio_stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, target, encoder, file, connection) ⇒ AudioStream

Returns a new instance of AudioStream.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mumble-ruby/audio_stream.rb', line 5

def initialize(type, target, encoder, file, connection)
  @type = type
  @target = target
  @encoder = encoder
  @file = File.open(file, 'rb')
  @conn = connection
  @seq = 0
  @num_frames = 6
  @compressed_size = [@encoder.vbr_rate / 800, 127].min
  @pds = PacketDataStream.new
  @volume = 1.0

  @queue = Queue.new
  @producer = spawn_thread :produce
  @consumer = spawn_thread :consume
end

Instance Attribute Details

#volumeObject

Returns the value of attribute volume.



3
4
5
# File 'lib/mumble-ruby/audio_stream.rb', line 3

def volume
  @volume
end

Instance Method Details

#stopObject



26
27
28
29
30
# File 'lib/mumble-ruby/audio_stream.rb', line 26

def stop
  @producer.kill
  @consumer.kill
  @file.close
end