Mercurial > sdl-ios-xcode
annotate src/audio/mme/SDL_mmeaudio.c @ 3830:29e83f221c62 SDL-ryan-multiple-audio-device
Fixed some things to use SDL C runtime functions.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sat, 07 Oct 2006 19:56:47 +0000 |
parents | 1806fd1acba4 |
children | 66fb40445587 |
rev | line source |
---|---|
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
769
b8d311d90021
Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents:
755
diff
changeset
|
3 Copyright (C) 1997-2004 Sam Lantinga |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Library General Public License for more details. |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 /* Tru64 UNIX MME support */ |
1342
d73be99e9420
Fixed it Hayashi Naoyuki's way. :)
Sam Lantinga <slouken@libsdl.org>
parents:
1338
diff
changeset
|
25 #include <mme_api.h> |
d73be99e9420
Fixed it Hayashi Naoyuki's way. :)
Sam Lantinga <slouken@libsdl.org>
parents:
1338
diff
changeset
|
26 |
1358
c71e05b4dc2e
More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents:
1342
diff
changeset
|
27 #include "SDL_timer.h" |
1342
d73be99e9420
Fixed it Hayashi Naoyuki's way. :)
Sam Lantinga <slouken@libsdl.org>
parents:
1338
diff
changeset
|
28 #include "SDL_audio.h" |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
29 #include "../SDL_audio_c.h" |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 #include "SDL_mmeaudio.h" |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 static BOOL inUse[NUM_BUFFERS]; |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
34 static int |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
35 MME_Available(void) |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 { |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
37 return 1; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
40 static void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
41 SetMMerror(char *function, MMRESULT code) |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 { |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 int len; |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 char errbuf[MAXERRORLENGTH]; |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
46 SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function); |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
47 len = SDL_strlen(errbuf); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
48 waveOutGetErrorText(code, errbuf + len, MAXERRORLENGTH - len); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
49 SDL_SetError("%s", errbuf); |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
52 static void CALLBACK |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
53 MME_Callback(HWAVEOUT hwo, |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
54 UINT uMsg, DWORD dwInstance, LPARAM dwParam1, LPARAM dwParam2) |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 { |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 WAVEHDR *wp = (WAVEHDR *) dwParam1; |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
58 if (uMsg == WOM_DONE) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
59 inUse[wp->dwUser] = FALSE; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
62 static int |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
63 MME_OpenDevice(_THIS, const char *devname, int iscapture) |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 { |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
65 int valid_format = 0; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 MMRESULT result; |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
67 Uint8 *mixbuf = NULL; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 int i; |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
70 /* Initialize all variables that we clean on shutdown */ |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
71 this->hidden = (struct SDL_PrivateAudioData *) |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
72 SDL_malloc((sizeof *this->hidden)); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
73 if (this->hidden == NULL) { |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
74 SDL_OutOfMemory(); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
75 return 0; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
76 } |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
77 SDL_memset(this->hidden, 0, (sizeof *this->hidden)); |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 /* Set basic WAVE format parameters */ |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
80 this->hidden->shm = mmeAllocMem(sizeof(*this->hidden->shm)); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
81 if (this->hidden->shm == NULL) { |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
82 MME_CloseDevice(this); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
83 SDL_OutOfMemory(); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
84 return 0; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 } |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
86 |
3830
29e83f221c62
Fixed some things to use SDL C runtime functions.
Ryan C. Gordon <icculus@icculus.org>
parents:
3827
diff
changeset
|
87 SDL_memset(this->hidden->shm, '\0', sizeof (*this->hidden->shm)); |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
88 this->hidden->shm->sound = 0; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
89 this->hidden->shm->wFmt.wf.wFormatTag = WAVE_FORMAT_PCM; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 /* Determine the audio parameters from the AudioSpec */ |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
92 /* Try for a closest match on audio format */ |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
93 for (test_format = SDL_FirstAudioFormat(this->spec.format); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
94 !valid_format && test_format;) { |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
95 valid_format = 1; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
96 switch (test_format) { |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
97 case AUDIO_U8: |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
98 case AUDIO_S16: |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
99 case AUDIO_S32: |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
100 break; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
101 default: |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
102 valid_format = 0; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
103 test_format = SDL_NextAudioFormat(); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
104 } |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
105 } |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
106 |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
107 if (!valid_format) { |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
108 MME_CloseDevice(this); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
109 SDL_SetError("Unsupported audio format"); |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
110 return 0; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
113 this->spec.format = test_format; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
114 this->hidden->shm->wFmt.wBitsPerSample = SDL_AUDIO_BITSIZE(test_format); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
115 |
2006
b3741f227757
Updated Tru64 audio to support int32.
Ryan C. Gordon <icculus@icculus.org>
parents:
1895
diff
changeset
|
116 /* !!! FIXME: Can this handle more than stereo? */ |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
117 this->hidden->shm->wFmt.wf.nChannels = this->spec.channels; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
118 this->hidden->shm->wFmt.wf.nSamplesPerSec = this->spec.freq; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
119 this->hidden->shm->wFmt.wf.nBlockAlign = |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
120 this->hidden->shm->wFmt.wf.nChannels * |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
121 this->hidden->shm->wFmt.wBitsPerSample / 8; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
122 this->hidden->shm->wFmt.wf.nAvgBytesPerSec = |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
123 this->hidden->shm->wFmt.wf.nSamplesPerSec * |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
124 this->hidden->shm->wFmt.wf.nBlockAlign; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 /* Check the buffer size -- minimum of 1/4 second (word aligned) */ |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
127 if (this->spec.samples < (this->spec.freq / 4)) |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
128 this->spec.samples = ((this->spec.freq / 4) + 3) & ~3; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 /* Update the fragment size as size in bytes */ |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
131 SDL_CalculateAudioSpec(&this->spec); |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 /* Open the audio device */ |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
134 result = waveOutOpen(&(this->hidden->shm->sound), |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
135 WAVE_MAPPER, |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
136 &(this->hidden->shm->wFmt.wf), |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
137 MME_Callback, |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
138 NULL, (CALLBACK_FUNCTION | WAVE_OPEN_SHAREABLE)); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
139 if (result != MMSYSERR_NOERROR) { |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
140 MME_CloseDevice(this); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
141 SetMMerror("waveOutOpen()", result); |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
142 return 0; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 /* Create the sound buffers */ |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
146 mixbuf = (Uint8 *) mmeAllocBuffer(NUM_BUFFERS * (this->spec.size)); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
147 if (mixbuf == NULL) { |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
148 MME_CloseDevice(this); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
149 SDL_OutOfMemory(); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
150 return 0; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 } |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
152 this->hidden->mixbuf = mixbuf; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 for (i = 0; i < NUM_BUFFERS; i++) { |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
155 this->hidden->shm->wHdr[i].lpData = &mixbuf[i * (this->spec.size)]; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
156 this->hidden->shm->wHdr[i].dwBufferLength = this->spec.size; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
157 this->hidden->shm->wHdr[i].dwFlags = 0; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
158 this->hidden->shm->wHdr[i].dwUser = i; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
159 this->hidden->shm->wHdr[i].dwLoops = 0; /* loop control counter */ |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
160 this->hidden->shm->wHdr[i].lpNext = NULL; /* reserved for driver */ |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
161 this->hidden->shm->wHdr[i].reserved = 0; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
162 inUse[i] = FALSE; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 } |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
164 this->hidden->next_buffer = 0; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
165 |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
166 return 1; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
169 static void |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
170 MME_WaitDevice(_THIS) |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 { |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
172 while (inUse[this->hidden->next_buffer]) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
173 mmeWaitForCallbacks(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
174 mmeProcessCallbacks(); |
755
b1595db396a7
Date: Fri, 12 Dec 2003 11:51:21 +0900
Sam Lantinga <slouken@libsdl.org>
parents:
654
diff
changeset
|
175 } |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
178 static Uint8 * |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
179 MME_GetDeviceBuf(_THIS) |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 { |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
181 void *retval = this->hidden->shm->wHdr[this->hidden->next_buffer].lpData; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
182 inUse[this->hidden->next_buffer] = TRUE; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
183 return (Uint8 *) retval; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
186 static void |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
187 MME_PlayDevice(_THIS) |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 { |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 /* Queue it up */ |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
190 waveOutWrite(this->hidden->shm->sound, |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
191 &(this->hidden->shm->wHdr[this->hidden->next_buffer]), |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
192 sizeof (WAVEHDR)); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
193 this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
196 static void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
197 MME_WaitDone(_THIS) |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 { |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 MMRESULT result; |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 int i; |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
202 if (this->hidden->shm->sound) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
203 for (i = 0; i < NUM_BUFFERS; i++) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
204 while (inUse[i]) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
205 mmeWaitForCallbacks(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
206 mmeProcessCallbacks(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
207 } |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
208 result = waveOutReset(this->hidden->shm->sound); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
209 if (result != MMSYSERR_NOERROR) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
210 SetMMerror("waveOutReset()", result); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
211 mmeProcessCallbacks(); |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
215 static void |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
216 MME_CloseDevice(_THIS) |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 { |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
218 if (this->hidden != NULL) { |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
219 MMRESULT result; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
221 if (this->hidden->mixbuf) { |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
222 result = mmeFreeBuffer(this->hidden->mixbuf); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
223 if (result != MMSYSERR_NOERROR) |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
224 SetMMerror("mmeFreeBuffer", result); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
225 this->hidden->mixbuf = NULL; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
226 } |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
228 if (this->hidden->shm) { |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
229 if (this->hidden->shm->sound) { |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
230 result = waveOutClose(this->hidden->shm->sound); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
231 if (result != MMSYSERR_NOERROR) |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
232 SetMMerror("waveOutClose()", result); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
233 mmeProcessCallbacks(); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
234 } |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
235 result = mmeFreeMem(this->hidden->shm); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
236 if (result != MMSYSERR_NOERROR) |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
237 SetMMerror("mmeFreeMem()", result); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
238 this->hidden->shm = NULL; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
239 } |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
240 |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
241 SDL_free(this->hidden); |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
242 this->hidden = NULL; |
654
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 } |
e92bcf2573cb
Added audio and CD-ROM support for OSF/Tru64 (thanks Hayashi!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 |
3827
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
246 static int |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
247 MME_Init(SDL_AudioDriverImpl *impl) |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
248 { |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
249 /* Set the function pointers */ |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
250 impl->OpenDevice = MME_OpenDevice; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
251 impl->WaitDevice = MME_WaitDevice; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
252 impl->WaitDone = MME_WaitDone; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
253 impl->PlayDevice = MME_PlayDevice; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
254 impl->GetDeviceBuf = MME_GetDeviceBuf; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
255 impl->CloseDevice = MME_CloseDevice; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
256 impl->OnlyHasDefaultOutputDevice = 1; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
257 |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
258 return 1; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
259 } |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
260 |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
261 /* !!! FIXME: Windows "windib" driver is called waveout, too */ |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
262 AudioBootStrap MMEAUDIO_bootstrap = { |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
263 "waveout", "Tru64 MME WaveOut", |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
264 MME_Available, MME_Init, 0 |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
265 }; |
1806fd1acba4
Moved mme audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents:
3798
diff
changeset
|
266 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
267 /* vi: set ts=4 sw=4 expandtab: */ |