Skip to content

Add end() method to MixerVoice to allow samples to finish playing bef… #10309

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rhammell
Copy link

@rhammell rhammell commented May 5, 2025

Added an end method to the MixerVoice class within the auidomixer library.

Calling this method will set the object's loop flag to False. This is different than the stop method, which ends the sample immediately, and instead allows any looping sample to play thorugh its entirety before ending.

This feature was added to fix a problem where samples ended via stop created a loud clicking sound from the connected speaker. By allowing the samples to play out fully, the clicking does not exist.

I have tested this on multiple looping audio samples.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! One suggestion to fix the compile and you'll want to tweak the formatting to get a minimal diff. Thanks!

//| sample to finish before looping again ""
//| ...
//|
STATIC mp_obj_t audiomixer_mixervoice_obj_end(mp_obj_t self_in) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
STATIC mp_obj_t audiomixer_mixervoice_obj_end(mp_obj_t self_in) {
static mp_obj_t audiomixer_mixervoice_obj_end(mp_obj_t self_in) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants