Commit graph

414 commits

Author SHA1 Message Date
JasonLG1979
96f5a4d54d Fix clippy lint and add back ALSA padding. 2023-09-04 10:40:22 -05:00
Jason Gray
b867ab2eab
Merge branch 'dev' into resampling 2023-09-04 10:23:41 -05:00
JasonLG1979
8aaab0a210 More touch ups 2023-09-03 17:32:55 -05:00
Jarkko Lehtoranta
e3db0994bc
Use single player and mixer instances 2023-07-19 14:49:17 +03:00
Jarkko Lehtoranta
c6b62b82d4
Allow player session changes 2023-07-19 14:49:17 +03:00
Jarkko Lehtoranta
ddadcc9ea0
Add a health check method to player 2023-07-19 14:49:17 +03:00
Jarkko Lehtoranta
46195f18d6
Handle play_request_id as an event 2023-07-19 14:49:05 +03:00
Wang Guan
d6257c41ca make clippy happy: clippy::default-constructed-unit-structs 2023-07-14 00:21:37 +09:00
JasonLG1979
a331729f0e small clean up 2023-07-06 17:58:42 -05:00
JasonLG1979
3928d0775f New filter coeff's and only have one quality setting. 2023-07-05 23:47:38 -05:00
JasonLG1979
e31293cc10 Better Filters
All Windows calculated with pyfda (Python Filter Design Analysis Tool)
https://github.com/chipmuenk/pyfda
Window = Kaiser
beta = 8.6 (Similar to a Blackman Window)
fc = 22.5kHz
-86dB by 23kHz

This also gets rid of Linear Interpolation which leaves only Low and High both being Windowed Sinc.
2023-07-04 04:02:39 -05:00
JasonLG1979
ac68d2431e DRAY things up a bit 2023-07-03 15:20:23 -05:00
JasonLG1979
33e2ce65d3 Anti-alias Linear Interpolation also. 2023-07-03 14:10:21 -05:00
JasonLG1979
cb8f6c954d Duh, just use resample_factor_reciprocal
The resample_factor_reciprocal also happens to be our
anti-alias cutoff. In this case it represents the minimum
output bandwidth needed to fully represent the input.
2023-07-02 22:16:14 -05:00
JasonLG1979
87bbd539b7 Add anti-alias filtering just in case
Cap the output bandwidth to 92%.
Even at 48kHz it still translates to 100% source bandwidth.
This just provides a little bit of anti-alias filtering.
There is more then likely nothing there to filter,
but it doesn't hurt or cost us anything to make sure.
2023-07-02 17:59:11 -05:00
JasonLG1979
74e3f938da Make sure that decoder picks up where it left of going from paused to play
Since we are including the pipeline latency in the position we need to seek to the correct position when going from paused to play.

We can also drop the ALSA and PulseAudio buffers instead of draining them since their latency's are factored in.
2023-07-02 04:31:04 -05:00
JasonLG1979
c4dc7347c7 Change Interpolation Quality to default to High 2023-06-30 13:55:34 -05:00
JasonLG1979
25425dab5c Put CommonSampleRates to some use and clean up backend imports 2023-06-30 12:36:12 -05:00
JasonLG1979
15e2b441aa Fully implement CommonSampleRates 2023-06-29 16:35:54 -05:00
JasonLG1979
1ab5bac786 Address review comments 2023-06-28 22:16:33 -05:00
JasonLG1979
cea92a9c3a Avoid unnecessary Vec -> Slice -> Vec
In the case of a resampler bypass
2023-06-27 19:21:02 -05:00
JasonLG1979
20414e44b8 More warnings 2023-06-27 17:05:52 -05:00
JasonLG1979
841f923549 Remove unnecessary step
Our interpolation_coefficients are already normalized.
2023-06-27 16:13:31 -05:00
JasonLG1979
4b081b1365 Warn that trying to resample 44.1kHz to 44.1kHz is a stupid thing to do. 2023-06-26 18:00:39 -05:00
JasonLG1979
c29ec3f473 Add warning about Normalisation Attack or Release being to small 2023-06-26 17:45:28 -05:00
JasonLG1979
98f1fe84dd Reduce allocations 2023-06-26 05:11:30 -05:00
JasonLG1979
d3ae1cdc55 Update all deps 2023-06-25 21:09:43 -05:00
JasonLG1979
528a8a431e Don't pad the alsa buffer anymore on stop.
It's no longer necessary with the SymphoniaDecoder, in fact it causes the problem it used to prevent. Namely pops when you pause.
2023-06-24 22:50:32 -05:00
JasonLG1979
ac2c05a0f8 Reset the resampler's latency when stopped 2023-06-24 20:16:21 -05:00
JasonLG1979
f7c56dff44 Remove AudioPacketPosition
We don't need it since we now tell if we've skipped packets by calculating a max delta.
2023-06-24 18:59:01 -05:00
JasonLG1979
5e02b6643d Simplify time calculations in SymphoniaDecoder
Time impl's from f64 (as secs) so there's no need to manually calculate it beyond converting ms to sec.

