mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -04:00
don't de-init audren on AudioBackend_Free()
fixes sounds not playing when returning to launcher and starting the game again
This commit is contained in:
parent
5c136aea57
commit
8d4adefb0e
15
src/Audio.c
15
src/Audio.c
@ -956,7 +956,7 @@ static cc_bool AudioBackend_Init(void) {
|
|||||||
if (switchAudio) return true;
|
if (switchAudio) return true;
|
||||||
switchAudio = true;
|
switchAudio = true;
|
||||||
|
|
||||||
audrv_mutex = Mutex_Create();
|
if (!audrv_mutex) audrv_mutex = Mutex_Create();
|
||||||
|
|
||||||
Mem_Set(audioPools, 0, sizeof(audioPools));
|
Mem_Set(audioPools, 0, sizeof(audioPools));
|
||||||
|
|
||||||
@ -990,12 +990,9 @@ void AudioBackend_Tick(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void AudioBackend_Free(void) {
|
static void AudioBackend_Free(void) {
|
||||||
if (!switchAudio) return;
|
for (int i = 0; i < 24; i++) {
|
||||||
switchAudio = false;
|
audrvVoiceStop(&drv, i);
|
||||||
Mutex_Free(audrv_mutex);
|
}
|
||||||
|
|
||||||
audrvClose(&drv);
|
|
||||||
audrenExit();
|
|
||||||
}
|
}
|
||||||
#define AUDIO_HAS_BACKEND
|
#define AUDIO_HAS_BACKEND
|
||||||
|
|
||||||
@ -1155,7 +1152,7 @@ void Audio_AllocChunks(cc_uint32 size, void** chunks, int numChunks) {
|
|||||||
|
|
||||||
for (int j = 0; j < 64; j++) {
|
for (int j = 0; j < 64; j++) {
|
||||||
if (audioPools[j].chunk != NULL) continue;
|
if (audioPools[j].chunk != NULL) continue;
|
||||||
audioPools[j].chunk = chunks[i];
|
audioPools[j].chunk = dst;
|
||||||
audioPools[j].mpid = mpid;
|
audioPools[j].mpid = mpid;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1166,7 +1163,7 @@ void Audio_FreeChunks(void** chunks, int numChunks) {
|
|||||||
// remove memory pool from audren
|
// remove memory pool from audren
|
||||||
for (int i=0; i<numChunks; i++) {
|
for (int i=0; i<numChunks; i++) {
|
||||||
for (int j=0; j<64; j++) {
|
for (int j=0; j<64; j++) {
|
||||||
if (audioPools[j].chunk == chunks[i]) {
|
if (audioPools[j].chunk == chunks[0]) {
|
||||||
audrvMemPoolDetach(&drv, audioPools[j].mpid);
|
audrvMemPoolDetach(&drv, audioPools[j].mpid);
|
||||||
audrvMemPoolRemove(&drv, audioPools[j].mpid);
|
audrvMemPoolRemove(&drv, audioPools[j].mpid);
|
||||||
Mem_Set(&audioPools[j], 0, sizeof(struct AudioMemPools));
|
Mem_Set(&audioPools[j], 0, sizeof(struct AudioMemPools));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user