mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
AudioBackend_Tick!!
This commit is contained in:
parent
e1d830064c
commit
5c136aea57
12
src/Audio.c
12
src/Audio.c
@ -950,12 +950,14 @@ static int channelIDs;
|
||||
static struct AudioMemPools audioPools[64];
|
||||
AudioDriver drv;
|
||||
bool switchAudio = false;
|
||||
extern void* audrv_mutex;
|
||||
void* audrv_mutex;
|
||||
|
||||
static cc_bool AudioBackend_Init(void) {
|
||||
if (switchAudio) return true;
|
||||
switchAudio = true;
|
||||
|
||||
audrv_mutex = Mutex_Create();
|
||||
|
||||
Mem_Set(audioPools, 0, sizeof(audioPools));
|
||||
|
||||
static const AudioRendererConfig arConfig =
|
||||
@ -980,9 +982,17 @@ static cc_bool AudioBackend_Init(void) {
|
||||
|
||||
return R_SUCCEEDED(res);
|
||||
}
|
||||
|
||||
void AudioBackend_Tick(void) {
|
||||
Mutex_Lock(audrv_mutex);
|
||||
if (switchAudio) audrvUpdate(&drv);
|
||||
Mutex_Unlock(audrv_mutex);
|
||||
}
|
||||
|
||||
static void AudioBackend_Free(void) {
|
||||
if (!switchAudio) return;
|
||||
switchAudio = false;
|
||||
Mutex_Free(audrv_mutex);
|
||||
|
||||
audrvClose(&drv);
|
||||
audrenExit();
|
||||
|
@ -37,8 +37,6 @@ const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;
|
||||
const cc_result ReturnCode_DirectoryExists = EEXIST;
|
||||
const char* Platform_AppNameSuffix = " Switch";
|
||||
|
||||
void* audrv_mutex;
|
||||
|
||||
|
||||
alignas(16) u8 __nx_exception_stack[0x1000];
|
||||
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
|
||||
@ -521,12 +519,9 @@ void Platform_Init(void) {
|
||||
// Configure our supported input layout: a single player with standard controller styles
|
||||
padConfigureInput(1, HidNpadStyleSet_NpadStandard);
|
||||
hidInitializeTouchScreen();
|
||||
|
||||
audrv_mutex = Mutex_Create();
|
||||
}
|
||||
void Platform_Free(void) {
|
||||
socketExit();
|
||||
Mutex_Free(audrv_mutex);
|
||||
}
|
||||
|
||||
cc_bool Platform_DescribeError(cc_result res, cc_string* dst) {
|
||||
|
@ -22,9 +22,6 @@
|
||||
static EGLDisplay s_display;
|
||||
static EGLContext s_context;
|
||||
static EGLSurface s_surface;
|
||||
extern AudioDriver drv;
|
||||
extern bool switchAudio;
|
||||
extern void* audrv_mutex;
|
||||
|
||||
static cc_bool launcherMode;
|
||||
static Framebuffer fb;
|
||||
@ -139,11 +136,6 @@ void Window_ProcessEvents(double delta) {
|
||||
// Scan the gamepad. This should be done once for each frame
|
||||
padUpdate(&pad);
|
||||
|
||||
Mutex_Lock(audrv_mutex);
|
||||
if (switchAudio)
|
||||
audrvUpdate(&drv);
|
||||
Mutex_Unlock(audrv_mutex);
|
||||
|
||||
if (!appletMainLoop()) {
|
||||
Window_Main.Exists = false;
|
||||
Window_RequestClose();
|
||||
|
Loading…
x
Reference in New Issue
Block a user