discordrb 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of discordrb might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/discordrb/version.rb +1 -1
- data/lib/discordrb/voice/voice_bot.rb +15 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c24aa0e70b78435b64e446ed2994c17bc640657
|
4
|
+
data.tar.gz: 345f9fd977ea9745702bc63db5060f2ee9967584
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa3b3a0572b2888a1501fad97229035f10b3eae029e942b58d28a5e769be1806852a0f7fc964666bd2673bb91a4a29babbe28dae87e898effe1d83596d51c192
|
7
|
+
data.tar.gz: 1e8f66d0595dd6064dd0ac211d14fdb835746efed28ace5ee923ec8ca076f010e23ea9bbaf0a0bd1d2d92d2871169fb88d6b4452f256151d0722afb8ffbed9b2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.5.3
|
4
|
+
* Voice bot length adjustments are now configurable using `bot.voice.adjust_interval` and `bot.voice.adjust_offset` (make sure the latter is less than the first, or no adjustment will be performed at all)
|
5
|
+
* Length adjustments can now be made more smooth using `bot.voice.adjust_average` (true allows for more smooth adjustments, *may* improve stutteriness but might make it worse as well)
|
6
|
+
|
3
7
|
## 1.5.2
|
4
8
|
* `bot.voice_connect` can now use a channel ID directly.
|
5
9
|
* A reader `bot.volume` now exists for the corresponding writer.
|
@@ -40,7 +44,7 @@
|
|
40
44
|
* `Message` now has a useful `to_s` method that just returns the content.
|
41
45
|
|
42
46
|
### Bugfixes
|
43
|
-
* The `TypingEvent` `user` property is now initialized correctly (#29, thanks @
|
47
|
+
* The `TypingEvent` `user` property is now initialized correctly (#29, thanks @purintai)
|
44
48
|
|
45
49
|
## 1.4.6
|
46
50
|
*Bugfix-only release.*
|
data/lib/discordrb/version.rb
CHANGED
@@ -12,6 +12,7 @@ module Discordrb::Voice
|
|
12
12
|
# A voice connection consisting of a UDP socket and a websocket client
|
13
13
|
class VoiceBot
|
14
14
|
attr_reader :stream_time, :encoder
|
15
|
+
attr_accessor :adjust_interval, :adjust_offset, :adjust_average
|
15
16
|
|
16
17
|
def initialize(channel, bot, token, session, endpoint)
|
17
18
|
@bot = bot
|
@@ -20,6 +21,10 @@ module Discordrb::Voice
|
|
20
21
|
|
21
22
|
@sequence = @time = 0
|
22
23
|
|
24
|
+
@adjust_interval = 100
|
25
|
+
@adjust_offset = 10
|
26
|
+
@adjust_average = false
|
27
|
+
|
23
28
|
@encoder = Encoder.new
|
24
29
|
@ws.connect
|
25
30
|
end
|
@@ -91,14 +96,14 @@ module Discordrb::Voice
|
|
91
96
|
|
92
97
|
self.speaking = true
|
93
98
|
loop do
|
94
|
-
|
95
|
-
break unless @io
|
96
|
-
|
97
|
-
if count % 100 == 10
|
99
|
+
if count % @adjust_interval == @adjust_offset
|
98
100
|
# Starting from the tenth packet, perform length adjustment every 100 packets (2 seconds)
|
99
101
|
@length_adjust = Time.now.nsec
|
100
102
|
end
|
101
103
|
|
104
|
+
break unless @playing
|
105
|
+
break unless @io
|
106
|
+
|
102
107
|
# Read some data from the buffer
|
103
108
|
buf = nil
|
104
109
|
begin
|
@@ -135,7 +140,12 @@ module Discordrb::Voice
|
|
135
140
|
# Difference between length_adjust and now in ms
|
136
141
|
ms_diff = (Time.now.nsec - @length_adjust) / 1_000_000.0
|
137
142
|
if ms_diff >= 0
|
138
|
-
@
|
143
|
+
if @adjust_average
|
144
|
+
@length = (IDEAL_LENGTH - ms_diff + @length) / 2.0
|
145
|
+
else
|
146
|
+
@length = IDEAL_LENGTH - ms_diff
|
147
|
+
end
|
148
|
+
|
139
149
|
@bot.debug("Length adjustment: new length #{@length}")
|
140
150
|
end
|
141
151
|
@length_adjust = nil
|