Commit graph

14 commits

Author SHA1 Message Date
dis-da-moe
268dddae64
Force queue to play sources on frame boundaries (#455)
As I understand it, this is the issue:
  
     * Previously, when a queue has `keep_alive_if_empty` set to true, and it becomes empty, then it will push a silence lasting 10ms onto the queue.
 
     * This is an issue because `current_frame_len` would have returned the worst case, `512`, and the silence lasts less than that.
 
     * This means that unless the source is added immediately to the queue, and so a silence is never played, then the first actual source could start playing at a frame that is not aligned to its channels, or play at the wrong sample rate.
 
     * This is only determined by when the source is added to the queue after its initialization. This explains why the issue was inconsistent, as it relied on the speed of execution of code which is basically random.

Solution
 
     * Change the functionality of `Zero` to add a method to create a silence with a certain number of frames.
 
     * Replace the 10ms silence with a silence the length of `THRESHOLD`
 
     * Change queue's `current_frame_len` to return `THRESHOLD` if a silence will be played next.
2022-11-23 01:36:57 +01:00
Alejandro Perea
69a7f416a7
Move sound to assets/; Exclude it from package (#421)
* Move sound to `assets/`; Exclude it from package

* Exclude tests from package
2022-03-26 20:15:18 +01:00
Alex Butler
7ca3b1d635
fix crossfade 2018 & cargo fmt 2020-05-02 13:34:11 +01:00
Alex Butler
d7c77aa52e
Add OutputStreamHandle 2020-05-02 13:33:57 +01:00
Alex Butler
b5071c947d
Remove device mixer map, rename stream wrapper to OutputStream 2020-05-02 13:33:57 +01:00
Alex Butler
c93adb2582
Migrate to edition 2018
* Remove unstable/legacy rustfmt config
* Run rustfmt
2020-05-02 13:33:57 +01:00
Alex Butler
0517ee7216
Add RodioDevice wrapper for cpal::Device
* Remove static/global facilities.
2020-05-02 13:33:56 +01:00
Alex Butler
4bb832ba30 Remove exclusive borrow requirement in Sink, SpatialSink (#203)
The inner Mutex does not require this.
2018-11-16 11:18:07 +01:00
Francesco Zardi
6a8c71bdb2 Run cargo fmt 2018-04-19 10:03:48 +02:00
Francesco Zardi
95703113ba Rename 'endpoint' to 'device' 2018-04-19 08:59:27 +02:00
Francesco Zardi
cde47ab970 Rename default_endpoint() to, default_output_device(), reexport default_input_device() 2018-04-19 08:59:27 +02:00
Cam Jackson
8eaba65b5d Replace usages of deprecated functions in cpal 2017-10-11 21:31:15 +08:00
Pierre Krieger
88b0d40e4b Run rustfmt on the code 2017-07-03 10:10:00 +02:00
Jacob Kiesel
b4ecdfd075 Add spatial audio 2017-07-02 10:48:32 -06:00