Skip to content

Conversation

ishbosamiya
Copy link
Contributor

Thank you for making this tool :)

Changes

  • Add support for play & pause using spacebar (KeyCode::Char(' ')) and media keys

  • Add support for volume control using up and down arrow keys and media keys and muting using m

    Volume is displayed to the user as a percentage with indication of muted when user mutes.

  • Add CLI arguments --volume and --display-mode under play subcommand

  • Update minimp3 to 0.6

    minimp3 used to depend on slice-deque which is unmaintained and
    contains memory safety issues, see Unsafe precondition(s) violated: slice::get_unchecked_mut index not within slice germangb/minimp3-rs#42. minimp3 now uses slice-ring-buffer. Used to panic in debug mode.

Note

Media keys should work in theory but crossterm may have a bug currently, see crossterm-rs/crossterm#897. Tested with alacritty but didn't work.

`minimp3` used to depend on `slice-deque` which is unmaintained and
contains memory safety issues, see
germangb/minimp3-rs#42

`minimp3` now uses `slice-ring-buffer`
This is so that media controls work when implemented.
This adds play, pause & playpause functionality. The media keys
haven't been tested but in theory should work.
This allows using `KeyCode::Char(' ')` to play and pause.
Allow user to set volume.
This prevents the problems of floating point, usually the person just
wants to adjust the percentage, doesn't care about the actual ratio.
Prior to this, once paused, would get stuck at receiving the frame
since the receiver sleeps when nothing is available, thus no events
are polled. By receiving only when playing, this eliminates the issue.

NOTE: cannot use `try_recv()` since it would lead to flickering when
this thread is running faster than the audio producing thread.
@tsirysndr tsirysndr self-requested a review August 13, 2025 20:41
@tsirysndr tsirysndr added the enhancement New feature or request label Aug 13, 2025
@tsirysndr
Copy link
Owner

Thanks a ton for this, @ishbosamiya , great work!
Play/pause on space and volume/mute + CLI flags are exactly what we needed. I pulled it locally and basic controls work well.

@tsirysndr tsirysndr merged commit fe119ab into tsirysndr:main Aug 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants