annotate src/audio/nas/SDL_nasaudio.c @ 3825:76c5a414b996 SDL-ryan-multiple-audio-device

Dynamic loading for NAS audio driver.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 07 Oct 2006 07:25:30 +0000
parents 748707e2ddd1
children 66fb40445587
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: 769
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: 769
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: 769
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: 769
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: 769
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: 769
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: 769
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: 0
diff changeset
20 slouken@libsdl.org
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22 This driver was written by:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
23 Erik Inge Bolsų
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 knan@mo.himolde.no
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
25 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
26 #include "SDL_config.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28 /* Allow access to a raw mixing buffer */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30 #include <signal.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31 #include <unistd.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32
1358
c71e05b4dc2e More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents: 1338
diff changeset
33 #include "SDL_timer.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 #include "SDL_audio.h"
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
35 #include "SDL_loadso.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
36 #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
37 #include "../SDL_audio_c.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
38 #include "SDL_nasaudio.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
39
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
40 /* The tag name used by nas audio */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
41 #define NAS_DRIVER_NAME "nas"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
43 static struct SDL_PrivateAudioData *this2 = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
44
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
45
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
46 static void (*NAS_AuCloseServer)(AuServer *);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
47 static void (*NAS_AuNextEvent)(AuServer *, AuBool, AuEvent *);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
48 static AuBool (*NAS_AuDispatchEvent)(AuServer *, AuEvent *);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
49 static AuFlowID (*NAS_AuCreateFlow)(AuServer *, AuStatus *);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
50 static void (*NAS_AuStartFlow)(AuServer *, AuFlowID, AuStatus *);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
51 static void (*NAS_AuSetElements)
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
52 (AuServer *, AuFlowID, AuBool, int, AuElement *, AuStatus *);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
53 static void (*NAS_AuWriteElement)
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
54 (AuServer *, AuFlowID, int, AuUint32, AuPointer, AuBool, AuStatus *);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
55 static AuServer *(*NAS_AuOpenServer)
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
56 (_AuConst char *, int, _AuConst char *, int, _AuConst char *, char **);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
57 static AuEventHandlerRec *(*NAS_AuRegisterEventHandler)
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
58 (AuServer *, AuMask, int, AuID, AuEventHandlerCallback, AuPointer);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
59
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
60
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
61 #ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
62
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
63 static const char *nas_library = SDL_AUDIO_DRIVER_NAS_DYNAMIC;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
64 static void *nas_handle = NULL;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
65
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
66 static int
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
67 load_nas_sym(const char *fn, void **addr)
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
68 {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
69 *addr = SDL_LoadFunction(nas_handle, fn);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
70 if (*addr == NULL) {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
71 return 0;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
72 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
73 return 1;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
74 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
75
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
76 /* cast funcs to char* first, to please GCC's strict aliasing rules. */
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
77 #define SDL_NAS_SYM(x) \
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
78 if (!load_nas_sym(#x, (void **) (char *) &NAS_##x)) return -1
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
79 #else
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
80 #define SDL_NAS_SYM(x) NAS_##x = x
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
81 #endif
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
82
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
83 static int load_nas_syms(void)
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
84 {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
85 SDL_NAS_SYM(AuCloseServer);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
86 SDL_NAS_SYM(AuNextEvent);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
87 SDL_NAS_SYM(AuDispatchEvent);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
88 SDL_NAS_SYM(AuCreateFlow);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
89 SDL_NAS_SYM(AuStartFlow);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
90 SDL_NAS_SYM(AuSetElements);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
91 SDL_NAS_SYM(AuWriteElement);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
92 SDL_NAS_SYM(AuOpenServer);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
93 SDL_NAS_SYM(AuRegisterEventHandler);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
94 return 0;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
95 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
96 #undef SDL_NAS_SYM
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
97
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
98 #ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
99
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
100 static int library_load_count = 0;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
101
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
102 static void
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
103 UnloadNASLibrary(void)
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
104 {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
105 if ((nas_handle != NULL) && (--library_load_count == 0)) {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
106 SDL_UnloadObject(nas_handle);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
107 nas_handle = NULL;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
108 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
109 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
110
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
111 static int
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
112 LoadNASLibrary(void)
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
113 {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
114 int retval = 0;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
115 if (library_load_count++ == 0) {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
116 nas_handle = SDL_LoadObject(nas_library);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
117 if (nas_handle == NULL) {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
118 /* Copy error string so we can use it in a new SDL_SetError(). */
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
119 char *origerr = SDL_GetError();
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
120 size_t len = SDL_strlen(origerr) + 1;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
121 char *err = (char *) alloca(len);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
122 SDL_strlcpy(err, origerr, len);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
123
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
124 library_load_count--;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
125 retval = -1;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
126 SDL_SetError("NAS: SDL_LoadObject('%s') failed: %s\n",
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
127 nas_library, err);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
128 } else {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
129 retval = load_nas_syms();
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
130 if (retval < 0) {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
131 UnloadNASLibrary();
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
132 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
133 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
134 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
135 return retval;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
136 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
137
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
138 #else
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
139
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
140 static void
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
141 UnloadNASLibrary(void)
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
142 {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
143 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
144
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
145 static int
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
146 LoadNASLibrary(void)
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
147 {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
148 load_nas_syms();
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
149 return 0;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
150 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
151
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
152 #endif /* SDL_AUDIO_DRIVER_NAS_DYNAMIC */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
153
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
154 static int
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
155 NAS_Available(void)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
156 {
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
157 int available = 0;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
158 if (LoadNASLibrary() >= 0) {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
159 AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
160 if (aud != NULL) {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
161 available = 1;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
162 NAS_AuCloseServer(aud);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
163 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
164 UnloadNASLibrary();
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
165 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
166 return available;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
167 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
168
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
169 /* This function waits until it is possible to write a full sound 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
170 static void
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
171 NAS_WaitDevice(_THIS)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
172 {
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 while (this->hidden->buf_free < this->hidden->mixlen) {
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 AuEvent ev;
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
175 NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
176 NAS_AuDispatchEvent(this->hidden->aud, &ev);
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
177 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
178 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
179
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
180 static void
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
181 NAS_PlayDevice(_THIS)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
182 {
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
183 while (this->hidden->mixlen > this->hidden->buf_free) {
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
184 /*
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
185 * We think the buffer is full? Yikes! Ask the server for events,
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
186 * in the hope that some of them is LowWater events telling us more
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
187 * of the buffer is free now than what we think.
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
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: 1402
diff changeset
189 AuEvent ev;
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
190 NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
191 NAS_AuDispatchEvent(this->hidden->aud, &ev);
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
192 }
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
193 this->hidden->buf_free -= this->hidden->mixlen;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
194
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
195 /* Write the audio data */
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
196 NAS_AuWriteElement(this->hidden->aud, this->hidden->flow, 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
197 this->hidden->mixlen, this->hidden->mixbuf, AuFalse, NULL);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
198
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
199 this->hidden->written += this->hidden->mixlen;
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
200
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
201 #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: 1402
diff changeset
202 fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
203 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
204 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
205
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
206 static Uint8 *
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
207 NAS_GetDeviceBuf(_THIS)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
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: 1402
diff changeset
209 return (this->hidden->mixbuf);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
210 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
211
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
212 static void
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
213 NAS_CloseDevice(_THIS)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
214 {
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
215 if (this->hidden != NULL) {
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
216 if (this->hidden->mixbuf != NULL) {
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
217 SDL_FreeAudioMem(this->hidden->mixbuf);
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
218 this->hidden->mixbuf = NULL;
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
219 }
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
220 if (this->hidden->aud) {
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
221 NAS_AuCloseServer(this->hidden->aud);
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
222 this->hidden->aud = 0;
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
223 }
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
224 SDL_free(this->hidden);
3822
748707e2ddd1 Minor NAS tweak.
Ryan C. Gordon <icculus@icculus.org>
parents: 3821
diff changeset
225 this2 = this->hidden = NULL;
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
226 UnloadNASLibrary();
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
227 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
228 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
229
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
230 static unsigned char
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
231 sdlformat_to_auformat(unsigned int fmt)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
232 {
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
233 switch (fmt) {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
234 case AUDIO_U8:
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
235 return AuFormatLinearUnsigned8;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
236 case AUDIO_S8:
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
237 return AuFormatLinearSigned8;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
238 case AUDIO_U16LSB:
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 return AuFormatLinearUnsigned16LSB;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
240 case AUDIO_U16MSB:
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
241 return AuFormatLinearUnsigned16MSB;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
242 case AUDIO_S16LSB:
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
243 return AuFormatLinearSigned16LSB;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
244 case AUDIO_S16MSB:
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
245 return AuFormatLinearSigned16MSB;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
246 }
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
247 return AuNone;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
248 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
249
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
250 static AuBool
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
251 event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
252 {
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
253 switch (ev->type) {
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
254 case AuEventTypeElementNotify:
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
255 {
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
256 AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
257
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
258 switch (event->kind) {
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
259 case AuElementNotifyKindLowWater:
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
260 if (this2->buf_free >= 0) {
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
261 this2->really += event->num_bytes;
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
262 gettimeofday(&this2->last_tv, 0);
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
263 this2->buf_free += event->num_bytes;
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
264 } else {
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
265 this2->buf_free = event->num_bytes;
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
266 }
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 break;
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
268 case AuElementNotifyKindState:
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
269 switch (event->cur_state) {
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
270 case AuStatePause:
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
271 if (event->reason != AuReasonUser) {
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
272 if (this2->buf_free >= 0) {
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
273 this2->really += event->num_bytes;
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
274 gettimeofday(&this2->last_tv, 0);
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
275 this2->buf_free += event->num_bytes;
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
276 } else {
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
277 this2->buf_free = event->num_bytes;
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
278 }
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
279 }
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
280 break;
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
281 }
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
282 }
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
283 }
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
284 }
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
285 return AuTrue;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
286 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
287
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
288 static AuDeviceID
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
289 find_device(_THIS, int nch)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
290 {
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
291 /* These "Au" things are all macros, not functions... */
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
292 int 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
293 for (i = 0; i < AuServerNumDevices(this->hidden->aud); 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
294 if ((AuDeviceKind(AuServerDevice(this->hidden->aud, 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
295 AuComponentKindPhysicalOutput) &&
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
296 AuDeviceNumTracks(AuServerDevice(this->hidden->aud, i)) == nch) {
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
297 return AuDeviceIdentifier(AuServerDevice(this->hidden->aud, 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
298 }
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
299 }
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
300 return AuNone;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
301 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
302
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
303 static int
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
304 NAS_OpenDevice(_THIS, const char *devname, int iscapture)
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: 1402
diff changeset
306 AuElement elms[3];
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
307 int buffer_size;
1982
3b4ce57c6215 First shot at new audio data types (int32 and float32).
Ryan C. Gordon <icculus@icculus.org>
parents: 1895
diff changeset
308 SDL_AudioFormat test_format, 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: 1402
diff changeset
309
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
310 /* Initialize all variables that we clean on shutdown */
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
311 this->hidden = (struct SDL_PrivateAudioData *)
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
312 SDL_malloc((sizeof *this->hidden));
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
313 if (this->hidden == NULL) {
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
314 SDL_OutOfMemory();
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
315 return 0;
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
316 }
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
317 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
318
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
319 if (LoadNASLibrary() < 0) {
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
320 NAS_CloseDevice(this);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
321 return 0;
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
322 }
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
323
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
324 /* 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: 1402
diff changeset
325 format = 0;
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
326 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: 1402
diff changeset
327 !format && 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: 1402
diff changeset
328 format = sdlformat_to_auformat(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: 1402
diff changeset
329 if (format == AuNone) {
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
330 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: 1402
diff changeset
331 }
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
332 }
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
333 if (format == 0) {
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
334 NAS_CloseDevice(this);
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
335 SDL_SetError("NAS: Couldn't find any hardware audio formats");
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
336 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: 1402
diff changeset
337 }
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
338 this->spec.format = test_format;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
339
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
340 this->hidden->aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, 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
341 if (this->hidden->aud == 0) {
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
342 NAS_CloseDevice(this);
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
343 SDL_SetError("NAS: Couldn't open connection to NAS server");
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
344 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: 1402
diff changeset
345 }
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
346
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
347 this->hidden->dev = find_device(this, this->spec.channels);
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
348 if ((this->hidden->dev == AuNone)
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
349 || (!(this->hidden->flow = NAS_AuCreateFlow(this->hidden->aud, 0)))) {
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
350 NAS_CloseDevice(this);
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
351 SDL_SetError("NAS: Couldn't find a fitting device on NAS server");
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
352 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: 1402
diff changeset
353 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
354
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
355 buffer_size = this->spec.freq;
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
356 if (buffer_size < 4096)
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
357 buffer_size = 4096;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
358
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
359 if (buffer_size > 32768)
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
360 buffer_size = 32768; /* So that the buffer won't get unmanageably big. */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
361
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
362 /* Calculate the final parameters for this audio specification */
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
363 SDL_CalculateAudioSpec(&this->spec);
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
364
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
365 this2 = this->hidden;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
366
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
367 AuMakeElementImportClient(elms,this->spec.freq,format,this->spec.channels,
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
368 AuTrue, buffer_size, buffer_size / 4, 0, NULL);
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
369 AuMakeElementExportDevice(elms + 1, 0, this->hidden->dev, this->spec.freq,
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
370 AuUnlimitedSamples, 0, NULL);
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
371 NAS_AuSetElements(this->hidden->aud, this->hidden->flow,
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
372 AuTrue, 2, elms, NULL);
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
373 NAS_AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0,
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
374 this->hidden->flow, event_handler,
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
375 (AuPointer) NULL);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
376
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
377 NAS_AuStartFlow(this->hidden->aud, this->hidden->flow, NULL);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
378
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
379 /* Allocate mixing buffer */
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
380 this->hidden->mixlen = 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
381 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
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
382 if (this->hidden->mixbuf == NULL) {
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
383 NAS_CloseDevice(this);
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
384 SDL_OutOfMemory();
3825
76c5a414b996 Dynamic loading for NAS audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents: 3822
diff changeset
385 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: 1402
diff changeset
386 }
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
387 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
388
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
389 /* We're ready to rock and roll. :-) */
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
390 return 1;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
391 }
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
392
3821
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
393 static int
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
394 NAS_Init(SDL_AudioDriverImpl *impl)
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
395 {
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
396 /* Set the function pointers */
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
397 impl->OpenDevice = NAS_OpenDevice;
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
398 impl->PlayDevice = NAS_PlayDevice;
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
399 impl->WaitDevice = NAS_WaitDevice;
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
400 impl->GetDeviceBuf = NAS_GetDeviceBuf;
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
401 impl->CloseDevice = NAS_CloseDevice;
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
402 impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: is this true? */
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
403
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
404 return 1;
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
405 }
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
406
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
407 AudioBootStrap NAS_bootstrap = {
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
408 NAS_DRIVER_NAME, "Network Audio System",
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
409 NAS_Available, NAS_Init, 0
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
410 };
18393b045759 Moved NAS audio driver to 1.3 API.
Ryan C. Gordon <icculus@icculus.org>
parents: 3809
diff changeset
411
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
412 /* vi: set ts=4 sw=4 expandtab: */