src/audio/emscripten/SDL_emscriptenaudio.c
author Alon Zakai <alonzakai@gmail.com>
Tue, 29 Jan 2019 12:21:22 +0000
changeset 12581 62f26ad46749
parent 12580 e5c1992fcd8b
permissions -rw-r--r--
Emscripten: No need for Runtime. for dynCalls
icculus@9278
     1
/*
icculus@9278
     2
  Simple DirectMedia Layer
slouken@12503
     3
  Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
icculus@9278
     4
icculus@9278
     5
  This software is provided 'as-is', without any express or implied
icculus@9278
     6
  warranty.  In no event will the authors be held liable for any damages
icculus@9278
     7
  arising from the use of this software.
icculus@9278
     8
icculus@9278
     9
  Permission is granted to anyone to use this software for any purpose,
icculus@9278
    10
  including commercial applications, and to alter it and redistribute it
icculus@9278
    11
  freely, subject to the following restrictions:
icculus@9278
    12
icculus@9278
    13
  1. The origin of this software must not be misrepresented; you must not
icculus@9278
    14
     claim that you wrote the original software. If you use this software
icculus@9278
    15
     in a product, an acknowledgment in the product documentation would be
icculus@9278
    16
     appreciated but is not required.
icculus@9278
    17
  2. Altered source versions must be plainly marked as such, and must not be
icculus@9278
    18
     misrepresented as being the original software.
icculus@9278
    19
  3. This notice may not be removed or altered from any source distribution.
icculus@9278
    20
*/
icculus@9278
    21
#include "../../SDL_internal.h"
icculus@9278
    22
icculus@9278
    23
#if SDL_AUDIO_DRIVER_EMSCRIPTEN
icculus@9278
    24
icculus@9278
    25
#include "SDL_audio.h"
icculus@9278
    26
#include "SDL_log.h"
icculus@9278
    27
#include "../SDL_audio_c.h"
icculus@9278
    28
#include "SDL_emscriptenaudio.h"
icculus@10760
    29
#include "SDL_assert.h"
icculus@9278
    30
icculus@9278
    31
#include <emscripten/emscripten.h>
icculus@9278
    32
icculus@10760
    33
static void
icculus@10760
    34
FeedAudioDevice(_THIS, const void *buf, const int buflen)
icculus@9278
    35
{
icculus@10760
    36
    const int framelen = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels;
icculus@10760
    37
    EM_ASM_ARGS({
alonzakai@12580
    38
        var SDL2 = Module['SDL2'];
icculus@10760
    39
        var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels'];
icculus@10760
    40
        for (var c = 0; c < numChannels; ++c) {
icculus@10760
    41
            var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c);
icculus@10760
    42
            if (channelData.length != $1) {
icculus@10760
    43
                throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!';
icculus@10760
    44
            }
icculus@9278
    45
icculus@10760
    46
            for (var j = 0; j < $1; ++j) {
icculus@10760
    47
                channelData[j] = HEAPF32[$0 + ((j*numChannels + c) << 2) >> 2];  /* !!! FIXME: why are these shifts here? */
icculus@10760
    48
            }
icculus@9278
    49
        }
icculus@10760
    50
    }, buf, buflen / framelen);
icculus@9278
    51
}
icculus@9278
    52
icculus@9278
    53
static void
icculus@9278
    54
HandleAudioProcess(_THIS)
icculus@9278
    55
{
icculus@10997
    56
    SDL_AudioCallback callback = this->callbackspec.callback;
icculus@10760
    57
    const int stream_len = this->callbackspec.size;
icculus@9278
    58
icculus@10238
    59
    /* Only do something if audio is enabled */
icculus@10238
    60
    if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) {
icculus@10760
    61
        if (this->stream) {
icculus@10760
    62
            SDL_AudioStreamClear(this->stream);
icculus@10760
    63
        }
icculus@9278
    64
        return;
icculus@10238
    65
    }
icculus@9278
    66
