Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
467 lines (402 loc) · 13.4 KB

SDL_nto_audio.c

File metadata and controls

467 lines (402 loc) · 13.4 KB
 
Apr 26, 2001
Apr 26, 2001
1
2
/*
SDL - Simple DirectMedia Layer
Jan 4, 2004
Jan 4, 2004
3
Copyright (C) 1997-2004 Sam Lantinga
Apr 26, 2001
Apr 26, 2001
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
Dec 14, 2001
Dec 14, 2001
20
slouken@libsdl.org
Apr 26, 2001
Apr 26, 2001
21
*/
Feb 21, 2006
Feb 21, 2006
22
#include "SDL_config.h"
Apr 26, 2001
Apr 26, 2001
23
24
25
26
27
28
29
30
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sched.h>
Jun 16, 2002
Jun 16, 2002
31
#include <sys/select.h>
Sep 21, 2003
Sep 21, 2003
32
33
#include <sys/neutrino.h>
#include <sys/asoundlib.h>
Apr 26, 2001
Apr 26, 2001
34
Feb 10, 2006
Feb 10, 2006
35
#include "SDL_timer.h"
Apr 26, 2001
Apr 26, 2001
36
#include "SDL_audio.h"
Feb 16, 2006
Feb 16, 2006
37
38
#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
Apr 26, 2001
Apr 26, 2001
39
40
41
#include "SDL_nto_audio.h"
/* The tag name used by NTO audio */
Sep 21, 2003
Sep 21, 2003
42
#define DRIVER_NAME "qsa-nto"
Apr 26, 2001
Apr 26, 2001
43
44
45
46
/* default channel communication parameters */
#define DEFAULT_CPARAMS_RATE 22050
#define DEFAULT_CPARAMS_VOICES 1
Sep 21, 2003
Sep 21, 2003
47
/* FIXME: need to add in the near future flexible logic with frag_size and frags count */
Jun 16, 2002
Jun 16, 2002
48
#define DEFAULT_CPARAMS_FRAG_SIZE 4096
Apr 26, 2001
Apr 26, 2001
49
#define DEFAULT_CPARAMS_FRAGS_MIN 1
Feb 20, 2002
Feb 20, 2002
50
#define DEFAULT_CPARAMS_FRAGS_MAX 1
Apr 26, 2001
Apr 26, 2001
51
52
/* Open the audio device for playback, and don't block if busy */
Jun 16, 2002
Jun 16, 2002
53
#define OPEN_FLAGS SND_PCM_OPEN_PLAYBACK
Apr 26, 2001
Apr 26, 2001
54
Sep 21, 2003
Sep 21, 2003
55
56
57
58
59
#define QSA_NO_WORKAROUNDS 0x00000000
#define QSA_MMAP_WORKAROUND 0x00000001
struct BuggyCards
{
Jul 10, 2006
Jul 10, 2006
60
61
char *cardname;
unsigned long bugtype;
Sep 21, 2003
Sep 21, 2003
62
63
64
65
};
#define QSA_WA_CARDS 3
Jul 10, 2006
Jul 10, 2006
66
67
68
69
struct BuggyCards buggycards[QSA_WA_CARDS] = {
{"Sound Blaster Live!", QSA_MMAP_WORKAROUND},
{"Vortex 8820", QSA_MMAP_WORKAROUND},
{"Vortex 8830", QSA_MMAP_WORKAROUND},
Sep 21, 2003
Sep 21, 2003
70
71
};
Oct 17, 2006
Oct 17, 2006
72
73
74
75
76
77
78
static inline void
NTO_SetError(const char *fn, int rval)
{
SDL_SetError("NTO: %s failed: %s", fn, snd_strerror(rval));
}
Apr 26, 2001
Apr 26, 2001
79
Sep 21, 2003
Sep 21, 2003
80
/* card names check to apply the workarounds */
Jul 10, 2006
Jul 10, 2006
81
82
static int
NTO_CheckBuggyCards(_THIS, unsigned long checkfor)
Sep 21, 2003
Sep 21, 2003
83
84
85
{
char scardname[33];
int it;
Jul 10, 2006
Jul 10, 2006
86
Oct 17, 2006
Oct 17, 2006
87
if (snd_card_get_name(this->hidden->cardno, scardname, 32) < 0) {
Sep 21, 2003
Sep 21, 2003
88
89
90
return 0;
}
Jul 10, 2006
Jul 10, 2006
91
92
93
94
95
96
for (it = 0; it < QSA_WA_CARDS; it++) {
if (SDL_strcmp(buggycards[it].cardname, scardname) == 0) {
if (buggycards[it].bugtype == checkfor) {
return 1;
}
}
Sep 21, 2003
Sep 21, 2003
97
98
99
100
}
return 0;
}
Apr 26, 2001
Apr 26, 2001
101
Jul 10, 2006
Jul 10, 2006
102
103
static void
NTO_ThreadInit(_THIS)
Apr 26, 2001
Apr 26, 2001
104
{
Jul 10, 2006
Jul 10, 2006
105
struct sched_param param;
Oct 17, 2006
Oct 17, 2006
106
int status = SchedGet(0, 0, &param);
Sep 21, 2003
Sep 21, 2003
107
Jul 10, 2006
Jul 10, 2006
108
109
110
/* increasing default 10 priority to 25 to avoid jerky sound */
param.sched_priority = param.sched_curpriority + 15;
status = SchedSet(0, 0, SCHED_NOCHANGE, &param);
Apr 26, 2001
Apr 26, 2001
111
112
}
Sep 21, 2003
Sep 21, 2003
113
/* PCM transfer channel parameters initialize function */
Jul 10, 2006
Jul 10, 2006
114
115
static void
NTO_InitAudioParams(snd_pcm_channel_params_t * cpars)
Apr 26, 2001
Apr 26, 2001
116
{
Feb 7, 2006
Feb 7, 2006
117
SDL_memset(cpars, 0, sizeof(snd_pcm_channel_params_t));
Sep 21, 2003
Sep 21, 2003
118
119
120
121
cpars->channel = SND_PCM_CHANNEL_PLAYBACK;
cpars->mode = SND_PCM_MODE_BLOCK;
cpars->start_mode = SND_PCM_START_DATA;
Jul 10, 2006
Jul 10, 2006
122
cpars->stop_mode = SND_PCM_STOP_STOP;
Sep 21, 2003
Sep 21, 2003
123
124
125
126
127
128
129
cpars->format.format = SND_PCM_SFMT_S16_LE;
cpars->format.interleave = 1;
cpars->format.rate = DEFAULT_CPARAMS_RATE;
cpars->format.voices = DEFAULT_CPARAMS_VOICES;
cpars->buf.block.frag_size = DEFAULT_CPARAMS_FRAG_SIZE;
cpars->buf.block.frags_min = DEFAULT_CPARAMS_FRAGS_MIN;
cpars->buf.block.frags_max = DEFAULT_CPARAMS_FRAGS_MAX;
Apr 26, 2001
Apr 26, 2001
130
131
132
133
}
/* This function waits until it is possible to write a full sound buffer */
Jul 10, 2006
Jul 10, 2006
134
static void
Oct 17, 2006
Oct 17, 2006
135
NTO_WaitDevice(_THIS)
Apr 26, 2001
Apr 26, 2001
136
{
Sep 21, 2003
Sep 21, 2003
137
138
139
140
fd_set wfds;
int selectret;
FD_ZERO(&wfds);
Oct 17, 2006
Oct 17, 2006
141
FD_SET(this->hidden->audio_fd, &wfds);
Sep 21, 2003
Sep 21, 2003
142
143
do {
Oct 28, 2006
Oct 28, 2006
144
145
selectret =
select(this->hidden->audio_fd + 1, NULL, &wfds, NULL, NULL);
Jul 10, 2006
Jul 10, 2006
146
147
148
switch (selectret) {
case -1:
case 0:
Oct 17, 2006
Oct 17, 2006
149
SDL_SetError("NTO: select() failed: %s\n", strerror(errno));
Jul 10, 2006
Jul 10, 2006
150
151
return;
default:
Oct 17, 2006
Oct 17, 2006
152
if (FD_ISSET(this->hidden->audio_fd, &wfds)) {
Jul 10, 2006
Jul 10, 2006
153
154
155
return;
}
break;
Sep 21, 2003
Sep 21, 2003
156
}
Jul 10, 2006
Jul 10, 2006
157
158
}
while (1);
Apr 26, 2001
Apr 26, 2001
159
160
}
Jul 10, 2006
Jul 10, 2006
161
static void
Oct 17, 2006
Oct 17, 2006
162
NTO_PlayDevice(_THIS)
Apr 26, 2001
Apr 26, 2001
163
{
Oct 17, 2006
Oct 17, 2006
164
snd_pcm_channel_status_t cstatus;
Sep 21, 2003
Sep 21, 2003
165
166
int written, rval;
int towrite;
Jul 10, 2006
Jul 10, 2006
167
void *pcmbuffer;
Sep 21, 2003
Sep 21, 2003
168
Oct 17, 2006
Oct 17, 2006
169
if ((!this->enabled) || (!this->hidden)) {
Sep 21, 2003
Sep 21, 2003
170
171
return;
}
Jul 10, 2006
Jul 10, 2006
172
Sep 21, 2003
Sep 21, 2003
173
towrite = this->spec.size;
Oct 17, 2006
Oct 17, 2006
174
pcmbuffer = this->hidden->pcm_buf;
Sep 21, 2003
Sep 21, 2003
175
176
177
/* Write the audio data, checking for EAGAIN (buffer full) and underrun */
do {
Oct 17, 2006
Oct 17, 2006
178
179
written = snd_pcm_plugin_write(this->hidden->audio_handle,
pcmbuffer, towrite);
Jul 10, 2006
Jul 10, 2006
180
181
if (written != towrite) {
if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
Sep 21, 2003
Sep 21, 2003
182
183
184
185
186
187
/* Let a little CPU time go by and try to write again */
SDL_Delay(1);
/* if we wrote some data */
towrite -= written;
pcmbuffer += written * this->spec.channels;
continue;
Oct 17, 2006
Oct 17, 2006
188
} else if ((errno == EINVAL) || (errno == EIO)) {
Oct 28, 2006
Oct 28, 2006
189
SDL_memset(&cstatus, 0, sizeof(cstatus));
Oct 17, 2006
Oct 17, 2006
190
191
192
193
194
195
196
197
cstatus.channel = SND_PCM_CHANNEL_PLAYBACK;
rval = snd_pcm_plugin_status(this->hidden->audio_handle,
&cstatus);
if (rval < 0) {
NTO_SetError("snd_pcm_plugin_status", rval);
return;
}
Oct 28, 2006
Oct 28, 2006
198
199
if ((cstatus.status == SND_PCM_STATUS_UNDERRUN) ||
(cstatus.status == SND_PCM_STATUS_READY)) {
Oct 17, 2006
Oct 17, 2006
200
rval = snd_pcm_plugin_prepare(this->hidden->audio_handle,
Oct 28, 2006
Oct 28, 2006
201
SND_PCM_CHANNEL_PLAYBACK);
Oct 17, 2006
Oct 17, 2006
202
203
if (rval < 0) {
NTO_SetError("snd_pcm_plugin_prepare", rval);
Sep 21, 2003
Sep 21, 2003
204
return;
Jul 10, 2006
Jul 10, 2006
205
}
Sep 21, 2003
Sep 21, 2003
206
}
Oct 17, 2006
Oct 17, 2006
207
208
209
continue;
} else {
return;
Sep 21, 2003
Sep 21, 2003
210
}
Jul 10, 2006
Jul 10, 2006
211
} else {
Sep 21, 2003
Sep 21, 2003
212
213
214
215
/* we wrote all remaining data */
towrite -= written;
pcmbuffer += written * this->spec.channels;
}
Jul 10, 2006
Jul 10, 2006
216
217
}
while ((towrite > 0) && (this->enabled));
Sep 21, 2003
Sep 21, 2003
218
219
/* If we couldn't write, assume fatal error for now */
Jul 10, 2006
Jul 10, 2006
220
if (towrite != 0) {
Sep 21, 2003
Sep 21, 2003
221
222
this->enabled = 0;
}
Apr 26, 2001
Apr 26, 2001
223
224
}
Jul 10, 2006
Jul 10, 2006
225
static Uint8 *
Oct 17, 2006
Oct 17, 2006
226
NTO_GetDeviceBuf(_THIS)
Apr 26, 2001
Apr 26, 2001
227
{
Oct 17, 2006
Oct 17, 2006
228
return this->hidden->pcm_buf;
Apr 26, 2001
Apr 26, 2001
229
230
}
Jul 10, 2006
Jul 10, 2006
231
static void
Oct 17, 2006
Oct 17, 2006
232
NTO_CloseDevice(_THIS)
Apr 26, 2001
Apr 26, 2001
233
{
Oct 17, 2006
Oct 17, 2006
234
235
236
237
238
239
if (this->hidden != NULL) {
if (this->hidden->audio_handle != NULL) {
snd_pcm_plugin_flush(this->hidden->audio_handle,
SND_PCM_CHANNEL_PLAYBACK);
snd_pcm_close(this->hidden->audio_handle);
this->hidden->audio_handle = NULL;
Sep 21, 2003
Sep 21, 2003
240
}
Oct 17, 2006
Oct 17, 2006
241
242
243
if (this->hidden->pcm_buf != NULL) {
SDL_FreeAudioMem(this->hidden->pcm_buf);
this->hidden->pcm_buf = NULL;
Sep 21, 2003
Sep 21, 2003
244
}
Oct 17, 2006
Oct 17, 2006
245
246
SDL_free(this->hidden);
this->hidden = NULL;
Sep 21, 2003
Sep 21, 2003
247
}
Apr 26, 2001
Apr 26, 2001
248
249
}
Jul 10, 2006
Jul 10, 2006
250
static int
Oct 17, 2006
Oct 17, 2006
251
NTO_OpenDevice(_THIS, const char *devname, int iscapture)
Apr 26, 2001
Apr 26, 2001
252
{
Oct 17, 2006
Oct 17, 2006
253
254
255
256
257
258
int rval = 0;
int format = 0;
SDL_AudioFormat test_format = 0;
int found = 0;
snd_pcm_channel_setup_t csetup;
snd_pcm_channel_params_t cparams;
Sep 21, 2003
Sep 21, 2003
259
Oct 17, 2006
Oct 17, 2006
260
261
/* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *)
Oct 28, 2006
Oct 28, 2006
262
SDL_malloc((sizeof *this->hidden));
Oct 17, 2006
Oct 17, 2006
263
264
265
if (this->hidden == NULL) {
SDL_OutOfMemory();
return 0;
Sep 21, 2003
Sep 21, 2003
266
}
Oct 17, 2006
Oct 17, 2006
267
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
Sep 21, 2003
Sep 21, 2003
268
269
270
271
272
/* initialize channel transfer parameters to default */
NTO_InitAudioParams(&cparams);
/* Open the audio device */
Oct 17, 2006
Oct 17, 2006
273
274
275
276
rval = snd_pcm_open_preferred(&this->hidden->audio_handle,
&this->hidden->cardno,
&this->hidden->deviceno, OPEN_FLAGS);
Jul 10, 2006
Jul 10, 2006
277
if (rval < 0) {
Oct 17, 2006
Oct 17, 2006
278
279
280
NTO_CloseDevice(this);
NTO_SetError("snd_pcm_open", rval);
return 0;
Sep 21, 2003
Sep 21, 2003
281
282
}
Jul 10, 2006
Jul 10, 2006
283
if (!NTO_CheckBuggyCards(this, QSA_MMAP_WORKAROUND)) {
Sep 21, 2003
Sep 21, 2003
284
/* enable count status parameter */
Oct 17, 2006
Oct 17, 2006
285
286
287
288
289
290
rval = snd_pcm_plugin_set_disable(this->hidden->audio_handle,
PLUGIN_DISABLE_MMAP);
if (rval < 0) {
NTO_CloseDevice(this);
NTO_SetError("snd_pcm_plugin_set_disable", rval);
return 0;
Sep 21, 2003
Sep 21, 2003
291
292
293
294
295
296
297
298
}
}
/* Try for a closest match on audio format */
format = 0;
/* can't use format as SND_PCM_SFMT_U8 = 0 in nto */
found = 0;
Oct 17, 2006
Oct 17, 2006
299
for (test_format = SDL_FirstAudioFormat(this->spec.format); !found;) {
Sep 21, 2003
Sep 21, 2003
300
/* if match found set format to equivalent ALSA format */
Jul 10, 2006
Jul 10, 2006
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
switch (test_format) {
case AUDIO_U8:
format = SND_PCM_SFMT_U8;
found = 1;
break;
case AUDIO_S8:
format = SND_PCM_SFMT_S8;
found = 1;
break;
case AUDIO_S16LSB:
format = SND_PCM_SFMT_S16_LE;
found = 1;
break;
case AUDIO_S16MSB:
format = SND_PCM_SFMT_S16_BE;
found = 1;
break;
case AUDIO_U16LSB:
format = SND_PCM_SFMT_U16_LE;
found = 1;
break;
case AUDIO_U16MSB:
format = SND_PCM_SFMT_U16_BE;
found = 1;
break;
Sep 1, 2006
Sep 1, 2006
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
case AUDIO_S32LSB:
format = SND_PCM_SFMT_S32_LE;
found = 1;
break;
case AUDIO_S32MSB:
format = SND_PCM_SFMT_S32_BE;
found = 1;
break;
case AUDIO_F32LSB:
format = SND_PCM_SFMT_FLOAT_LE;
found = 1;
break;
case AUDIO_F32MSB:
format = SND_PCM_SFMT_FLOAT_BE;
found = 1;
break;
Jul 10, 2006
Jul 10, 2006
342
343
default:
break;
Sep 21, 2003
Sep 21, 2003
344
345
}
Jul 10, 2006
Jul 10, 2006
346
if (!found) {
Sep 21, 2003
Sep 21, 2003
347
348
349
350
351
test_format = SDL_NextAudioFormat();
}
}
/* assumes test_format not 0 on success */
Jul 10, 2006
Jul 10, 2006
352
if (test_format == 0) {
Oct 17, 2006
Oct 17, 2006
353
354
355
NTO_CloseDevice(this);
SDL_SetError("NTO: Couldn't find any hardware audio formats");
return 0;
Sep 21, 2003
Sep 21, 2003
356
357
}
Oct 17, 2006
Oct 17, 2006
358
this->spec.format = test_format;
Sep 21, 2003
Sep 21, 2003
359
360
361
362
363
/* Set the audio format */
cparams.format.format = format;
/* Set mono or stereo audio (currently only two channels supported) */
Oct 17, 2006
Oct 17, 2006
364
cparams.format.voices = this->spec.channels;
Jul 10, 2006
Jul 10, 2006
365
Sep 21, 2003
Sep 21, 2003
366
/* Set rate */
Oct 17, 2006
Oct 17, 2006
367
cparams.format.rate = this->spec.freq;
Sep 21, 2003
Sep 21, 2003
368
369
/* Setup the transfer parameters according to cparams */
Oct 17, 2006
Oct 17, 2006
370
rval = snd_pcm_plugin_params(this->hidden->audio_handle, &cparams);
Jul 10, 2006
Jul 10, 2006
371
if (rval < 0) {
Oct 17, 2006
Oct 17, 2006
372
373
374
NTO_CloseDevice(this);
NTO_SetError("snd_pcm_channel_params", rval);
return 0;
Sep 21, 2003
Sep 21, 2003
375
376
377
}
/* Make sure channel is setup right one last time */
Oct 28, 2006
Oct 28, 2006
378
SDL_memset(&csetup, '\0', sizeof(csetup));
Sep 21, 2003
Sep 21, 2003
379
csetup.channel = SND_PCM_CHANNEL_PLAYBACK;
Oct 17, 2006
Oct 17, 2006
380
381
382
383
if (snd_pcm_plugin_setup(this->hidden->audio_handle, &csetup) < 0) {
NTO_CloseDevice(this);
SDL_SetError("NTO: Unable to setup playback channel\n");
return 0;
Sep 21, 2003
Sep 21, 2003
384
385
386
}
/* Calculate the final parameters for this audio specification */
Oct 17, 2006
Oct 17, 2006
387
SDL_CalculateAudioSpec(&this->spec);
Sep 21, 2003
Sep 21, 2003
388
Oct 17, 2006
Oct 17, 2006
389
this->hidden->pcm_len = this->spec.size;
Sep 21, 2003
Sep 21, 2003
390
Oct 17, 2006
Oct 17, 2006
391
392
393
if (this->hidden->pcm_len == 0) {
this->hidden->pcm_len =
csetup.buf.block.frag_size * this->spec.channels *
Jul 10, 2006
Jul 10, 2006
394
(snd_pcm_format_width(format) / 8);
Sep 21, 2003
Sep 21, 2003
395
396
}
Oct 17, 2006
Oct 17, 2006
397
398
399
400
/*
* Allocate memory to the audio buffer and initialize with silence
* (Note that buffer size must be a multiple of fragment size, so find
* closest multiple)
Jul 10, 2006
Jul 10, 2006
401
*/
Oct 28, 2006
Oct 28, 2006
402
403
this->hidden->pcm_buf =
(Uint8 *) SDL_AllocAudioMem(this->hidden->pcm_len);
Oct 17, 2006
Oct 17, 2006
404
405
406
407
if (this->hidden->pcm_buf == NULL) {
NTO_CloseDevice(this);
SDL_OutOfMemory();
return 0;
Sep 21, 2003
Sep 21, 2003
408
}
Oct 28, 2006
Oct 28, 2006
409
410
SDL_memset(this->hidden->pcm_buf, this->spec.silence,
this->hidden->pcm_len);
Sep 21, 2003
Sep 21, 2003
411
412
/* get the file descriptor */
Oct 28, 2006
Oct 28, 2006
413
414
415
this->hidden->audio_fd =
snd_pcm_file_descriptor(this->hidden->audio_handle,
SND_PCM_CHANNEL_PLAYBACK);
Oct 17, 2006
Oct 17, 2006
416
417
418
419
if (this->hidden->audio_fd < 0) {
NTO_CloseDevice(this);
NTO_SetError("snd_pcm_file_descriptor", rval);
return 0;
Sep 21, 2003
Sep 21, 2003
420
421
422
}
/* Trigger audio playback */
Oct 17, 2006
Oct 17, 2006
423
424
rval = snd_pcm_plugin_prepare(this->hidden->audio_handle,
SND_PCM_CHANNEL_PLAYBACK);
Jul 10, 2006
Jul 10, 2006
425
if (rval < 0) {
Oct 17, 2006
Oct 17, 2006
426
427
428
NTO_CloseDevice(this);
NTO_SetError("snd_pcm_plugin_prepare", rval);
return 0;
Sep 21, 2003
Sep 21, 2003
429
430
}
Oct 17, 2006
Oct 17, 2006
431
432
433
/* We're really ready to rock and roll. :-) */
return 1;
}
Sep 21, 2003
Sep 21, 2003
434
435
Oct 17, 2006
Oct 17, 2006
436
static int
Oct 28, 2006
Oct 28, 2006
437
NTO_Init(SDL_AudioDriverImpl * impl)
Oct 17, 2006
Oct 17, 2006
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
{
/* See if we can open a nonblocking channel. */
snd_pcm_t *handle = NULL;
int rval = snd_pcm_open_preferred(&handle, NULL, NULL, OPEN_FLAGS);
if (rval < 0) {
SDL_SetError("NTO: couldn't open preferred audio device");
return 0;
}
if ((rval = snd_pcm_close(handle)) < 0) {
SDL_SetError("NTO: couldn't close test audio device");
return 0;
}
/* Set the function pointers */
impl->OpenDevice = NTO_OpenDevice;
impl->ThreadInit = NTO_ThreadInit;
impl->WaitDevice = NTO_WaitDevice;
impl->PlayDevice = NTO_PlayDevice;
impl->GetDeviceBuf = NTO_GetDeviceBuf;
impl->CloseDevice = NTO_CloseDevice;
Oct 28, 2006
Oct 28, 2006
458
impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */
Oct 17, 2006
Oct 17, 2006
459
460
return 1;
Apr 26, 2001
Apr 26, 2001
461
}
Jul 10, 2006
Jul 10, 2006
462
Oct 17, 2006
Oct 17, 2006
463
464
465
466
AudioBootStrap QNXNTOAUDIO_bootstrap = {
DRIVER_NAME, "QNX6 QSA-NTO Audio", NTO_Init, 0
};
Jul 10, 2006
Jul 10, 2006
467
/* vi: set ts=4 sw=4 expandtab: */