plugins: Fix muted mixer channel (FS#13809)

Fixes regression where you may not have heard
any audio from some of the plugins modified by
commit 017dd72, due to the playback channel not
being unmuted.

Change-Id: Iaa184161c79d353dff6ef9bf3e0b39778c8b1bcd
This commit is contained in:
Christian Soffke 2026-04-23 16:41:49 +02:00
parent d1abd788d0
commit 7960dbb9a7
10 changed files with 30 additions and 7 deletions

View file

@ -474,6 +474,7 @@ void I_SubmitSound(void)
void I_ShutdownSound(void)
{
rb->pcmbuf_fade(false, false); /* Mute channel */
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
}
@ -508,6 +509,7 @@ void I_InitSound()
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif
rb->mixer_set_frequency(samplerate);
rb->pcmbuf_fade(false, true); /* Be sure channel is audible */
vol_lookup=malloc(128*256*sizeof(int));

View file

@ -787,7 +787,6 @@ static bool beating = false; /* A beat is/was playing and count needs to increas
static int display_state = 0; /* Current display state code. */
static bool display_trigger = false; /* Draw display on next occasion */
static bool sound_active = false;
static bool sound_paused = true;
/* global static buffer for messages in any situation */
@ -1168,7 +1167,7 @@ static void timer_callback(void)
if(minitick >= period)
{
minitick = 0;
if(!sound_active && !sound_paused && !tap_count)
if(!sound_paused && !tap_count)
{
sound_trigger = true;
rb->reset_poweroff_timer();
@ -1213,6 +1212,7 @@ static void cleanup(void)
if(fd >= 0) rb->close(fd);
metronome_pause();
rb->pcmbuf_fade(false, false); /* Mute channel */
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
tweak_volume(0);
rb->led(0);
@ -1561,6 +1561,7 @@ enum plugin_status plugin_start(const void* file)
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif
rb->mixer_set_frequency(SAMPR_44);
rb->pcmbuf_fade(false, true); /* Be sure channel is audible */
if(file)
{

View file

@ -411,6 +411,7 @@ static void start_sound(void)
.get_more = get_more,
};
rb->mixer_set_frequency(caps->samprs[sr_index]);
rb->pcmbuf_fade(false, true); /* Be sure channel is audible */
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, &cbs, NULL, 0);
sound_playing = true;
@ -424,6 +425,7 @@ static void stop_sound(void)
if (!sound_playing)
return;
rb->pcmbuf_fade(false, false); /* Mute channel */
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);

View file

@ -65,6 +65,9 @@ void rockbox_open_audio(int rate)
/* Set sample rate of the audio buffer. */
rb->mixer_set_frequency(rate);
/* Be sure channel is audible */
rb->pcmbuf_fade(false, true);
/* Initialize output buffer. */
for(i = 0; i < OUTBUFSIZE; i++)
outbuf[i].fill = 0;
@ -77,6 +80,9 @@ void rockbox_open_audio(int rate)
/* Close audio. */
void rockbox_close_audio(void)
{
/* Mute channel */
rb->pcmbuf_fade(false, false);
/* Stop playback. */
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);

View file

@ -56,12 +56,14 @@ void rockboy_pcm_init(void)
#endif
rb->mixer_set_frequency(pcm.hz); /* 44100 22050 11025 */
rb->pcmbuf_fade(false, true); /* Be sure channel is audible */
}
void rockboy_pcm_close(void)
{
memset(&pcm, 0, sizeof pcm);
newly_started = true;
rb->pcmbuf_fade(false, false); /* Mute channel */
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
}

View file

@ -215,6 +215,7 @@ static Uint8 *ROCKBOXAUD_GetAudioBuf(_THIS)
static void ROCKBOXAUD_CloseAudio(_THIS)
{
rb->pcmbuf_fade(false, false); /* Mute channel */
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
if ( this->hidden->mixbuf != NULL ) {
SDL_FreeAudioMem(this->hidden->mixbuf);
@ -260,6 +261,7 @@ static int ROCKBOXAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
LOGF("samplerate %d", spec->freq);
rb->mixer_set_frequency(spec->freq);
rb->pcmbuf_fade(false, true); /* Be sure channel is audible */
/* Allocate mixing buffer */
this->hidden->mixlen = spec->size;

View file

@ -214,6 +214,7 @@ static void play_tone(bool volume_set)
#if INPUT_SRC_CAPS != 0
/* Select playback */
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@ -221,11 +222,7 @@ static void play_tone(bool volume_set)
#endif
rb->mixer_set_frequency(hw_sampr);
#if INPUT_SRC_CAPS != 0
/* Recordable targets can play back from other sources */
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif
rb->pcmbuf_fade(false, true); /* Be sure channel is audible */
gen_quit = false;
output_clear();
@ -263,6 +260,7 @@ static void play_tone(bool volume_set)
rb->thread_wait(gen_thread_id);
rb->pcmbuf_fade(false, false); /* Mute channel */
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
#ifdef HAVE_ADJUSTABLE_CPU_FREQ

View file

@ -257,6 +257,9 @@ bool syssnd_init(void)
rb->mixer_set_frequency(HW_FREQ_44);
/* Be sure channel is audible */
rb->pcmbuf_fade(false, true);
rb->memset(channels, 0, sizeof(channels));
rb->memset(mixBuffers, 0, sizeof(mixBuffers));
@ -280,6 +283,9 @@ void syssnd_shutdown(void)
return;
}
/* Mute channel */
rb->pcmbuf_fade(false, false);
/* Stop playback. */
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);

View file

@ -1032,12 +1032,14 @@ void sys_startAudio(struct System* sys, AudioCallback callback, void *param)
static const struct mixer_play_cbs cbs = {
.get_more = get_more,
};
rb->pcmbuf_fade(false, true); /* Be sure channel is audible */
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, &cbs, NULL, 0);
}
void sys_stopAudio(struct System* sys)
{
(void) sys;
rb->pcmbuf_fade(false, false); /* Mute channel */
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
}

View file

@ -112,12 +112,14 @@ static void open_snd(void)
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif
rb->mixer_set_frequency(SAMPR_44);
rb->pcmbuf_fade(false, true); /* Be sure channel is audible */
}
static void close_snd(int normal)
{
(void)normal;
sound_avail = 0;
rb->pcmbuf_fade(false, false); /* Mute channel */
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
}