properly segregate audio-specific codepath

This commit is contained in:
Aaron Culliney 2015-09-06 17:24:48 -07:00
parent 2c97f7af19
commit e4c06c67a7
2 changed files with 9 additions and 1 deletions

View File

@ -81,7 +81,9 @@ bool alt_speed_enabled = false;
// misc
volatile uint8_t emul_reinitialize = 1;
bool emul_reinitialize_audio = 1UL;
#ifdef AUDIO_ENABLED
bool emul_reinitialize_audio = true;
#endif
#if MOBILE_DEVICE
static bool emul_reinitialize_background = true;
#endif
@ -198,10 +200,12 @@ void timing_toggleCPUSpeed(void) {
timing_initialize();
}
#ifdef AUDIO_ENABLED
void timing_reinitializeAudio(void) {
assert(cpu_isPaused() || (pthread_self() == cpu_thread_id));
emul_reinitialize_audio = true;
}
#endif
void cpu_pause(void) {
@ -523,9 +527,11 @@ static void *cpu_thread(void *dummyptr) {
break;
}
#ifdef AUDIO_ENABLED
if (UNLIKELY(emul_reinitialize_audio)) {
break;
}
#endif
#if MOBILE_DEVICE
if (UNLIKELY(emul_reinitialize_background)) {

View File

@ -91,10 +91,12 @@ bool timing_shouldAutoAdjustSpeed(void);
*/
void timing_initialize(void);
#ifdef AUDIO_ENABLED
/*
* force audio reinitialization
*/
void timing_reinitializeAudio(void);
#endif
/*
* Pause timing/CPU thread.