annotate src/audio/dsp/SDL_dspaudio.c @ 3820:1f156fd874fa SDL-ryan-multiple-audio-device

Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and some other tweaks in already-converted drivers.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 07 Oct 2006 05:36:36 +0000
parents 103bbe13f5eb
children 5b483ce86357
rev   line source
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 /*
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1281
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1281
diff changeset
6 modify it under the terms of the GNU Lesser General Public
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1281
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1281
diff changeset
13 Lesser General Public License for more details.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1281
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1281
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1281
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19 Sam Lantinga
252
e8157fcb3114 Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents: 248
diff changeset
20 slouken@libsdl.org
968
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
21
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
22 Modified in Oct 2004 by Hannu Savolainen
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
23 hannu@opensound.com
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
25 #include "SDL_config.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27 /* Allow access to a raw mixing buffer */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
29 #include <stdio.h> /* For perror() */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
30 #include <string.h> /* For strerror() */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31 #include <errno.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32 #include <unistd.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 #include <fcntl.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 #include <signal.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 #include <sys/time.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
36 #include <sys/ioctl.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
37 #include <sys/stat.h>
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
38
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
39 #if SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
94
ae6e6b73333f Cleaned up the OpenBSD port, thanks to Peter Valchev
Sam Lantinga <slouken@lokigames.com>
parents: 93
diff changeset
40 /* This is installed on some systems */
ae6e6b73333f Cleaned up the OpenBSD port, thanks to Peter Valchev
Sam Lantinga <slouken@lokigames.com>
parents: 93
diff changeset
41 #include <soundcard.h>
ae6e6b73333f Cleaned up the OpenBSD port, thanks to Peter Valchev
Sam Lantinga <slouken@lokigames.com>
parents: 93
diff changeset
42 #else
ae6e6b73333f Cleaned up the OpenBSD port, thanks to Peter Valchev
Sam Lantinga <slouken@lokigames.com>
parents: 93
diff changeset
43 /* This is recommended by OSS */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
44 #include <sys/soundcard.h>
94
ae6e6b73333f Cleaned up the OpenBSD port, thanks to Peter Valchev
Sam Lantinga <slouken@lokigames.com>
parents: 93
diff changeset
45 #endif
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
46
1358
c71e05b4dc2e More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents: 1341
diff changeset
47 #include "SDL_timer.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
48 #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
49 #include "../SDL_audiomem.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
50 #include "../SDL_audio_c.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
51 #include "../SDL_audiodev_c.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
52 #include "SDL_dspaudio.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
53
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
54 /* The tag name used by DSP audio */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
55 #define DSP_DRIVER_NAME "dsp"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
56
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
57 /* Open the audio device for playback, and don't block if busy */
3810
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
58 #define OPEN_FLAGS_OUTPUT (O_WRONLY|O_NONBLOCK)
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
59 #define OPEN_FLAGS_INPUT (O_RDONLY|O_NONBLOCK)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
60
3810
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
61 static char **outputDevices = NULL;
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
62 static int outputDeviceCount = 0;
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
63 static char **inputDevices = NULL;
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
64 static int inputDeviceCount = 0;
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
65
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
66 static inline void
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
67 free_device_list(char ***devs, int *count)
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
68 {
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
69 SDL_FreeUnixAudioDevices(devs, count);
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
70 }
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
71
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
72 static inline void
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
73 build_device_list(int iscapture, char ***devs, int *count)
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
74 {
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
75 const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
76 free_device_list(devs, count);
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
77 SDL_EnumUnixAudioDevices(flags, 0, NULL, devs, count);
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
78 }
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
79
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
80 static inline void
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
81 build_device_lists(void)
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
82 {
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
83 build_device_list(0, &outputDevices, &outputDeviceCount);
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
84 build_device_list(1, &inputDevices, &inputDeviceCount);
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
85 }
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
86
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
87
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
88 static inline void
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
89 free_device_lists(void)
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
90 {
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
91 free_device_list(&outputDevices, &outputDeviceCount);
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
92 free_device_list(&inputDevices, &inputDeviceCount);
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
93 }
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
94
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
95
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
96 static int
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
97 DSP_Available(void)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
98 {
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
99 int available = 0;
3810
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
100 build_device_lists();
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
101 available = ((outputDeviceCount > 0) || (inputDeviceCount > 0));
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
102 free_device_lists();
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
103 return available;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
104 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
105
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
106
3820
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3817
diff changeset
107 static void
1f156fd874fa Moved more audio drivers to 1.3 API (all 5 MiNT backends, BSD, IRIX...), and
Ryan C. Gordon <icculus@icculus.org>
parents: 3817
diff changeset
108 DSP_Deinitialize(void)
3810
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
109 {
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
110 free_device_lists();
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
111 }
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
112
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
113
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
114 static int
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
115 DSP_DetectDevices(int iscapture)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
116 {
3810
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
117 if (iscapture) {
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
118 build_device_list(1, &inputDevices, &inputDeviceCount);
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
119 return inputDeviceCount;
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
120 } else {
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
121 build_device_list(0, &outputDevices, &outputDeviceCount);
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
122 return outputDeviceCount;
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
123 }
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
124
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
125 return 0; /* shouldn't ever hit this. */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
126 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
127
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
128 static const char *
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
129 DSP_GetDeviceName(int index, int iscapture)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
130 {
3810
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
131 if ((iscapture) && (index < inputDeviceCount)) {
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
132 return inputDevices[index];
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
133 } else if ((!iscapture) && (index < outputDeviceCount)) {
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
134 return outputDevices[index];
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
135 }
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
136
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
137 SDL_SetError("No such device");
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
138 return NULL;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
139 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
140
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
141
3817
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
142 static void
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
143 DSP_CloseDevice(_THIS)
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
144 {
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
145 if (this->hidden != NULL) {
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
146 if (this->hidden->mixbuf != NULL) {
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
147 SDL_FreeAudioMem(this->hidden->mixbuf);
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
148 this->hidden->mixbuf = NULL;
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
149 }
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
150 if (this->hidden->audio_fd >= 0) {
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
151 close(this->hidden->audio_fd);
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
152 this->hidden->audio_fd = -1;
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
153 }
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
154 SDL_free(this->hidden);
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
155 this->hidden = NULL;
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
156 }
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
157 }
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
158
103bbe13f5eb Patched to compile.
Ryan C. Gordon <icculus@icculus.org>
parents: 3816
diff changeset
159
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
160 static int
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
161 DSP_OpenDevice(_THIS, const char *devname, int iscapture)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
162 {
3810
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
163 const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
164 int format;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
165 int value;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
166 int frag_spec;
1982
3b4ce57c6215 First shot at new audio data types (int32 and float32).
Ryan C. Gordon <icculus@icculus.org>
parents: 1895
diff changeset
167 SDL_AudioFormat test_format;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
168
3810
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
169 /* We don't care what the devname is...we'll try to open anything. */
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
170 /* ...but default to first name in the list... */
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
171 if (devname == NULL) {
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
172 if ( ((iscapture) && (inputDeviceCount == 0)) ||
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
173 ((!iscapture) && (outputDeviceCount == 0)) ) {
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
174 SDL_SetError("No such audio device");
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
175 return 0;
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
176 }
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
177 devname = ((iscapture) ? inputDevices[0] : outputDevices[0]);
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
178 }
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
179
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
180 /* Initialize all variables that we clean on shutdown */
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
181 this->hidden = (struct SDL_PrivateAudioData *)
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
182 SDL_malloc((sizeof *this->hidden));
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
183 if (this->hidden == NULL) {
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
184 SDL_OutOfMemory();
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
185 return 0;
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
186 }
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
187 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
188
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
189 /* Open the audio device */
3810
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
190 this->hidden->audio_fd = open(devname, flags, 0);
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
191 if (this->hidden->audio_fd < 0) {
3810
2c5387c0a642 Multiple audio device code is now working for dsp and dma targets.
Ryan C. Gordon <icculus@icculus.org>
parents: 3798
diff changeset
192 SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
193 return 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: 1612
diff changeset
194 }
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
195 this->hidden->mixbuf = NULL;
968
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
196
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
197 /* Make the file descriptor use blocking writes with fcntl() */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
198 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
199 long flags;
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
200 flags = fcntl(this->hidden->audio_fd, F_GETFL);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
201 flags &= ~O_NONBLOCK;
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
202 if (fcntl(this->hidden->audio_fd, F_SETFL, flags) < 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: 1612
diff changeset
203 SDL_SetError("Couldn't set audio blocking mode");
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
204 DSP_CloseDevice(this);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
205 return 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: 1612
diff changeset
206 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
207 }
968
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
208
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
209 /* Get a list of supported hardware formats */
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
210 if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETFMTS, &value) < 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: 1612
diff changeset
211 perror("SNDCTL_DSP_GETFMTS");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
212 SDL_SetError("Couldn't get audio format list");
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
213 DSP_CloseDevice(this);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
214 return 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: 1612
diff changeset
215 }
968
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
216
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
217 /* Try for a closest match on audio format */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
218 format = 0;
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
219 for (test_format = SDL_FirstAudioFormat(this->spec.format);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
220 !format && test_format;) {
968
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
221 #ifdef DEBUG_AUDIO
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
222 fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
968
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
223 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
224 switch (test_format) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
225 case AUDIO_U8:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
226 if (value & AFMT_U8) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
227 format = AFMT_U8;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
228 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
229 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
230 case AUDIO_S16LSB:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
231 if (value & AFMT_S16_LE) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
232 format = AFMT_S16_LE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
233 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
234 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
235 case AUDIO_S16MSB:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
236 if (value & AFMT_S16_BE) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
237 format = AFMT_S16_BE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
238 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
239 break;
968
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
240 #if 0
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
241 /*
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
242 * These formats are not used by any real life systems so they are not
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
243 * needed here.
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
244 */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
245 case AUDIO_S8:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
246 if (value & AFMT_S8) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
247 format = AFMT_S8;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
248 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
249 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
250 case AUDIO_U16LSB:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
251 if (value & AFMT_U16_LE) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
252 format = AFMT_U16_LE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
253 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
254 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
255 case AUDIO_U16MSB:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
256 if (value & AFMT_U16_BE) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
257 format = AFMT_U16_BE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
258 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
259 break;
968
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
260 #endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
261 default:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
262 format = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
263 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
264 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
265 if (!format) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
266 test_format = SDL_NextAudioFormat();
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
267 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
268 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
269 if (format == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
270 SDL_SetError("Couldn't find any hardware audio formats");
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
271 DSP_CloseDevice(this);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
272 return 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: 1612
diff changeset
273 }
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
274 this->spec.format = test_format;
968
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
275
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
276 /* Set the audio format */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
277 value = format;
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
278 if ( (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) ||
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
279 (value != format) ) {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
280 perror("SNDCTL_DSP_SETFMT");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
281 SDL_SetError("Couldn't set audio format");
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
282 DSP_CloseDevice(this);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
283 return 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: 1612
diff changeset
284 }
968
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
285
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
286 /* Set the number of channels of output */
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
287 value = this->spec.channels;
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
288 if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_CHANNELS, &value) < 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: 1612
diff changeset
289 perror("SNDCTL_DSP_CHANNELS");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
290 SDL_SetError("Cannot set the number of channels");
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
291 DSP_CloseDevice(this);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
292 return 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: 1612
diff changeset
293 }
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
294 this->spec.channels = value;
968
4675910b0b7b Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
Sam Lantinga <slouken@libsdl.org>
parents: 960
diff changeset
295
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
296 /* Set the DSP frequency */
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
297 value = this->spec.freq;
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
298 if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SPEED, &value) < 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: 1612
diff changeset
299 perror("SNDCTL_DSP_SPEED");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
300 SDL_SetError("Couldn't set audio frequency");
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
301 DSP_CloseDevice(this);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
302 return 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: 1612
diff changeset
303 }
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
304 this->spec.freq = value;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
305
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
306 /* Calculate the final parameters for this audio specification */
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
307 SDL_CalculateAudioSpec(&this->spec);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
308
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
309 /* Determine the power of two of the fragment size */
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
310 for (frag_spec = 0; (0x01U << frag_spec) < this->spec.size; ++frag_spec);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
311 if ((0x01U << frag_spec) != 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: 1612
diff changeset
312 SDL_SetError("Fragment size must be a power of two");
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
313 DSP_CloseDevice(this);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
314 return 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: 1612
diff changeset
315 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
316 frag_spec |= 0x00020000; /* two fragments, for low latency */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
317
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
318 /* Set the audio buffering parameters */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
319 #ifdef DEBUG_AUDIO
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
320 fprintf(stderr, "Requesting %d fragments of size %d\n",
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
321 (frag_spec >> 16), 1 << (frag_spec & 0xFFFF));
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
322 #endif
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
323 if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 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: 1612
diff changeset
324 perror("SNDCTL_DSP_SETFRAGMENT");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
325 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
326 #ifdef DEBUG_AUDIO
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
327 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
328 audio_buf_info info;
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
329 ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETOSPACE, &info);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
330 fprintf(stderr, "fragments = %d\n", info.fragments);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
331 fprintf(stderr, "fragstotal = %d\n", info.fragstotal);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
332 fprintf(stderr, "fragsize = %d\n", info.fragsize);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
333 fprintf(stderr, "bytes = %d\n", info.bytes);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
334 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
335 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
336
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
337 /* Allocate mixing buffer */
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
338 this->hidden->mixlen = this->spec.size;
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
339 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
340 if (this->hidden->mixbuf == NULL) {
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
341 DSP_CloseDevice(this);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
342 return 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: 1612
diff changeset
343 }
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
344 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
345
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
346 /* We're ready to rock and roll. :-) */
3795
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
347 return 1;
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
348 }
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
349
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
350
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
351 static void
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
352 DSP_PlayDevice(_THIS)
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
353 {
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
354 const Uint8 *mixbuf = this->hidden->mixbuf;
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
355 const int mixlen = this->hidden->mixlen;
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
356 if (write(this->hidden->audio_fd, mixbuf, mixlen) == -1) {
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
357 perror("Audio write");
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
358 this->enabled = 0;
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
359 }
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
360 #ifdef DEBUG_AUDIO
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
361 fprintf(stderr, "Wrote %d bytes of audio data\n", mixlen);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
362 #endif
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
363 }
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
364
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
365 static Uint8 *
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
366 DSP_GetDeviceBuf(_THIS)
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
367 {
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
368 return (this->hidden->mixbuf);
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
369 }
589bc3d060cd More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents: 1982
diff changeset
370
3816
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
371 static int
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
372 DSP_Init(SDL_AudioDriverImpl *impl)
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
373 {
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
374 /* Set the function pointers */
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
375 impl->DetectDevices = DSP_DetectDevices;
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
376 impl->GetDeviceName = DSP_GetDeviceName;
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
377 impl->OpenDevice = DSP_OpenDevice;
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
378 impl->PlayDevice = DSP_PlayDevice;
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
379 impl->GetDeviceBuf = DSP_GetDeviceBuf;
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
380 impl->CloseDevice = DSP_CloseDevice;
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
381 impl->Deinitialize = DSP_Deinitialize;
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
382
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
383 build_device_lists();
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
384 return 1;
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
385 }
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
386
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
387
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
388 AudioBootStrap DSP_bootstrap = {
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
389 DSP_DRIVER_NAME, "OSS /dev/dsp standard audio",
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
390 DSP_Available, DSP_Init, 0
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
391 };
9d070c1a45fa Moved AudioBootstrap section in converted drivers to bottom of source, so I
Ryan C. Gordon <icculus@icculus.org>
parents: 3810
diff changeset
392
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1612
diff changeset
393 /* vi: set ts=4 sw=4 expandtab: */