src/audio/winmm/SDL_winmm.c
author Sam Lantinga <slouken@libsdl.org>
Thu, 05 Jul 2012 12:16:44 -0400
changeset 6352 a9bcd26e7105
parent 6138 4c64952a58fb
child 6430 48d519500f7e
permissions -rwxr-xr-x
Removed unneeded audio buffer memset() for consistent behavior on all platforms.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5588
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
/*
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
  Simple DirectMedia Layer
6138
4c64952a58fb Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 6044
diff changeset
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
5588
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
  This software is provided 'as-is', without any express or implied
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
  arising from the use of this software.
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
  freely, subject to the following restrictions:
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
     claim that you wrote the original software. If you use this software
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
     appreciated but is not required.
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
     misrepresented as being the original software.
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
*/
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
#include "SDL_config.h"
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
6044
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5593
diff changeset
    23
#if SDL_AUDIO_DRIVER_WINMM
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5593
diff changeset
    24
5588
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
/* Allow access to a raw mixing buffer */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
#include "../../core/windows/SDL_windows.h"
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
#include <mmsystem.h>
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
#include "SDL_timer.h"
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
#include "SDL_audio.h"
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
#include "../SDL_audio_c.h"
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
#include "SDL_winmm.h"
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
#include "win_ce_semaphore.h"
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
#endif
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
5593
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    38
#define DETECT_DEV_IMPL(typ, capstyp) \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    39
static void DetectWave##typ##Devs(SDL_AddAudioDevice addfn) { \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    40
    const UINT devcount = wave##typ##GetNumDevs(); \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    41
    capstyp caps; \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    42
    UINT i; \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    43
    for (i = 0; i < devcount; i++) { \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    44
        if (wave##typ##GetDevCaps(i,&caps,sizeof(caps))==MMSYSERR_NOERROR) { \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    45
            char *name = WIN_StringToUTF8(caps.szPname); \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    46
            if (name != NULL) { \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    47
                addfn(name); \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    48
                SDL_free(name); \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    49
            } \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    50
        } \
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    51
    } \