icculus@10760
    67
    if (this->stream == NULL) {  /* no conversion necessary. */
icculus@10760
    68
        SDL_assert(this->spec.size == stream_len);
icculus@10997
    69
        callback(this->callbackspec.userdata, this->work_buffer, stream_len);
icculus@10760
    70
    } else {  /* streaming/converting */
icculus@10760
    71
        int got;
icculus@10760
    72
        while (SDL_AudioStreamAvailable(this->stream) < ((int) this->spec.size)) {
icculus@10997
    73
            callback(this->callbackspec.userdata, this->work_buffer, stream_len);
icculus@10765
    74
            if (SDL_AudioStreamPut(this->stream, this->work_buffer, stream_len) == -1) {
icculus@10760
    75
                SDL_AudioStreamClear(this->stream);
icculus@10760
    76
                SDL_AtomicSet(&this->enabled, 0);
icculus@10761
    77
                break;
icculus@10760
    78
            }
icculus@9278
    79
        }
icculus@9278
    80
icculus@10765
    81
        got = SDL_AudioStreamGet(this->stream, this->work_buffer, this->spec.size);
icculus@10760
    82
        SDL_assert((got < 0) || (got == this->spec.size));
icculus@10760
    83
        if (got != this->spec.size) {
icculus@10765
    84
            SDL_memset(this->work_buffer, this->spec.silence, this->spec.size);
icculus@9278
    85
        }
icculus@9278
    86
    }
icculus@9278
    87
icculus@10765
    88
    FeedAudioDevice(this, this->work_buffer, this->spec.size);
icculus@9278
    89
}
icculus@9278
    90
icculus@9278
    91
static void
icculus@10274
    92
HandleCaptureProcess(_THIS)
icculus@10274
    93
{
icculus@10997
    94
    SDL_AudioCallback callback = this->callbackspec.callback;
icculus@10760
    95
    const int stream_len = this->callbackspec.size;
icculus@10274
    96
icculus@10274
    97
    /* Only do something if audio is enabled */
icculus@10274
    98
    if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) {
icculus@10760
    99
        SDL_AudioStreamClear(this->stream);
icculus@10274
   100
        return;
icculus@10274
   101
    }
icculus@10274
   102
icculus@10274
   103
    EM_ASM_ARGS({
alonzakai@12580
   104
        var SDL2 = Module['SDL2'];
icculus@10274
   105
        var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels;
icculus@10760
   106
        for (var c = 0; c < numChannels; ++c) {
icculus@10760
   107
            var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c);
icculus@10274
   108
            if (channelData.length != $1) {
icculus@10274
   109
                throw 'Web Audio capture buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!';
icculus@10274
   110
            }
icculus@10760
   111
icculus@10760
   112
            if (numChannels == 1) {  /* fastpath this a little for the common (mono) case. */
icculus@10760
   113
                for (var j = 0; j < $1; ++j) {
icculus@10760
   114
                    setValue($0 + (j * 4), channelData[j], 'float');
icculus@10274
   115
                }
icculus@10760
   116
            } else {
icculus@10274
   117
                for (var j = 0; j < $1; ++j) {
icculus@10274
   118
                    setValue($0 + (((j * numChannels) + c) * 4), channelData[j], 'float');
icculus@10274
   119
                }
icculus@10274
   120
            }
icculus@10274
   121
        }
icculus@10765
   122
    }, this->work_buffer, (this->spec.size / sizeof (float)) / this->spec.channels);
icculus@10274
   123
icculus@10274
   124
    /* okay, we've got an interleaved float32 array in C now. */
icculus@10274
   125
