Voice Rework -- Events, Track Queues (#806)

This implements a proof-of-concept for an improved audio frontend. The largest change is the introduction of events and event handling: both by time elapsed and by track events, such as ending or looping. Following on from this, the library now includes a basic, event-driven track queue system (which people seem to ask for unusually often). A new sample, `examples/13_voice_events`, demonstrates both the `TrackQueue` system and some basic events via the `~queue` and `~play_fade` commands.

Locks are removed from around the control of `Audio` objects, which should allow the backend to be moved to a more granular futures-based backend solution in a cleaner way.
This commit is contained in:
Kyle Simpson
2020-10-29 20:25:20 +00:00
committed by Alex M. M
commit 7e4392ae68
76 changed files with 8756 additions and 0 deletions

155
Cargo.toml Normal file
View File

@@ -0,0 +1,155 @@
[package]
authors = ["Kyle Simpson <kyleandrew.simpson@gmail.com>"]
description = "An async Rust library for the Discord voice API."
documentation = "https://docs.rs/songbird"
edition = "2018"
homepage = "https://github.com/serenity-rs/serenity"
include = ["src/**/*.rs", "Cargo.toml"]
keywords = ["discord", "api", "rtp", "audio"]
license = "ISC"
name = "songbird"
readme = "README.md"
repository = "https://github.com/serenity-rs/serenity.git"
version = "0.1.0"
[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tracing = "0.1"
tracing-futures = "0.2"
[dependencies.async-trait]
optional = true
version = "0.1"
[dependencies.async-tungstenite]
default-features = false
features = ["tokio-runtime"]
optional = true
version = "0.9"
[dependencies.audiopus]
optional = true
version = "0.2"
[dependencies.byteorder]
optional = true
version = "1"
[dependencies.discortp]
features = ["discord-full"]
optional = true
version = "0.2"
[dependencies.flume]
optional = true
version = "0.9"
[dependencies.futures]
version = "0.3"
[dependencies.parking_lot]
optional = true
version = "0.11"
[dependencies.rand]
optional = true
version = "0.7"
[dependencies.serenity]
optional = true
features = ["voice", "gateway"]
path = "../"
version = "0.9.0-rc.2"
[dependencies.serenity-voice-model]
optional = true
path = "../voice-model"
version = "0.9.0-rc.2"
[dependencies.spin_sleep]
optional = true
version = "1"
[dependencies.streamcatcher]
optional = true
version = "0.1"
[dependencies.tokio]
optional = true
version = "0.2"
default-features = false
[dependencies.twilight-gateway]
optional = true
version = "0.1"
default-features = false
[dependencies.twilight-model]
optional = true
version = "0.1"
default-features = false
[dependencies.url]
optional = true
version = "2"
[dependencies.xsalsa20poly1305]
optional = true
version = "0.5"
[dev-dependencies]
criterion = "0.3"
utils = { path = "utils" }
[features]
default = [
"serenity-rustls",
"driver",
"gateway",
]
gateway = [
"flume",
"parking_lot",
"tokio/sync",
]
driver = [
"async-trait",
"async-tungstenite",
"audiopus",
"byteorder",
"discortp",
"flume",
"parking_lot",
"rand",
"serenity-voice-model",
"spin_sleep",
"streamcatcher",
"tokio/fs",
"tokio/io-util",
"tokio/net",
"tokio/rt-core",
"tokio/time",
"tokio/process",
"tokio/sync",
"url",
"xsalsa20poly1305",
]
rustls = ["async-tungstenite/tokio-rustls"]
native = ["async-tungstenite/tokio-native-tls"]
serenity-rustls = ["serenity/rustls_backend", "rustls", "gateway", "serenity-deps"]
serenity-native = ["serenity/native_tls_backend", "native", "gateway", "serenity-deps"]
twilight-rustls = ["twilight", "twilight-gateway/rustls", "rustls", "gateway"]
twilight-native = ["twilight", "twilight-gateway/native", "native", "gateway"]
twilight = ["twilight-model"]
simd-zlib = ["twilight-gateway/simd-zlib"]
stock-zlib = ["twilight-gateway/stock-zlib"]
serenity-deps = ["async-trait"]
[[bench]]
name = "mixing"
path = "benches/mixing.rs"
harness = false
[package.metadata.docs.rs]
all-features = true