Parcourir la source

emscriptenaudio: Don't force reset SDL3.audio_recording/audio_playback.

Otherwise, opening devices for recording and playback at the same time will
cause problems.
Ryan C. Gordon il y a 3 mois
Parent
commit
7d66d3271b
1 fichiers modifiés avec 6 ajouts et 2 suppressions
  1. 6 2
      src/audio/emscripten/SDL_emscriptenaudio.c

+ 6 - 2
src/audio/emscripten/SDL_emscriptenaudio.c

@@ -155,8 +155,12 @@ static bool EMSCRIPTENAUDIO_OpenDevice(SDL_AudioDevice *device)
             Module['SDL3'] = {};
         }
         var SDL3 = Module['SDL3'];
-        SDL3.audio_playback = {};
-        SDL3.audio_recording = {};
+        if (typeof(SDL3.audio_playback) === 'undefined') {
+            SDL3.audio_playback = {};
+        }
+        if (typeof(SDL3.audio_recording) === 'undefined') {
+            SDL3.audio_recording = {};
+        }
 
         if (!SDL3.audioContext) {
             if (typeof(AudioContext) !== 'undefined') {