icculus@10760
   126
    if (this->stream == NULL) {  /* no conversion necessary. */
icculus@10760
   127
        SDL_assert(this->spec.size == stream_len);
icculus@10997
   128
        callback(this->callbackspec.userdata, this->work_buffer, stream_len);
icculus@10760
   129
    } else {  /* streaming/converting */
icculus@10765
   130
        if (SDL_AudioStreamPut(this->stream, this->work_buffer, this->spec.size) == -1) {
icculus@10760
   131
            SDL_AtomicSet(&this->enabled, 0);
icculus@10760
   132
        }
icculus@10760
   133
icculus@10760
   134
        while (SDL_AudioStreamAvailable(this->stream) >= stream_len) {
icculus@10765
   135
            const int got = SDL_AudioStreamGet(this->stream, this->work_buffer, stream_len);
icculus@10760
   136
            SDL_assert((got < 0) || (got == stream_len));
icculus@10760
   137
            if (got != stream_len) {
icculus@10765
   138
                SDL_memset(this->work_buffer, this->callbackspec.silence, stream_len);
icculus@10760
   139
            }
icculus@10997
   140
            callback(this->callbackspec.userdata, this->work_buffer, stream_len);  /* Send it to the app. */
icculus@10760
   141
        }
icculus@10274
   142
    }
icculus@10274
   143
}
icculus@10274
   144
icculus@10274
   145
icculus@10274
   146
static void
icculus@10281
   147
EMSCRIPTENAUDIO_CloseDevice(_THIS)
icculus@9278
   148
{
icculus@10274
   149
    EM_ASM_({
alonzakai@12580
   150
        var SDL2 = Module['SDL2'];
icculus@10274
   151
        if ($0) {
icculus@10274
   152
            if (SDL2.capture.silenceTimer !== undefined) {
icculus@10274
   153
                clearTimeout(SDL2.capture.silenceTimer);
icculus@10274
   154
            }
icculus@10301
   155
            if (SDL2.capture.stream !== undefined) {
icculus@10301
   156
                var tracks = SDL2.capture.stream.getAudioTracks();
icculus@10301
   157
                for (var i = 0; i < tracks.length; i++) {
icculus@10301
   158
                    SDL2.capture.stream.removeTrack(tracks[i]);
icculus@10301
   159
                }
icculus@10301
   160
                SDL2.capture.stream = undefined;
icculus@10301
   161
            }
icculus@10274
   162
            if (SDL2.capture.scriptProcessorNode !== undefined) {
icculus@10301
   163
                SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {};
icculus@10274
   164
                SDL2.capture.scriptProcessorNode.disconnect();
icculus@10274
   165
                SDL2.capture.scriptProcessorNode = undefined;
icculus@10274
   166
            }
icculus@10274
   167
            if (SDL2.capture.mediaStreamNode !== undefined) {
icculus@10274
   168
                SDL2.capture.mediaStreamNode.disconnect();
icculus@10274
   169
                SDL2.capture.mediaStreamNode = undefined;
icculus@10274
   170
            }
icculus@10274
   171
            if (SDL2.capture.silenceBuffer !== undefined) {
icculus@10274
   172
                SDL2.capture.silenceBuffer = undefined
icculus@10274
   173
            }
icculus@10274
   174
            SDL2.capture = undefined;
icculus@10274
   175
        } else {
icculus@10274
   176
            if (SDL2.audio.scriptProcessorNode != undefined) {
icculus@10274
   177
                SDL2.audio.scriptProcessorNode.disconnect();
icculus@10274
   178
                SDL2.audio.scriptProcessorNode = undefined;
icculus@10274
   179
            }
icculus@10274
   180
            SDL2.audio = undefined;
icculus@10274
   181
        }
icculus@10274
   182
        if ((SDL2.audioContext !== undefined) && (SDL2.audio === undefined) && (SDL2.capture === undefined)) {
icculus@10274
   183
            SDL2.audioContext.close();
icculus@10274
   184
            SDL2.audioContext = undefined;
icculus@10274
   185
        }
icculus@10274
   186
    }, this->iscapture);
icculus@10274
   187
icculus@10760
   188
#if 0  /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */
icculus@10255
   189
    SDL_free(this->hidden);
icculus@10760
   190
#endif
icculus@9278
   191
}
icculus@9278
   192
