Do not close audio streams when audio settings change

This commit is contained in:
Toni Wilen 2023-09-20 21:23:24 +03:00
parent af28515bbd
commit b08835d389
3 changed files with 9 additions and 12 deletions

View File

@ -2018,7 +2018,10 @@ void audio_reset (void)
audio_stream[i].evtime = MAX_EV;
}
}
audio_total_extra_streams = 0;
for (int i = 0; i < AUDIO_CHANNEL_STREAMS; i++) {
audio_extra_streams[i] = 0;
}
last_cycles = get_cycles ();
next_sample_evtime = scaled_sample_evtime;
schedule_audio ();
@ -2045,6 +2048,7 @@ static int sound_prefs_changed (void)
|| changed_prefs.sound_volume_cd != currprefs.sound_volume_cd
|| changed_prefs.sound_volume_master != currprefs.sound_volume_master
|| changed_prefs.sound_volume_board != currprefs.sound_volume_board
|| changed_prefs.sound_volume_midi != currprefs.sound_volume_midi
|| changed_prefs.sound_stereo_swap_paula != currprefs.sound_stereo_swap_paula
|| changed_prefs.sound_stereo_swap_ahi != currprefs.sound_stereo_swap_ahi
|| changed_prefs.sound_filter != currprefs.sound_filter
@ -2134,6 +2138,7 @@ void set_audio (void)
currprefs.sound_volume_paula = changed_prefs.sound_volume_paula;
currprefs.sound_volume_master = changed_prefs.sound_volume_master;
currprefs.sound_volume_board = changed_prefs.sound_volume_board;
currprefs.sound_volume_midi = changed_prefs.sound_volume_midi;
currprefs.sound_volume_cd = changed_prefs.sound_volume_cd;
currprefs.sound_stereo_swap_paula = changed_prefs.sound_stereo_swap_paula;
currprefs.sound_stereo_swap_ahi = changed_prefs.sound_stereo_swap_ahi;
@ -2245,10 +2250,6 @@ void set_audio (void)
cdp->data.mixvol = 0;
}
}
audio_total_extra_streams = 0;
for (int i = 0; i < AUDIO_CHANNEL_STREAMS; i++) {
audio_extra_streams[i] = 0;
}
set_extra_prehandler();
if (currprefs.produce_sound == 0) {

View File

@ -18,7 +18,6 @@ static int midi_emu_streamid;
static float base_midi_emu_event;
static int midi_evt_time;
static int midi_emu_freq;
static uae_s16 midi_volume;
int midi_emu;
static const TCHAR *cm32lctl[] = {
@ -166,7 +165,6 @@ bool midi_emu_available(const TCHAR *id)
void midi_update_sound(float v)
{
base_midi_emu_event = v;
midi_volume = (100 - currprefs.sound_volume_midi) * 32768 / 100;
}
static bool audio_state_midi_emu(int streamid, void *params)
@ -174,11 +172,11 @@ static bool audio_state_midi_emu(int streamid, void *params)
int sample[2] = { 0 };
if (mt32context) {
int vol = currprefs.sound_volume_midi;
int vol = (100 - currprefs.sound_volume_midi) * 32768 / 100;
mt32emu_bit16s stream[2];
mt32emu_render_bit16s(mt32context, stream, 1);
sample[0] = stream[0] * midi_volume / 32768;
sample[1] = stream[1] * midi_volume / 32768;
sample[0] = stream[0] * vol / 32768;
sample[1] = stream[1] * vol / 32768;
}
midi_evt_time = (int)(base_midi_emu_event * CYCLE_UNIT / midi_emu_freq);

View File

@ -2607,12 +2607,10 @@ int check_prefs_changed_gfx(void)
}
if (currprefs.win32_midiindev != changed_prefs.win32_midiindev ||
currprefs.win32_midioutdev != changed_prefs.win32_midioutdev ||
currprefs.sound_volume_midi != changed_prefs.sound_volume_midi ||
currprefs.win32_midirouter != changed_prefs.win32_midirouter)
{
currprefs.win32_midiindev = changed_prefs.win32_midiindev;
currprefs.win32_midioutdev = changed_prefs.win32_midioutdev;
currprefs.sound_volume_midi = changed_prefs.sound_volume_midi;
currprefs.win32_midirouter = changed_prefs.win32_midirouter;
#ifdef SERIAL_PORT