diff options
| author | Kyle Simpson <[email protected]> | 2018-01-31 19:12:56 +0000 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2018-01-31 11:12:56 -0800 |
| commit | 324a288fbb0dd7d135aa9aab876cf39dabb6a02e (patch) | |
| tree | 24f13043f4ddcb5bc656b7a547170223d826aedb /src/voice/mod.rs | |
| parent | Fix case insensitivity for aliases (#262) (diff) | |
| download | serenity-324a288fbb0dd7d135aa9aab876cf39dabb6a02e.tar.xz serenity-324a288fbb0dd7d135aa9aab876cf39dabb6a02e.zip | |
Multiple audio stream playback, volume control, pausing
* Fix Speaking state, use latest voice API version
* Speaking state would remain stuck on after playing particularly long
stretches of audio. So far as I can tell, playing 5 frames of silence
BEFORE changing the state seems to do the trick.
* Added new constant to make sure the library uses v3 of the voice api,
which it is written for.
* Heartbeat interval adjusted by * .75 as recommended by Discord.
* Initial version of new Audio wrapper.
* Single audio file case, as before..
* Loop over all available audio samples.
* Combine audio streams, account for volume.
* Cheaper explicit Opus silence frames.
As per Discord's recommendation, use a well-known 3-byte silence frame when needed.
* A bit of cleanup
Cleanup some of the code, rename some short-form fields to longer forms
(e.g. `s/src/source`), and remove a breaking change.
`Handler::play` was changed to return `LockedAudio` instead of `()`. If
someone were to rely on `Handler::play` returning `()`, the return type
change would break their code. Instead, this functionality has been
added to a new `Handler::play_returning` function.
Diffstat (limited to 'src/voice/mod.rs')
| -rw-r--r-- | src/voice/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/voice/mod.rs b/src/voice/mod.rs index 70f1ae2..cae84a7 100644 --- a/src/voice/mod.rs +++ b/src/voice/mod.rs @@ -11,7 +11,7 @@ mod payload; mod streamer; mod threading; -pub use self::audio::{AudioReceiver, AudioSource, AudioType}; +pub use self::audio::{Audio, AudioReceiver, AudioSource, AudioType, LockedAudio}; pub use self::dca::DcaMetadata; pub use self::error::{DcaError, VoiceError}; pub use self::handler::Handler; @@ -26,5 +26,6 @@ pub(crate) enum Status { Connect(ConnectionInfo), #[allow(dead_code)] Disconnect, SetReceiver(Option<Box<AudioReceiver>>), - SetSender(Option<Box<AudioSource>>), + SetSender(Option<LockedAudio>), + AddSender(LockedAudio), } |