icculus@9278
   193
static int
icculus@10281
   194
EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
icculus@9278
   195
{
icculus@9278
   196
    SDL_bool valid_format = SDL_FALSE;
icculus@10274
   197
    SDL_AudioFormat test_format;
philipp@9344
   198
    int result;
icculus@9278
   199
icculus@10274
   200
    /* based on parts of library_sdl.js */
icculus@10274
   201
alonzakai@12580
   202
    /* create context */
icculus@10274
   203
    result = EM_ASM_INT({
alonzakai@12580
   204
        if(typeof(Module['SDL2']) === 'undefined') {
alonzakai@12580
   205
            Module['SDL2'] = {};
icculus@10274
   206
        }
alonzakai@12580
   207
        var SDL2 = Module['SDL2'];
icculus@10274
   208
        if (!$0) {
icculus@10274
   209
            SDL2.audio = {};
icculus@10274
   210
        } else {
icculus@10274
   211
            SDL2.capture = {};
icculus@10274
   212
        }
icculus@10274
   213
icculus@10274
   214
        if (!SDL2.audioContext) {
icculus@10274
   215
            if (typeof(AudioContext) !== 'undefined') {
icculus@10274
   216
                SDL2.audioContext = new AudioContext();
icculus@10274
   217
            } else if (typeof(webkitAudioContext) !== 'undefined') {
icculus@10274
   218
                SDL2.audioContext = new webkitAudioContext();
icculus@10274
   219
            }
icculus@10274
   220
        }
icculus@10274
   221
        return SDL2.audioContext === undefined ? -1 : 0;
icculus@10274
   222
    }, iscapture);
icculus@10274
   223
    if (result < 0) {
icculus@10274
   224
        return SDL_SetError("Web Audio API is not available!");
icculus@10274
   225
    }
icculus@10274
   226
icculus@10274
   227
    test_format = SDL_FirstAudioFormat(this->spec.format);
icculus@9278
   228
    while ((!valid_format) && (test_format)) {
icculus@9278
   229
        switch (test_format) {
icculus@9278
   230
        case AUDIO_F32: /* web audio only supports floats */
icculus@9278
   231
            this->spec.format = test_format;
icculus@9278
   232
icculus@9278
   233
            valid_format = SDL_TRUE;
icculus@9278
   234
            break;
icculus@9278
   235
        }
icculus@9278
   236
        test_format = SDL_NextAudioFormat();
icculus@9278
   237
    }
icculus@9278
   238
icculus@9278
   239
    if (!valid_format) {
icculus@9278
   240
        /* Didn't find a compatible format :( */
icculus@9278
   241
        return SDL_SetError("No compatible audio format!");
icculus@9278
   242
    }
icculus@9278
   243
icculus@9278
   244
    /* Initialize all variables that we clean on shutdown */
icculus@10760
   245
#if 0  /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */
icculus@9278
   246
    this->hidden = (struct SDL_PrivateAudioData *)
icculus@9278
   247
        SDL_malloc((sizeof *this->hidden));
icculus@9278
   248
    if (this->hidden == NULL) {
icculus@9278
   249
        return SDL_OutOfMemory();
icculus@9278
   250
    }
icculus@10257
   251
    SDL_zerop(this->hidden);
icculus@10760
   252
#endif
beuc@12413
   253
    this->hidden = (struct SDL_PrivateAudioData *)0x1;
icculus@9278
   254
icculus@9278
   255
    /* limit to native freq */
alonzakai@12580
   256
    this->spec.freq = EM_ASM_INT_V({
alonzakai@12580
   257
      var SDL2 = Module['SDL2'];
alonzakai@12580
   258
      return SDL2.audioContext.sampleRate;
alonzakai@12580
   259
    });
icculus@9278
   260
icculus@9278
   261
    SDL_CalculateAudioSpec(&this->spec);
icculus@9278
   262
icculus@10274
   263
    if (iscapture) {
icculus@10274
   264
        /* The idea is to take the capture media stream, hook it up to an
icculus@10274
   265
           audio graph where we can pass it through a ScriptProcessorNode
icculus@10274
   266
           to access the raw PCM samples and push them to the SDL app's
icculus@10274
   267
           callback. From there, we "process" the audio data into silence
icculus@10274
   268
           and forget about it. */
icculus@10274
   269
icculus@10274
   270
        /* This should, strictly speaking, use MediaRecorder for capture, but
icculus@10274
   271
           this API is cleaner to use and better supported, and fires a
icculus@10274
   272
           callback whenever there's enough data to fire down into the app.
icculus@10274
   273
           The downside is that we are spending CPU time silencing a buffer
icculus@10274
   274
           that the audiocontext uselessly mixes into any output. On the
icculus@10274
   275
           upside, both of those things are not only run in native code in
icculus@10274
   276
           the browser, they're probably SIMD code, too. MediaRecorder
icculus@10274
   277
           feels like it's a pretty inefficient tapdance in similar ways,
icculus@10274
   278
           to be honest. */
icculus@10274
   279
icculus@10274
   280
        EM_ASM_({
alonzakai@12580
   281
            var SDL2 = Module['SDL2'];
icculus@10274
   282
            var have_microphone = function(stream) {
icculus@10283
   283
                //console.log('SDL audio capture: we have a microphone! Replacing silence callback.');
icculus@10283
   284
                if (SDL2.capture.silenceTimer !== undefined) {
icculus@10283
   285
                    clearTimeout(SDL2.capture.silenceTimer);
icculus@10283
   286
                    SDL2.capture.silenceTimer = undefined;
icculus@10283
   287
                }
icculus@10274
   288
                SDL2.capture.mediaStreamNode = SDL2.audioContext.createMediaStreamSource(stream);
icculus@10274
   289
                SDL2.capture.scriptProcessorNode = SDL2.audioContext.createScriptProcessor($1, $0, 1);
icculus@10274
   290
                SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {
icculus@10355
   291
                    if ((SDL2 === undefined) || (SDL2.capture === undefined)) { return; }
icculus@10274
   292
                    audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0);
icculus@10274
   293
                    SDL2.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer;
alonzakai@12581
   294
                    dynCall('vi', $2, [$3]);
icculus@10274
   295
                };
icculus@10274
   296
                SDL2.capture.mediaStreamNode.connect(SDL2.capture.scriptProcessorNode);
icculus@10274
   297
                SDL2.capture.scriptProcessorNode.connect(SDL2.audioContext.destination);
icculus@10301
   298
                SDL2.capture.stream = stream;
icculus@10274
   299
            };
icculus@10274
   300
icculus@10274
   301
            var no_microphone = function(error) {
icculus@10283
   302
                //console.log('SDL audio capture: we DO NOT have a microphone! (' + error.name + ')...leaving silence callback running.');
icculus@10274
   303
            };
icculus@10274
   304
icculus@10274
   305
            /* we write silence to the audio callback until the microphone is available (user approves use, etc). */
icculus@10274
   306
            SDL2.capture.silenceBuffer = SDL2.audioContext.createBuffer($0, $1, SDL2.audioContext.sampleRate);
icculus@10274
   307
            SDL2.capture.silenceBuffer.getChannelData(0).fill(0.0);
icculus@10274
   308
            var silence_callback = function() {
icculus@10274
   309
                SDL2.capture.currentCaptureBuffer = SDL2.capture.silenceBuffer;
alonzakai@12581
   310
                dynCall('vi', $2, [$3]);
icculus@10274
   311
            };
icculus@10274
   312
icculus@10276
   313
            SDL2.capture.silenceTimer = setTimeout(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000);
icculus@10274
   314
icculus@10274
   315
            if ((navigator.mediaDevices !== undefined) && (navigator.mediaDevices.getUserMedia !== undefined)) {
icculus@10274
   316
                navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then(have_microphone).catch(no_microphone);
icculus@10274
   317
            } else if (navigator.webkitGetUserMedia !== undefined) {
icculus@10274
   318
                navigator.webkitGetUserMedia({ audio: true, video: false }, have_microphone, no_microphone);
icculus@10274
   319
            }
icculus@10274
   320
        }, this->spec.channels, this->spec.samples, HandleCaptureProcess, this);
icculus@10274
   321
    } else {
icculus@10274
   322
        /* setup a ScriptProcessorNode */
icculus@10274
   323
        EM_ASM_ARGS({
alonzakai@12580
   324
            var SDL2 = Module['SDL2'];
icculus@10274
   325
            SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0);
icculus@10274
   326
            SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) {
icculus@10355
   327
                if ((SDL2 === undefined) || (SDL2.audio === undefined)) { return; }
icculus@10274
   328
                SDL2.audio.currentOutputBuffer = e['outputBuffer'];
alonzakai@12581
   329
                dynCall('vi', $2, [$3]);
icculus@10274
   330
            };
icculus@10274
   331
            SDL2.audio.scriptProcessorNode['connect'](SDL2.audioContext['destination']);
icculus@10274
   332
        }, this->spec.channels, this->spec.samples, HandleAudioProcess, this);
