mumble-ruby 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mumble-ruby.rb +1 -0
- data/lib/mumble-ruby/audio_stream.rb +12 -1
- data/lib/mumble-ruby/version.rb +1 -1
- metadata +8 -8
data/lib/mumble-ruby.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Mumble
|
2
2
|
class AudioStream
|
3
|
+
attr_reader :volume
|
4
|
+
|
3
5
|
def initialize(type, target, encoder, file, connection)
|
4
6
|
@type = type
|
5
7
|
@target = target
|
@@ -10,12 +12,17 @@ module Mumble
|
|
10
12
|
@num_frames = 6
|
11
13
|
@compressed_size = [@encoder.vbr_rate / 800, 127].min
|
12
14
|
@pds = PacketDataStream.new
|
15
|
+
@volume = 1.0
|
13
16
|
|
14
17
|
@queue = Queue.new
|
15
18
|
@producer = spawn_thread :produce
|
16
19
|
@consumer = spawn_thread :consume
|
17
20
|
end
|
18
21
|
|
22
|
+
def volume=(volume)
|
23
|
+
@volume = volume / 100.0
|
24
|
+
end
|
25
|
+
|
19
26
|
def stop
|
20
27
|
@producer.kill
|
21
28
|
@consumer.kill
|
@@ -23,12 +30,16 @@ module Mumble
|
|
23
30
|
end
|
24
31
|
|
25
32
|
private
|
33
|
+
def change_volume(pcm_data)
|
34
|
+
pcm_data.unpack('s*').map { |s| s * @volume }.pack('s*')
|
35
|
+
end
|
36
|
+
|
26
37
|
def packet_header
|
27
38
|
((@type << 5) | @target).chr
|
28
39
|
end
|
29
40
|
|
30
41
|
def produce
|
31
|
-
pcm_data = @file.read(@encoder.frame_size * 2)
|
42
|
+
pcm_data = change_volume @file.read(@encoder.frame_size * 2)
|
32
43
|
@queue << @encoder.encode(pcm_data, @compressed_size)
|
33
44
|
end
|
34
45
|
|
data/lib/mumble-ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumble-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &16063820 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *16063820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: celt-ruby
|
27
|
-
requirement: &
|
27
|
+
requirement: &16063320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *16063320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: ruby_protobuf
|
38
|
-
requirement: &
|
38
|
+
requirement: &16062600 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *16062600
|
47
47
|
description: Ruby API for interacting with a mumble server
|
48
48
|
email:
|
49
49
|
- perrym5@rpi.edu
|