-
-
Notifications
You must be signed in to change notification settings - Fork 5
Support for player controls (play, pause, volume control) #30
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`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
approved these changes
Aug 13, 2025
Thanks a ton for this, @ishbosamiya , great work! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you for making this tool :)
Changes
Add support for play & pause using spacebar (
KeyCode::Char(' ')
) and media keysAdd 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
underplay
subcommandUpdate
minimp3
to0.6
minimp3
used to depend onslice-deque
which is unmaintained andcontains memory safety issues, see Unsafe precondition(s) violated: slice::get_unchecked_mut index not within slice germangb/minimp3-rs#42.
minimp3
now usesslice-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 withalacritty
but didn't work.