Symphonia v0.5.2 has all the API changes and fixes we were depending on, which leaves next one step closer to publishable.
Tested using `cargo make ready`.
Adds the "receive" feature, which is disabled by default. When this is disabled, the UDP receive task is not compiled and not run, and as an optimisation the UDP receive buffer size is set to 0. All related events are also removed.
This also removes the UDP Tx task, and moves packet and keepalive sends back into the mixer thread. This allows us to entirely remove channels and various allocations between the mixer and an async task created only for sending data (i.e., fewer memcopies).
If "receive" is enabled, UDP sends are now non-blocking due to technical constraints -- failure to send is non-fatal, but *will* drop affected packets. Given that blocking on a UDP send indicates that the OS cannot clear send buffers fast enough, this should alleviate OS load.
Closes#131.
Module docs mistakenly used the old doc-link format, so removing `create_player` never fired an error! These have also been partially rewritten to explain the role of `Track` and `TrackHandle`.
Includes some other misc fixes to links, mention of `TrackHandle::action` for metadata handling, etc.
Closes#140.
All dependencies have been moved to the new "dep:x" and "x?/feature" syntax to remove the bloat from the docs.rs/crates.io/lib.rs feature panes.
Accordingly, this lets us break "rustls" and "native" out from annoying hybrids like "serenity-rustls" or "twilight-native" -- specify your library and your backend, and it should just work.
The complete list of features is now: driver, gateway, serenity, twilight, rustls, native, builtin-queue, simd-json, internals (plus "default" and "full-doc").
This PR adds support for the simd-json library whenever decoding or encoding JSON responses. This may be enabled independently of serenity and twilight support for SIMD acceleration.
Co-authored-by: Kyle Simpson <kyleandrew.simpson@gmail.com>
This extensive PR rewrites the internal mixing logic of the driver to use symphonia for parsing and decoding audio data, and rubato to resample audio. Existing logic to decode DCA and Opus formats/data have been reworked as plugins for symphonia. The main benefit is that we no longer need to keep yt-dlp and ffmpeg processes alive, saving a lot of memory and CPU: all decoding can be done in Rust! In exchange, we now need to do a lot of the HTTP handling and resumption ourselves, but this is still a huge net positive.
`Input`s have been completely reworked such that all default (non-cached) sources are lazy by default, and are no longer covered by a special-case `Restartable`. These now span a gamut from a `Compose` (lazy), to a live source, to a fully `Parsed` source. As mixing is still sync, this includes adapters for `AsyncRead`/`AsyncSeek`, and HTTP streams.
`Track`s have been reworked so that they only contain initialisation state for each track. `TrackHandles` are only created once a `Track`/`Input` has been handed over to the driver, replacing `create_player` and related functions. `TrackHandle::action` now acts on a `View` of (im)mutable state, and can request seeks/readying via `Action`.
Per-track event handling has also been improved -- we can now determine and propagate the reason behind individual track errors due to the new backend. Some `TrackHandle` commands (seek etc.) benefit from this, and now use internal callbacks to signal completion.
Due to associated PRs on felixmcfelix/songbird from avid testers, this includes general clippy tweaks, API additions, and other repo-wide cleanup. Thanks go out to the below co-authors.
Co-authored-by: Gnome! <45660393+GnomedDev@users.noreply.github.com>
Co-authored-by: Alakh <36898190+alakhpc@users.noreply.github.com>
This commit undoes #64 (and bumps the library MSRV accordingly), and modifies #60 to match the new `Call` connection handling.
This was tested using `cargo make ready`, and rustc v1.49.0 on `examples/serenity/voice`.
* Add Makefile for common contributor tasks
Narrows down a few commands to automatically format when building, and neatly expose testing/benching.
Empty files added to describe contributor guidelines, overall architecture.
* First draft of contributor guidelines
* Simple architecture diagrams
* Add PNG variants of architecture diagrams
Swapping to these because not having Fira Sans installed on a viewing machine leads to terrible kerning.
* Architecture description.
* MD cross-refs.
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.