test/loopwavequeue.c
author Ryan C. Gordon <icculus@icculus.org>
Fri, 12 Aug 2016 19:59:00 -0400
changeset 10266 c09f06c4e8c8
parent 9998 f67cf37e9cd4
permissions -rw-r--r--
emscripten: send fake mouse events for touches, like other targets do. (This really should be handled at the higher level and not in the individual targets, but this fixes the immediate bug.)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9012
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
/*
9998
f67cf37e9cd4 Updated copyright to 2016
Sam Lantinga <slouken@libsdl.org>
parents: 9922
diff changeset
     2
  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
9012
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
  This software is provided 'as-is', without any express or implied
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
  warranty.  In no event will the authors be held liable for any damages
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
  arising from the use of this software.
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
  Permission is granted to anyone to use this software for any purpose,
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
  including commercial applications, and to alter it and redistribute it
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
  freely.
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
*/
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
/* Program to load a wave file and loop playing it using SDL sound queueing */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
#include <stdio.h>
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
#include <stdlib.h>
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
9420
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    18
#ifdef __EMSCRIPTEN__
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    19
#include <emscripten/emscripten.h>
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    20
#endif
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    21
9079
373df87521e5 Fixed bug 2688 - failure to build test/loopwavequeue.c on Linux
Sam Lantinga <slouken@libsdl.org>
parents: 9012
diff changeset
    22
#include "SDL.h"
373df87521e5 Fixed bug 2688 - failure to build test/loopwavequeue.c on Linux
Sam Lantinga <slouken@libsdl.org>
parents: 9012
diff changeset
    23
9012
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
#if HAVE_SIGNAL_H
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
#include <signal.h>
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
#endif
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
struct
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
{
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
    SDL_AudioSpec spec;
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
    Uint8 *sound;               /* Pointer to wave data */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
    Uint32 soundlen;            /* Length of wave data */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
    int soundpos;               /* Current play position */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
} wave;
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
static void
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
quit(int rc)
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
{
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
    SDL_Quit();
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    42
    exit(rc);
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
}
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
static int done = 0;
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
void
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
poked(int sig)
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
{
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
    done = 1;
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
}
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
9420
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    52
void
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    53
loop()
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    54
{
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    55
#ifdef __EMSCRIPTEN__
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    56
    if (done || (SDL_GetAudioStatus() != SDL_AUDIO_PLAYING)) {
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    57
        emscripten_cancel_main_loop();
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    58
    }
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    59
    else
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    60
#endif
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    61
    {
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    62
        /* The device from SDL_OpenAudio() is always device #1. */
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    63
        const Uint32 queued = SDL_GetQueuedAudioSize(1);
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    64
        SDL_Log("Device has %u bytes queued.\n", (unsigned int) queued);
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    65
        if (queued <= 8192) {  /* time to requeue the whole thing? */
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    66
            if (SDL_QueueAudio(1, wave.sound, wave.soundlen) == 0) {
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    67
                SDL_Log("Device queued %u more bytes.\n", (unsigned int) wave.soundlen);
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    68
            } else {
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    69
                SDL_Log("Device FAILED to queue %u more bytes: %s\n", (unsigned int) wave.soundlen, SDL_GetError());
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    70
            }
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    71
        }
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    72
    }
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    73
}
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
    74
9012
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
int
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
main(int argc, char *argv[])
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
{
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
    char filename[4096];
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9619
diff changeset
    80
    /* Enable standard application logging */
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9619
diff changeset
    81
    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
9012
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    82
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    83
    /* Load the SDL library */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    84
    if (SDL_Init(SDL_INIT_AUDIO) < 0) {
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    85
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    86
        return (1);
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87
    }
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    88
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    89
    if (argc > 1) {
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    90
        SDL_strlcpy(filename, argv[1], sizeof(filename));
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
    } else {
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    92
        SDL_strlcpy(filename, "sample.wav", sizeof(filename));
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    93
    }
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
    /* Load the wave file into memory */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    95
    if (SDL_LoadWAV(filename, &wave.spec, &wave.sound, &wave.soundlen) == NULL) {
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    96
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    97
        quit(1);
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
    }
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   100
    wave.spec.callback = NULL;  /* we'll push audio. */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   101
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
#if HAVE_SIGNAL_H
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
    /* Set the signals */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
#ifdef SIGHUP
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   105
    signal(SIGHUP, poked);
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   106
#endif
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   107
    signal(SIGINT, poked);
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   108
#ifdef SIGQUIT
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   109
    signal(SIGQUIT, poked);
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   110
#endif
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
    signal(SIGTERM, poked);
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
#endif /* HAVE_SIGNAL_H */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
    /* Initialize fillerup() variables */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
    if (SDL_OpenAudio(&wave.spec, NULL) < 0) {
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError());
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
        SDL_FreeWAV(wave.sound);
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
        quit(2);
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
    }
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
    /*static x[99999]; SDL_QueueAudio(1, x, sizeof (x));*/
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
    /* Let the audio run */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
    SDL_PauseAudio(0);
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
9420
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
   126
    done = 0;
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
   127
9012
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
    /* Note that we stuff the entire audio buffer into the queue in one
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
       shot. Most apps would want to feed it a little at a time, as it
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   130
       plays, but we're going for simplicity here. */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
    
9420
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
   132
#ifdef __EMSCRIPTEN__
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
   133
    emscripten_set_main_loop(loop, 0, 1);
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
   134
#else
9012
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   135
    while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING))
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
    {
9420
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
   137
        loop();
9012
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
        SDL_Delay(100);  /* let it play for awhile. */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
    }
9420
5ffb5a958c43 Updated test program for Emscripten.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9348
diff changeset
   141
#endif
9012
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
    /* Clean up on signal */
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   144
    SDL_CloseAudio();
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   145
    SDL_FreeWAV(wave.sound);
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   146
    SDL_Quit();
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
    return 0;
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
}
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
aa058c87737b Added audio device buffer queueing API.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
/* vi: set ts=4 sw=4 expandtab: */