File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2622,7 +2622,11 @@ void play_toads_jingle(void) {
26222622/**
26232623 * Called from threads: thread5_game_loop
26242624 */
2625+ void GameEngine_LockAudioThread (void );
2626+ void GameEngine_UnlockAudioThread (void );
2627+
26252628void sound_reset (u8 presetId ) {
2629+ GameEngine_LockAudioThread ();
26262630#ifndef VERSION_JP
26272631 if (presetId >= 8 ) {
26282632 presetId = 0 ;
@@ -2651,6 +2655,7 @@ void sound_reset(u8 presetId) {
26512655 D_80332108 = (D_80332108 & 0xf0 ) + presetId ;
26522656 gSoundMode = D_80332108 >> 4 ;
26532657 sHasStartedFadeOut = FALSE;
2658+ GameEngine_UnlockAudioThread ();
26542659}
26552660
26562661/**
Original file line number Diff line number Diff line change @@ -1182,6 +1182,14 @@ void GameEngine::EndAudioFrame() {
11821182 }
11831183}
11841184
1185+ extern " C" void GameEngine_LockAudioThread () {
1186+ audio.mutex .lock ();
1187+ }
1188+
1189+ extern " C" void GameEngine_UnlockAudioThread () {
1190+ audio.mutex .unlock ();
1191+ }
1192+
11851193void GameEngine::AudioInit () {
11861194 const auto resourceMgr = Ship::Context::GetInstance ()->GetResourceManager ();
11871195 resourceMgr->LoadResources (" sound" );
You can’t perform that action at this time.
0 commit comments