icculus@10274
   333
    }
icculus@10274
   334
icculus@9278
   335
    return 0;
icculus@9278
   336
}
icculus@9278
   337
icculus@9278
   338
static int
icculus@10281
   339
EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
icculus@9278
   340
{
philipp@11034
   341
    int available;
philipp@11034
   342
    int capture_available;
philipp@11034
   343
icculus@9278
   344
    /* Set the function pointers */
icculus@10281
   345
    impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice;
icculus@10281
   346
    impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice;
icculus@9278
   347
icculus@9278
   348
    impl->OnlyHasDefaultOutputDevice = 1;
icculus@9278
   349
icculus@9278
   350
    /* no threads here */
icculus@9278
   351
    impl->SkipMixerLock = 1;
icculus@9278
   352
    impl->ProvidesOwnCallbackThread = 1;
icculus@9278
   353
icculus@9278
   354
    /* check availability */
philipp@11034
   355
    available = EM_ASM_INT_V({
icculus@9278
   356
        if (typeof(AudioContext) !== 'undefined') {
icculus@9278
   357
            return 1;
icculus@9278
   358
        } else if (typeof(webkitAudioContext) !== 'undefined') {
icculus@9278
   359
            return 1;
icculus@9278
   360
        }
icculus@9278
   361
        return 0;
icculus@9278
   362
    });
icculus@9278
   363
philipp@9831
   364
    if (!available) {
philipp@9831
   365
        SDL_SetError("No audio context available");
philipp@9831
   366
    }
philipp@9831
   367
philipp@11034
   368
    capture_available = available && EM_ASM_INT_V({
icculus@10274
   369
        if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) {
icculus@10274
   370
            return 1;
icculus@10274
   371
        } else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') {
icculus@10274
   372
            return 1;
icculus@10274
   373
        }
icculus@10274
   374
        return 0;
icculus@10274
   375
    });
icculus@10274
   376
icculus@10274
   377
    impl->HasCaptureSupport = capture_available ? SDL_TRUE : SDL_FALSE;
icculus@10274
   378
    impl->OnlyHasDefaultCaptureDevice = capture_available ? SDL_TRUE : SDL_FALSE;
icculus@10274
   379
icculus@9278
   380
    return available;
icculus@9278
   381
}
icculus@9278
   382
icculus@10281
   383
AudioBootStrap EMSCRIPTENAUDIO_bootstrap = {
icculus@10281
   384
    "emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, 0
icculus@9278
   385
};
icculus@9278
   386
icculus@9278
   387
#endif /* SDL_AUDIO_DRIVER_EMSCRIPTEN */
icculus@9278
   388
icculus@9278
   389
/* vi: set ts=4 sw=4 expandtab: */