pause/unpause audio when enter/exit menus

This commit is contained in:
Aaron Culliney 2013-11-16 13:44:32 -08:00
parent 078391410d
commit e0a79c7c3a

View File

@ -28,6 +28,7 @@
#include "cpu.h" #include "cpu.h"
#include "prefs.h" #include "prefs.h"
#include "timing.h" #include "timing.h"
#include "soundcore.h"
/* from misc.c */ /* from misc.c */
extern uid_t user, privileged; extern uid_t user, privileged;
@ -247,35 +248,45 @@ void c_periodic_update(int dummysig) {
case kF1: case kF1:
pthread_mutex_lock(&interface_mutex); pthread_mutex_lock(&interface_mutex);
SoundSystemPause();
c_interface_select_diskette( 0 ); c_interface_select_diskette( 0 );
SoundSystemUnpause();
pthread_mutex_unlock(&interface_mutex); pthread_mutex_unlock(&interface_mutex);
break; break;
case kF2: case kF2:
pthread_mutex_lock(&interface_mutex); pthread_mutex_lock(&interface_mutex);
SoundSystemPause();
c_interface_select_diskette( 1 ); c_interface_select_diskette( 1 );
SoundSystemUnpause();
pthread_mutex_unlock(&interface_mutex); pthread_mutex_unlock(&interface_mutex);
break; break;
case kF4: case kF4:
pthread_mutex_lock(&interface_mutex); pthread_mutex_lock(&interface_mutex);
SoundSystemPause();
while (c_mygetch(1) == -1) while (c_mygetch(1) == -1)
{ {
struct timespec ts = { .tv_sec=0, .tv_nsec=1 }; struct timespec ts = { .tv_sec=0, .tv_nsec=1 };
nanosleep(&ts, NULL); nanosleep(&ts, NULL);
} }
SoundSystemUnpause();
pthread_mutex_unlock(&interface_mutex); pthread_mutex_unlock(&interface_mutex);
break; break;
case kF5: case kF5:
pthread_mutex_lock(&interface_mutex); pthread_mutex_lock(&interface_mutex);
SoundSystemPause();
c_interface_keyboard_layout(); c_interface_keyboard_layout();
SoundSystemUnpause();
pthread_mutex_unlock(&interface_mutex); pthread_mutex_unlock(&interface_mutex);
break; break;
case kF7: case kF7:
pthread_mutex_lock(&interface_mutex); pthread_mutex_lock(&interface_mutex);
SoundSystemPause();
c_do_debugging(); c_do_debugging();
SoundSystemUnpause();
pthread_mutex_unlock(&interface_mutex); pthread_mutex_unlock(&interface_mutex);
break; break;
#if 0 #if 0
@ -291,7 +302,9 @@ void c_periodic_update(int dummysig) {
case kF10: case kF10:
pthread_mutex_lock(&interface_mutex); pthread_mutex_lock(&interface_mutex);
SoundSystemPause();
c_interface_parameters(); c_interface_parameters();
SoundSystemUnpause();
pthread_mutex_unlock(&interface_mutex); pthread_mutex_unlock(&interface_mutex);
break; break;
} }