Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Resampling Support #1180

Open
wants to merge 57 commits into
base: dev
Choose a base branch
from
Open

Commits on Jun 22, 2023

  1. Configuration menu
    Copy the full SHA
    0cefd0e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    35b94bd View commit details
    Browse the repository at this point in the history
  3. Use default macro

    JasonLG1979 committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    7dae33c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    71660a2 View commit details
    Browse the repository at this point in the history
  5. Add resampler

    JasonLG1979 committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    3b64f25 View commit details
    Browse the repository at this point in the history
  6. Add normaliser

    JasonLG1979 committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    375f837 View commit details
    Browse the repository at this point in the history
  7. Add sample_pipeline

    JasonLG1979 committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    9861a58 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3bcf549 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    e1ea400 View commit details
    Browse the repository at this point in the history
  10. Put it all together

    JasonLG1979 committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    efec96b View commit details
    Browse the repository at this point in the history
  11. Fix clippy lint

    JasonLG1979 committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    2a8da82 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    586e9f1 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    b5e0ea2 View commit details
    Browse the repository at this point in the history
  14. Fix up notify

    JasonLG1979 committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    09bd1bd View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2023

  1. 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.
    JasonLG1979 committed Jun 23, 2023
    Configuration menu
    Copy the full SHA
    8d35b4b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0e3ffe5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bfb0366 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5da8ddf View commit details
    Browse the repository at this point in the history
  5. 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.
    JasonLG1979 committed Jun 23, 2023
    Configuration menu
    Copy the full SHA
    46b8f84 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    340bac5 View commit details
    Browse the repository at this point in the history
  7. Add release-dist-optimized profile

    release-dist-optimized inherits from `release`. Useful if you're distributing librespot at part of a project. The diffrences are:
    
    panic = "abort", Makes librespot abort instead of unwind and hang on a panic.
    Extremely useful when running librespot unattended as a system service for example to allow for auto-restarts.
    
    codegen-units = 1 and lto = true, Take slighly longer to compile but produce more optimized binaries.
    JasonLG1979 committed Jun 23, 2023
    Configuration menu
    Copy the full SHA
    ad47630 View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2023

  1. Improve resampler performance

    Do less calls into the worker.
    JasonLG1979 committed Jun 24, 2023
    Configuration menu
    Copy the full SHA
    74b52e8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0bdfa72 View commit details
    Browse the repository at this point in the history
  3. 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.
    JasonLG1979 committed Jun 24, 2023
    Configuration menu
    Copy the full SHA
    5e02b66 View commit details
    Browse the repository at this point in the history
  4. Remove AudioPacketPosition

    We don't need it since we now tell if we've skipped packets by calculating a max delta.
    JasonLG1979 committed Jun 24, 2023
    Configuration menu
    Copy the full SHA
    f7c56df View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2023

  1. Configuration menu
    Copy the full SHA
    ac2c05a View commit details
    Browse the repository at this point in the history
  2. 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.
    JasonLG1979 committed Jun 25, 2023
    Configuration menu
    Copy the full SHA
    528a8a4 View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2023

  1. Update all deps

    JasonLG1979 committed Jun 26, 2023
    Configuration menu
    Copy the full SHA
    d3ae1cd View commit details
    Browse the repository at this point in the history
  2. Don't use Instant elapsed

    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
    JasonLG1979 committed Jun 26, 2023
    Configuration menu
    Copy the full SHA
    8e6d452 View commit details
    Browse the repository at this point in the history
  3. Reduce allocations

    JasonLG1979 committed Jun 26, 2023
    Configuration menu
    Copy the full SHA
    98f1fe8 View commit details
    Browse the repository at this point in the history
  4. Don't handle messages that are not intended for us in spirc.

    This prevents 2 active instances of librespot from effectively arguing over who the current active instance actually is. Without it events recurse.
    JasonLG1979 committed Jun 26, 2023
    Configuration menu
    Copy the full SHA
    2fa2bf8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c29ec3f View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4b081b1 View commit details
    Browse the repository at this point in the history

Commits on Jun 27, 2023

  1. Break message recursion.

    JasonLG1979 committed Jun 27, 2023
    Configuration menu
    Copy the full SHA
    d1e4b44 View commit details
    Browse the repository at this point in the history
  2. Remove unnecessary step

    Our interpolation_coefficients are already normalized.
    JasonLG1979 committed Jun 27, 2023
    Configuration menu
    Copy the full SHA
    841f923 View commit details
    Browse the repository at this point in the history
  3. More warnings

    JasonLG1979 committed Jun 27, 2023
    Configuration menu
    Copy the full SHA
    20414e4 View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2023

  1. Avoid unnecessary Vec -> Slice -> Vec

    In the case of a resampler bypass
    JasonLG1979 committed Jun 28, 2023
    Configuration menu
    Copy the full SHA
    cea92a9 View commit details
    Browse the repository at this point in the history

Commits on Jun 29, 2023

  1. Address review comments

    JasonLG1979 committed Jun 29, 2023
    Configuration menu
    Copy the full SHA
    1ab5bac View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    15e2b44 View commit details
    Browse the repository at this point in the history

Commits on Jun 30, 2023

  1. Configuration menu
    Copy the full SHA
    00ee65b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b15b48b View commit details
    Browse the repository at this point in the history
  3. Revert remaining spirc changes

    It's best to deal with this after discovery is fixed.
    JasonLG1979 committed Jun 30, 2023
    Configuration menu
    Copy the full SHA
    242e68a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    25425da View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c4dc734 View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2023

  1. Fix up for librespot-org#1178

    sys.uptime() returns sec not mins so it should be 60 not 1.
    JasonLG1979 committed Jul 2, 2023
    Configuration menu
    Copy the full SHA
    3dafb59 View commit details
    Browse the repository at this point in the history
  2. 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.
    JasonLG1979 committed Jul 2, 2023
    Configuration menu
    Copy the full SHA
    74e3f93 View commit details
    Browse the repository at this point in the history
  3. 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.
    JasonLG1979 committed Jul 2, 2023
    Configuration menu
    Copy the full SHA
    87bbd53 View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2023

  1. 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.
    JasonLG1979 committed Jul 3, 2023
    Configuration menu
    Copy the full SHA
    cb8f6c9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    33e2ce6 View commit details
    Browse the repository at this point in the history
  3. DRAY things up a bit

    JasonLG1979 committed Jul 3, 2023
    Configuration menu
    Copy the full SHA
    ac68d24 View commit details
    Browse the repository at this point in the history

Commits on Jul 4, 2023

  1. 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.
    JasonLG1979 committed Jul 4, 2023
    Configuration menu
    Copy the full SHA
    e31293c View commit details
    Browse the repository at this point in the history

Commits on Jul 6, 2023

  1. Configuration menu
    Copy the full SHA
    3928d07 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1bc1685 View commit details
    Browse the repository at this point in the history
  3. small clean up

    JasonLG1979 committed Jul 6, 2023
    Configuration menu
    Copy the full SHA
    a331729 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2023

  1. More touch ups

    JasonLG1979 committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    8aaab0a View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2023

  1. Configuration menu
    Copy the full SHA
    b867ab2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    96f5a4d View commit details
    Browse the repository at this point in the history