If we grab the TimeBase in new we don't need to continually call decoder.codec_params().time_base everytime we want to convert ts to ms.
2023-06-24 18:10:35 -05:00
JasonLG1979
0bdfa726ca Remove round from pulse get_latency_pcm, floor math is fine 2023-06-24 15:26:29 -05:00
JasonLG1979
74b52e83fa Improve resampler performance
Do less calls into the worker.
2023-06-24 15:06:28 -05:00
JasonLG1979
46b8f84d6a Make sure there is only ever one allocation when converting
Collect is probably fine but for code that's this hot it's worth the couple extra lines to make certain there's only ever one allocation when it comes to the returned Vec.
2023-06-23 12:00:42 -05:00
JasonLG1979
5da8ddf5e2 Rename set_factor to update_normalisation_data to better indicate what it does 2023-06-23 11:24:10 -05:00
JasonLG1979
bfb0366c90 Make sure the ResampleWorker task_receiver is also drained on drop 2023-06-23 10:10:14 -05:00
JasonLG1979
0e3ffe5394 Harmonize thread names and debug messages 2023-06-23 03:08:22 -05:00
JasonLG1979
8d35b4b860 Update notify_about_position logic
It would be so much easier to use elapsed but elapsed could potentially panic is rare cases.

See: https://doc.rust-lang.org/std/time/struct.Instant.html#monotonicity

Otherwise this is pretty straight forward.
If anything fails getting expected_position_ms it will return 0 which will trigger a notify if either stream_position_ms or decoder_position_ms is > 1000.

If all goes well it's simply a matter of calculating the max delta of expected_position_ms and stream_position_ms and expected_position_ms and decoder_position_ms.
So if the decoder or the sample pipeline are off by more than 1 sec we notify.
2023-06-23 00:38:15 -05:00
JasonLG1979
09bd1bd324 Fix up notify 2023-06-22 04:43:56 -05:00
JasonLG1979
586e9f1929 Fix clippy lint round 1000 + a small bug fix 2023-06-22 01:40:50 -05:00
JasonLG1979
2a8da828c4 Fix clippy lint 2023-06-22 01:26:15 -05:00
JasonLG1979
efec96b9cc Put it all together 2023-06-21 23:32:03 -05:00
JasonLG1979
e1ea400220 Change the backends so that they support the diffrent sample rates 2023-06-21 22:17:41 -05:00
JasonLG1979
3bcf5498d2 Convert get_latency_pcm to get_latency_ms in sample_pipeline 2023-06-21 21:11:37 -05:00
JasonLG1979
9861a582a6 Add sample_pipeline 2023-06-21 20:55:00 -05:00
JasonLG1979
375f83797a Add normaliser 2023-06-21 20:48:02 -05:00
JasonLG1979
3b64f25286 Add resampler 2023-06-21 20:29:22 -05:00
JasonLG1979
71660a2351 Add InterpolationQuality and SampleRate enums 2023-06-21 19:51:14 -05:00
JasonLG1979
7dae33c4f0 Use default macro 2023-06-21 19:24:40 -05:00
JasonLG1979
35b94bdc94 Add the ability to get backend latency 2023-06-21 19:17:23 -05:00