--- uae/src/audio.c 2018/04/24 16:41:58 1.1.1.2 +++ uae/src/audio.c 2018/04/24 16:43:19 1.1.1.3 @@ -436,24 +436,26 @@ void check_prefs_changed_audio (void) return; close_sound (); + currprefs.produce_sound = changed_prefs.produce_sound; currprefs.stereo = changed_prefs.stereo; currprefs.sound_bits = changed_prefs.sound_bits; - if (currprefs.produce_sound >= 1) { - if (! init_sound ()) { - if (currprefs.produce_sound == -1) { - fprintf (stderr, "Sound is not supported.\n"); - } else { - fprintf (stderr, "Sorry, can't initialize sound.\n"); - currprefs.produce_sound = 0; - } - } else { - last_cycles = cycles - 1; - next_sample_evtime = sample_evtime; - } + if (currprefs.produce_sound < 2) + return; + + if (init_sound ()) { + last_cycles = cycles - 1; + next_sample_evtime = sample_evtime; + return; + } + if (! sound_available) { + fprintf (stderr, "Sound is not supported.\n"); } else { - printf ("Sound system shut down.\n"); + fprintf (stderr, "Sorry, can't initialize sound.\n"); + currprefs.produce_sound = 0; + /* So we don't do this every frame */ + changed_prefs.produce_sound = 0; } } @@ -488,7 +490,7 @@ void update_audio (void) audio_channel[2].evtime -= best_evtime; audio_channel[3].evtime -= best_evtime; n_cycles -= best_evtime; - if (next_sample_evtime == 0) { + if (next_sample_evtime == 0 && currprefs.produce_sound > 1) { next_sample_evtime = sample_evtime; (*sample_handler) (); }