5588
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
5593
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    54
DETECT_DEV_IMPL(Out, WAVEOUTCAPS)
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    55
DETECT_DEV_IMPL(In, WAVEINCAPS)
5588
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    56
5593
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    57
static void
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    58
WINMM_DetectDevices(int iscapture, SDL_AddAudioDevice addfn)
5588
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    59
{
5593
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    60
    if (iscapture) {
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    61
        DetectWaveInDevs(addfn);
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    62
    } else {
ab22ca13c47f Cleaned up audio device detection. Cleared out a lot of cut-and-paste.
Ryan C. Gordon <icculus@icculus.org>
parents: 5588
diff changeset
    63
        DetectWaveOutDevs(addfn);
5588
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    66
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
static void CALLBACK
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
CaptureSound(HWAVEIN hwi, UINT uMsg, DWORD_PTR dwInstance,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
          DWORD_PTR dwParam1, DWORD_PTR dwParam2)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
{
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
    SDL_AudioDevice *this = (SDL_AudioDevice *) dwInstance;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    73
    /* Only service "buffer is filled" messages */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
    if (uMsg != WIM_DATA)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
        return;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
    /* Signal that we have a new buffer of data */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
    ReleaseSemaphoreCE(this->hidden->audio_sem, 1, NULL);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
#else
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    81
    ReleaseSemaphore(this->hidden->audio_sem, 1, NULL);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    82
#endif
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    83
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    84
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    85
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    86
/* The Win32 callback for filling the WAVE device */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87
static void CALLBACK
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    88
FillSound(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    89
          DWORD_PTR dwParam1, DWORD_PTR dwParam2)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    90
{
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
    SDL_AudioDevice *this = (SDL_AudioDevice *) dwInstance;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    92
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    93
    /* Only service "buffer done playing" messages */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
    if (uMsg != WOM_DONE)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    95
        return;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    96
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    97
    /* Signal that we are done playing a buffer */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
    ReleaseSemaphoreCE(this->hidden->audio_sem, 1, NULL);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   100
#else
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   101
    ReleaseSemaphore(this->hidden->audio_sem, 1, NULL);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
#endif
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   105
static void
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   106
SetMMerror(char *function, MMRESULT code)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   107
{
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   108
    size_t len;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   109
    char errbuf[MAXERRORLENGTH];
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   110
    wchar_t werrbuf[MAXERRORLENGTH];
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
    SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
    len = SDL_strlen(errbuf);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
    waveOutGetErrorText(code, werrbuf, MAXERRORLENGTH - len);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
    WideCharToMultiByte(CP_ACP, 0, werrbuf, -1, errbuf + len,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
                        MAXERRORLENGTH - len, NULL, NULL);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
    SDL_SetError("%s", errbuf);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
static void
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
WINMM_WaitDevice(_THIS)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
{
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
    /* Wait for an audio chunk to finish */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   126
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   127
    WaitForSemaphoreCE(this->hidden->audio_sem, INFINITE);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
#else
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
    WaitForSingleObject(this->hidden->audio_sem, INFINITE);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   130
#endif
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   132
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   133
static Uint8 *
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
WINMM_GetDeviceBuf(_THIS)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   135
{
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
    return (Uint8 *) (this->hidden->
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   137
                      wavebuf[this->hidden->next_buffer].lpData);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
static void
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   141
WINMM_PlayDevice(_THIS)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
{
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
    /* Queue it up */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   144
    waveOutWrite(this->hidden->hout,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   145
                 &this->hidden->wavebuf[this->hidden->next_buffer],
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   146
                 sizeof(this->hidden->wavebuf[0]));
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
    this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
static void
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   151
WINMM_WaitDone(_THIS)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   152
{
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   153
    int i, left;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   154
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   155
    do {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   156
        left = NUM_BUFFERS;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   157
        for (i = 0; i < NUM_BUFFERS; ++i) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   158
            if (this->hidden->wavebuf[i].dwFlags & WHDR_DONE) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   159
                --left;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   160
            }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   161
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   162
        if (left > 0) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   163
            SDL_Delay(100);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   164
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   165
    } while (left > 0);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   166
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   167
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   168
static void
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   169
WINMM_CloseDevice(_THIS)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   170
{
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   171
    /* Close up audio */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   172
    if (this->hidden != NULL) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   173
        int i;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   174
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   175
        if (this->hidden->audio_sem) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   176
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   177
            CloseSynchHandle(this->hidden->audio_sem);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   178
#else
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   179
            CloseHandle(this->hidden->audio_sem);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   180
#endif
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   181
            this->hidden->audio_sem = 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   182
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   183
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   184
        if (this->hidden->hin) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   185
            waveInClose(this->hidden->hin);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   186
            this->hidden->hin = 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   187
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   188
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   189
        if (this->hidden->hout) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   190
            waveOutClose(this->hidden->hout);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   191
            this->hidden->hout = 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   192
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   193
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   194
        /* Clean up mixing buffers */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   195
        for (i = 0; i < NUM_BUFFERS; ++i) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   196
            if (this->hidden->wavebuf[i].dwUser != 0xFFFF) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   197
                waveOutUnprepareHeader(this->hidden->hout,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   198
                                       &this->hidden->wavebuf[i],
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   199
                                       sizeof(this->hidden->wavebuf[i]));
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   200
                this->hidden->wavebuf[i].dwUser = 0xFFFF;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   201
            }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   202
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   203
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   204
        if (this->hidden->mixbuf != NULL) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   205
            /* Free raw mixing buffer */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   206
            SDL_free(this->hidden->mixbuf);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   207
            this->hidden->mixbuf = NULL;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   208
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   209
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   210
        SDL_free(this->hidden);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   211
        this->hidden = NULL;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   212
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   213
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   214
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   215
static int
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   216
WINMM_OpenDevice(_THIS, const char *devname, int iscapture)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   217
{
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   218
    SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   219
    int valid_datatype = 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   220
    MMRESULT result;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   221
    WAVEFORMATEX waveformat;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   222
    UINT_PTR devId = WAVE_MAPPER;  /* WAVE_MAPPER == choose system's default */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   223
    char *utf8 = NULL;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   224
    int i;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   225
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   226
    if (devname != NULL) {  /* specific device requested? */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   227
        if (iscapture) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   228
            const int devcount = (int) waveInGetNumDevs();
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   229
            WAVEINCAPS caps;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   230
            for (i = 0; (i < devcount) && (devId == WAVE_MAPPER); i++) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   231
                result = waveInGetDevCaps(i, &caps, sizeof (caps));
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   232
                if (result != MMSYSERR_NOERROR)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   233
                    continue;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   234
                else if ((utf8 = WIN_StringToUTF8(caps.szPname)) == NULL)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   235
                    continue;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   236
                else if (SDL_strcmp(devname, utf8) == 0)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   237
                    devId = (UINT_PTR) i;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   238
                SDL_free(utf8);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   239
            }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   240
        } else {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   241
            const int devcount = (int) waveOutGetNumDevs();
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   242
            WAVEOUTCAPS caps;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   243
            for (i = 0; (i < devcount) && (devId == WAVE_MAPPER); i++) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   244
                result = waveOutGetDevCaps(i, &caps, sizeof (caps));
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   245
                if (result != MMSYSERR_NOERROR)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   246
                    continue;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   247
                else if ((utf8 = WIN_StringToUTF8(caps.szPname)) == NULL)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   248
                    continue;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   249
                else if (SDL_strcmp(devname, utf8) == 0)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   250
                    devId = (UINT_PTR) i;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   251
                SDL_free(utf8);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   252
            }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   253
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   254
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   255
        if (devId == WAVE_MAPPER) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   256
            SDL_SetError("Requested device not found");
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   257
            return 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   258
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   259
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   260
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   261
    /* Initialize all variables that we clean on shutdown */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   262
    this->hidden = (struct SDL_PrivateAudioData *)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   263
        SDL_malloc((sizeof *this->hidden));
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   264
    if (this->hidden == NULL) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   265
        SDL_OutOfMemory();
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   266
        return 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   267
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   268
    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   269
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   270
    /* Initialize the wavebuf structures for closing */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   271
    for (i = 0; i < NUM_BUFFERS; ++i)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   272
        this->hidden->wavebuf[i].dwUser = 0xFFFF;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   273
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   274
    while ((!valid_datatype) && (test_format)) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   275
        valid_datatype = 1;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   276
        this->spec.format = test_format;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   277
        switch (test_format) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   278
        case AUDIO_U8:
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   279
        case AUDIO_S16:
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   280
        case AUDIO_S32:
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   281
            break;              /* valid. */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   282
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   283
        default:
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   284
            valid_datatype = 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   285
            test_format = SDL_NextAudioFormat();
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   286
            break;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   287
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   288
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   289
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   290
    if (!valid_datatype) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   291
        WINMM_CloseDevice(this);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   292
        SDL_SetError("Unsupported audio format");
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   293
        return 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   294
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   295
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   296
    /* Set basic WAVE format parameters */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   297
    SDL_memset(&waveformat, '\0', sizeof(waveformat));
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   298
    waveformat.wFormatTag = WAVE_FORMAT_PCM;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   299
    waveformat.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   300
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   301
    if (this->spec.channels > 2)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   302
        this->spec.channels = 2;        /* !!! FIXME: is this right? */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   303
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   304
    waveformat.nChannels = this->spec.channels;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   305
    waveformat.nSamplesPerSec = this->spec.freq;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   306
    waveformat.nBlockAlign =
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   307
        waveformat.nChannels * (waveformat.wBitsPerSample / 8);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   308
    waveformat.nAvgBytesPerSec =
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   309
        waveformat.nSamplesPerSec * waveformat.nBlockAlign;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   310
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   311
    /* Check the buffer size -- minimum of 1/4 second (word aligned) */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   312
    if (this->spec.samples < (this->spec.freq / 4))
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   313
        this->spec.samples = ((this->spec.freq / 4) + 3) & ~3;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   314
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   315
    /* Update the fragment size as size in bytes */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   316
    SDL_CalculateAudioSpec(&this->spec);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   317
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   318
    /* Open the audio device */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   319
    if (iscapture) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   320
        result = waveInOpen(&this->hidden->hin, devId, &waveformat,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   321
                             (DWORD_PTR) CaptureSound, (DWORD_PTR) this,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   322
                             CALLBACK_FUNCTION);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   323
    } else {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   324
        result = waveOutOpen(&this->hidden->hout, devId, &waveformat,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   325
                             (DWORD_PTR) FillSound, (DWORD_PTR) this,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   326
                             CALLBACK_FUNCTION);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   327
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   328
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   329
    if (result != MMSYSERR_NOERROR) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   330
        WINMM_CloseDevice(this);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   331
        SetMMerror("waveOutOpen()", result);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   332
        return 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   333
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   334
#ifdef SOUND_DEBUG
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   335
    /* Check the sound device we retrieved */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   336
    {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   337
        WAVEOUTCAPS caps;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   338
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   339
        result = waveOutGetDevCaps((UINT) this->hidden->hout,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   340
                                   &caps, sizeof(caps));
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   341
        if (result != MMSYSERR_NOERROR) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   342
            WINMM_CloseDevice(this);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   343
            SetMMerror("waveOutGetDevCaps()", result);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   344
            return 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   345
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   346
        printf("Audio device: %s\n", caps.szPname);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   347
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   348
#endif
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   349
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   350
    /* Create the audio buffer semaphore */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   351
    this->hidden->audio_sem =
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   352
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   353
        CreateSemaphoreCE(NULL, NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   354
#else
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   355
        CreateSemaphore(NULL, NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   356
#endif
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   357
    if (this->hidden->audio_sem == NULL) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   358
        WINMM_CloseDevice(this);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   359
        SDL_SetError("Couldn't create semaphore");
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   360
        return 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   361
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   362
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   363
    /* Create the sound buffers */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   364
    this->hidden->mixbuf =
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   365
        (Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   366
    if (this->hidden->mixbuf == NULL) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   367
        WINMM_CloseDevice(this);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   368
        SDL_OutOfMemory();
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   369
        return 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   370
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   371
    for (i = 0; i < NUM_BUFFERS; ++i) {
6352
a9bcd26e7105 Removed unneeded audio buffer memset() for consistent behavior on all platforms.
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   372
        SDL_memset(&this->hidden->wavebuf[i], 0,
5588
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   373
                   sizeof(this->hidden->wavebuf[i]));
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   374
        this->hidden->wavebuf[i].dwBufferLength = this->spec.size;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   375
        this->hidden->wavebuf[i].dwFlags = WHDR_DONE;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   376
        this->hidden->wavebuf[i].lpData =
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   377
            (LPSTR) & this->hidden->mixbuf[i * this->spec.size];
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   378
        result = waveOutPrepareHeader(this->hidden->hout,
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   379
                                      &this->hidden->wavebuf[i],
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   380
                                      sizeof(this->hidden->wavebuf[i]));
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   381
        if (result != MMSYSERR_NOERROR) {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   382
            WINMM_CloseDevice(this);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   383
            SetMMerror("waveOutPrepareHeader()", result);
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   384
            return 0;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   385
        }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   386
    }
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   387
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   388
    return 1;                   /* Ready to go! */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   389
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   390
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   391
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   392
static int
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   393
WINMM_Init(SDL_AudioDriverImpl * impl)
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   394
{
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   395
    /* Set the function pointers */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   396
    impl->DetectDevices = WINMM_DetectDevices;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   397
    impl->OpenDevice = WINMM_OpenDevice;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   398
    impl->PlayDevice = WINMM_PlayDevice;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   399
    impl->WaitDevice = WINMM_WaitDevice;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   400
    impl->WaitDone = WINMM_WaitDone;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   401
    impl->GetDeviceBuf = WINMM_GetDeviceBuf;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   402
    impl->CloseDevice = WINMM_CloseDevice;
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   403
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   404
    return 1;   /* this audio target is available. */
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   405
}
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   406
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   407
AudioBootStrap WINMM_bootstrap = {
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   408
    "winmm", "Windows Waveform Audio", WINMM_Init, 0
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   409
};
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   410
6044
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5593
diff changeset
   411
#endif /* SDL_AUDIO_DRIVER_WINMM */
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5593
diff changeset
   412
5588
57bfc2a2a452 Reworked Windows waveOut code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   413
/* vi: set ts=4 sw=4 expandtab: */