src/audio/dsp/SDL_dspaudio.c
author Sam Lantinga <slouken@libsdl.org>
Thu, 06 Dec 2001 01:20:22 +0000
changeset 248 8e47ebb7bced
parent 97 c7bcdece4845
child 252 e8157fcb3114
permissions -rw-r--r--
Reset the device before closing it - fixes a hang with some audio drivers
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@0
     3
    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@0
     6
    modify it under the terms of the GNU Library General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@0
     8
    version 2 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@0
    13
    Library General Public License for more details.
slouken@0
    14
slouken@0
    15
    You should have received a copy of the GNU Library General Public
slouken@0
    16
    License along with this library; if not, write to the Free
slouken@0
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@0
    20
    slouken@devolution.com
slouken@0
    21
*/
slouken@0
    22
slouken@0
    23
#ifdef SAVE_RCSID
slouken@0
    24
static char rcsid =
slouken@0
    25
 "@(#) $Id$";
slouken@0
    26
#endif
slouken@0
    27
slouken@0
    28
/* Allow access to a raw mixing buffer */
slouken@0
    29
slouken@0
    30
#include <stdlib.h>
slouken@0
    31
#include <stdio.h>
slouken@0
    32
#include <string.h>
slouken@0
    33
#include <errno.h>
slouken@0
    34
#include <unistd.h>
slouken@0
    35
#include <fcntl.h>
slouken@0
    36
#include <signal.h>
slouken@0
    37
#include <sys/time.h>
slouken@0
    38
#include <sys/ioctl.h>
slouken@0
    39
#include <sys/stat.h>
slouken@94
    40
#ifdef OSS_USE_SOUNDCARD_H
slouken@94
    41
/* This is installed on some systems */
slouken@94
    42
#include <soundcard.h>
slouken@94
    43
#else
slouken@94
    44
/* This is recommended by OSS */
slouken@0
    45
#include <sys/soundcard.h>
slouken@94
    46
#endif
slouken@0
    47
slouken@0
    48
#include "SDL_audio.h"
slouken@0
    49
#include "SDL_error.h"
slouken@0
    50
#include "SDL_audiomem.h"
slouken@0
    51
#include "SDL_audio_c.h"
slouken@0
    52
#include "SDL_timer.h"
slouken@0
    53
#include "SDL_audiodev_c.h"
slouken@0
    54
#include "SDL_dspaudio.h"
slouken@0
    55
slouken@0
    56
/* The tag name used by DSP audio */
slouken@0
    57
#define DSP_DRIVER_NAME         "dsp"
slouken@0
    58
slouken@0
    59
/* Open the audio device for playback, and don't block if busy */
slouken@97
    60
/*#define USE_BLOCKING_WRITES*/
slouken@0
    61
#define OPEN_FLAGS	(O_WRONLY|O_NONBLOCK)
slouken@0
    62
slouken@0
    63
/* Audio driver functions */
slouken@0
    64
static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec);
slouken@0
    65
static void DSP_WaitAudio(_THIS);
slouken@0
    66
static void DSP_PlayAudio(_THIS);
slouken@0
    67
static Uint8 *DSP_GetAudioBuf(_THIS);
slouken@0
    68
static void DSP_CloseAudio(_THIS);
slouken@0
    69
slouken@0
    70
/* Audio driver bootstrap functions */
slouken@0
    71
slouken@0
    72
static int Audio_Available(void)
slouken@0
    73
{
slouken@0
    74
	int fd;
slouken@0
    75
	int available;
slouken@0
    76
slouken@0
    77
	available = 0;
slouken@0
    78
	fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
slouken@0
    79
	if ( fd >= 0 ) {
slouken@0
    80
		available = 1;
slouken@0
    81
		close(fd);
slouken@0
    82
	}
slouken@0
    83
	return(available);
slouken@0
    84
}
slouken@0
    85
slouken@0
    86
static void Audio_DeleteDevice(SDL_AudioDevice *device)
slouken@0
    87
{
slouken@0
    88
	free(device->hidden);
slouken@0
    89
	free(device);
slouken@0
    90
}
slouken@0
    91
slouken@0
    92
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
slouken@0
    93
{
slouken@0
    94
	SDL_AudioDevice *this;
slouken@0
    95
slouken@0
    96
	/* Initialize all variables that we clean on shutdown */
slouken@0
    97
	this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
slouken@0
    98
	if ( this ) {
slouken@0
    99
		memset(this, 0, (sizeof *this));
slouken@0
   100
		this->hidden = (struct SDL_PrivateAudioData *)
slouken@0
   101
				malloc((sizeof *this->hidden));
slouken@0
   102
	}
slouken@0
   103
	if ( (this == NULL) || (this->hidden == NULL) ) {
slouken@0
   104
		SDL_OutOfMemory();
slouken@0
   105
		if ( this ) {
slouken@0
   106
			free(this);
slouken@0
   107
		}
slouken@0
   108
		return(0);
slouken@0
   109
	}
slouken@0
   110
	memset(this->hidden, 0, (sizeof *this->hidden));
slouken@0
   111
	audio_fd = -1;
slouken@0
   112
slouken@0
   113
	/* Set the function pointers */
slouken@0
   114
	this->OpenAudio = DSP_OpenAudio;
slouken@0
   115
	this->WaitAudio = DSP_WaitAudio;
slouken@0
   116
	this->PlayAudio = DSP_PlayAudio;
slouken@0
   117
	this->GetAudioBuf = DSP_GetAudioBuf;
slouken@0
   118
	this->CloseAudio = DSP_CloseAudio;
slouken@0
   119
slouken@0
   120
	this->free = Audio_DeleteDevice;
slouken@0
   121
slouken@0
   122
	return this;
slouken@0
   123
}
slouken@0
   124
slouken@0
   125
AudioBootStrap DSP_bootstrap = {
slouken@0
   126
	DSP_DRIVER_NAME, "OSS /dev/dsp standard audio",
slouken@0
   127
	Audio_Available, Audio_CreateDevice
slouken@0
   128
};
slouken@0
   129
slouken@0
   130
/* This function waits until it is possible to write a full sound buffer */
slouken@0
   131
static void DSP_WaitAudio(_THIS)
slouken@0
   132
{
slouken@0
   133
	/* Check to see if the thread-parent process is still alive */
slouken@0
   134
	{ static int cnt = 0;
slouken@0
   135
		/* Note that this only works with thread implementations 
slouken@0
   136
		   that use a different process id for each thread.
slouken@0
   137
		*/
slouken@0
   138
		if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */
slouken@0
   139
			if ( kill(parent, 0) < 0 ) {
slouken@0
   140
				this->enabled = 0;
slouken@0
   141
			}
slouken@0
   142
		}
slouken@0
   143
	}
slouken@0
   144
slouken@93
   145
#ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */
slouken@0
   146
	/* See if we need to use timed audio synchronization */
slouken@0
   147
	if ( frame_ticks ) {
slouken@0
   148
		/* Use timer for general audio synchronization */
slouken@0
   149
		Sint32 ticks;
slouken@0
   150
slouken@0
   151
		ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS;
slouken@0
   152
		if ( ticks > 0 ) {
slouken@0
   153
			SDL_Delay(ticks);
slouken@0
   154
		}
slouken@0
   155
	} else {
slouken@0
   156
		/* Use select() for audio synchronization */
slouken@93
   157
		fd_set fdset;
slouken@0
   158
		struct timeval timeout;
slouken@93
   159
slouken@0
   160
		FD_ZERO(&fdset);
slouken@0
   161
		FD_SET(audio_fd, &fdset);
slouken@0
   162
		timeout.tv_sec = 10;
slouken@0
   163
		timeout.tv_usec = 0;
slouken@0
   164
#ifdef DEBUG_AUDIO
slouken@0
   165
		fprintf(stderr, "Waiting for audio to get ready\n");
slouken@0
   166
#endif
slouken@0
   167
		if ( select(audio_fd+1, NULL, &fdset, NULL, &timeout) <= 0 ) {
slouken@0
   168
			const char *message =
slouken@0
   169
			"Audio timeout - buggy audio driver? (disabled)";
slouken@0
   170
			/* In general we should never print to the screen,
slouken@0
   171
			   but in this case we have no other way of letting
slouken@0
   172
			   the user know what happened.
slouken@0
   173
			*/
slouken@0
   174
			fprintf(stderr, "SDL: %s\n", message);
slouken@0
   175
			this->enabled = 0;
slouken@0
   176
			/* Don't try to close - may hang */
slouken@0
   177
			audio_fd = -1;
slouken@0
   178
#ifdef DEBUG_AUDIO
slouken@0
   179
			fprintf(stderr, "Done disabling audio\n");
slouken@0
   180
#endif
slouken@0
   181
		}
slouken@0
   182
#ifdef DEBUG_AUDIO
slouken@0
   183
		fprintf(stderr, "Ready!\n");
slouken@0
   184
#endif
slouken@0
   185
	}
slouken@0
   186
#endif /* !USE_BLOCKING_WRITES */
slouken@0
   187
}
slouken@0
   188
slouken@0
   189
static void DSP_PlayAudio(_THIS)
slouken@0
   190
{
slouken@93
   191
	int written, p=0;
slouken@0
   192
slouken@0
   193
	/* Write the audio data, checking for EAGAIN on broken audio drivers */
slouken@0
   194
	do {
slouken@93
   195
		written = write(audio_fd, &mixbuf[p], mixlen-p);
slouken@93
   196
		if (written>0)
slouken@93
   197
		   p += written;
slouken@93
   198
		if (written == -1 && errno != 0 && errno != EAGAIN && errno != EINTR)
slouken@93
   199
		{
slouken@93
   200
		   /* Non recoverable error has occurred. It should be reported!!! */
slouken@93
   201
		   perror("audio");
slouken@93
   202
		   break;
slouken@93
   203
		}
slouken@93
   204
slouken@93
   205
		if ( p < written || ((written < 0) && ((errno == 0) || (errno == EAGAIN))) ) {
slouken@0
   206
			SDL_Delay(1);	/* Let a little CPU time go by */
slouken@0
   207
		}
slouken@93
   208
	} while ( p < written );
slouken@0
   209
slouken@0
   210
	/* If timer synchronization is enabled, set the next write frame */
slouken@0
   211
	if ( frame_ticks ) {
slouken@0
   212
		next_frame += frame_ticks;
slouken@0
   213
	}
slouken@0
   214
slouken@0
   215
	/* If we couldn't write, assume fatal error for now */
slouken@0
   216
	if ( written < 0 ) {
slouken@0
   217
		this->enabled = 0;
slouken@0
   218
	}
slouken@0
   219
#ifdef DEBUG_AUDIO
slouken@0
   220
	fprintf(stderr, "Wrote %d bytes of audio data\n", written);
slouken@0
   221
#endif
slouken@0
   222
}
slouken@0
   223
slouken@0
   224
static Uint8 *DSP_GetAudioBuf(_THIS)
slouken@0
   225
{
slouken@0
   226
	return(mixbuf);
slouken@0
   227
}
slouken@0
   228
slouken@0
   229
static void DSP_CloseAudio(_THIS)
slouken@0
   230
{
slouken@0
   231
	if ( mixbuf != NULL ) {
slouken@0
   232
		SDL_FreeAudioMem(mixbuf);
slouken@0
   233
		mixbuf = NULL;
slouken@0
   234
	}
slouken@0
   235
	if ( audio_fd >= 0 ) {
slouken@248
   236
		int value;
slouken@248
   237
		ioctl(audio_fd, SNDCTL_DSP_RESET, &value);
slouken@0
   238
		close(audio_fd);
slouken@0
   239
		audio_fd = -1;
slouken@0
   240
	}
slouken@0
   241
}
slouken@0
   242
slouken@0
   243
static int DSP_ReopenAudio(_THIS, const char *audiodev, int format,
slouken@0
   244
						SDL_AudioSpec *spec)
slouken@0
   245
{
slouken@0
   246
	int frag_spec;
slouken@0
   247
	int value;
slouken@0
   248
slouken@0
   249
	/* Close and then reopen the audio device */
slouken@0
   250
	close(audio_fd);
slouken@0
   251
	audio_fd = open(audiodev, O_WRONLY, 0);
slouken@0
   252
	if ( audio_fd < 0 ) {
slouken@0
   253
		SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
slouken@0
   254
		return(-1);
slouken@0
   255
	}
slouken@0
   256
slouken@0
   257
	/* Calculate the final parameters for this audio specification */
slouken@0
   258
	SDL_CalculateAudioSpec(spec);
slouken@0
   259
slouken@0
   260
	/* Determine the power of two of the fragment size */
slouken@0
   261
	for ( frag_spec = 0; (0x01<<frag_spec) < spec->size; ++frag_spec );
slouken@0
   262
	if ( (0x01<<frag_spec) != spec->size ) {
slouken@0
   263
		SDL_SetError("Fragment size must be a power of two");
slouken@0
   264
		return(-1);
slouken@0
   265
	}
slouken@0
   266
	frag_spec |= 0x00020000;	/* two fragments, for low latency */
slouken@0
   267
slouken@0
   268
	/* Set the audio buffering parameters */
slouken@0
   269
#ifdef DEBUG_AUDIO
slouken@0
   270
	fprintf(stderr, "Requesting %d fragments of size %d\n",
slouken@0
   271
		(frag_spec >> 16), 1<<(frag_spec&0xFFFF));
slouken@0
   272
#endif
slouken@0
   273
	if ( ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0 ) {
slouken@0
   274
		fprintf(stderr, "Warning: Couldn't set audio fragment size\n");
slouken@0
   275
	}
slouken@0
   276
#ifdef DEBUG_AUDIO
slouken@0
   277
	{ audio_buf_info info;
slouken@0
   278
	  ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info);
slouken@0
   279
	  fprintf(stderr, "fragments = %d\n", info.fragments);
slouken@0
   280
	  fprintf(stderr, "fragstotal = %d\n", info.fragstotal);
slouken@0
   281
	  fprintf(stderr, "fragsize = %d\n", info.fragsize);
slouken@0
   282
	  fprintf(stderr, "bytes = %d\n", info.bytes);
slouken@0
   283
	}
slouken@0
   284
#endif
slouken@0
   285
slouken@0
   286
	/* Set the audio format */
slouken@0
   287
	value = format;
slouken@0
   288
	if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) ||
slouken@0
   289
						(value != format) ) {
slouken@0
   290
		SDL_SetError("Couldn't set audio format");
slouken@0
   291
		return(-1);
slouken@0
   292
	}
slouken@0
   293
slouken@0
   294
	/* Set the number of channels of output */
slouken@0
   295
	value = spec->channels;
slouken@0
   296
#ifdef SNDCTL_DSP_CHANNELS
slouken@0
   297
	if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0 ) {
slouken@0
   298
#endif
slouken@0
   299
		value = (spec->channels > 1);
slouken@0
   300
		ioctl(audio_fd, SNDCTL_DSP_STEREO, &value);
slouken@0
   301
		value = (value ? 2 : 1);
slouken@0
   302
#ifdef SNDCTL_DSP_CHANNELS
slouken@0
   303
	}
slouken@0
   304
#endif
slouken@0
   305
	if ( value != spec->channels ) {
slouken@0
   306
		SDL_SetError("Couldn't set audio channels");
slouken@0
   307
		return(-1);
slouken@0
   308
	}
slouken@0
   309
slouken@0
   310
	/* Set the DSP frequency */
slouken@0
   311
	value = spec->freq;
slouken@0
   312
	if ( ioctl(audio_fd, SOUND_PCM_WRITE_RATE, &value) < 0 ) {
slouken@0
   313
		SDL_SetError("Couldn't set audio frequency");
slouken@0
   314
		return(-1);
slouken@0
   315
	}
slouken@0
   316
	spec->freq = value;
slouken@0
   317
slouken@0
   318
	/* We successfully re-opened the audio */
slouken@0
   319
	return(0);
slouken@0
   320
}
slouken@0
   321
slouken@0
   322
static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
slouken@0
   323
{
slouken@0
   324
	char audiodev[1024];
slouken@0
   325
	int format;
slouken@0
   326
	int value;
slouken@0
   327
	Uint16 test_format;
slouken@0
   328
slouken@0
   329
	/* Reset the timer synchronization flag */
slouken@0
   330
	frame_ticks = 0.0;
slouken@0
   331
slouken@0
   332
	/* Open the audio device */
slouken@0
   333
	audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
slouken@0
   334
	if ( audio_fd < 0 ) {
slouken@0
   335
		SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
slouken@0
   336
		return(-1);
slouken@0
   337
	}
slouken@0
   338
	mixbuf = NULL;
slouken@0
   339
slouken@96
   340
#ifdef USE_BLOCKING_WRITES
slouken@96
   341
	/* Make the file descriptor use blocking writes with fcntl() */
slouken@96
   342
	{ long flags;
slouken@96
   343
		flags = fcntl(audio_fd, F_GETFL);
slouken@96
   344
		flags &= ~O_NONBLOCK;
slouken@96
   345
		if ( fcntl(audio_fd, F_SETFL, flags) < 0 ) {
slouken@96
   346
			SDL_SetError("Couldn't set audio blocking mode");
slouken@96
   347
			return(-1);
slouken@96
   348
		}
slouken@96
   349
	}
slouken@96
   350
#endif
slouken@96
   351
slouken@0
   352
	/* Get a list of supported hardware formats */
slouken@0
   353
	if ( ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0 ) {
slouken@0
   354
		SDL_SetError("Couldn't get audio format list");
slouken@0
   355
		return(-1);
slouken@0
   356
	}
slouken@0
   357
slouken@0
   358
	/* Try for a closest match on audio format */
slouken@0
   359
	format = 0;
slouken@0
   360
	for ( test_format = SDL_FirstAudioFormat(spec->format);
slouken@0
   361
						! format && test_format; ) {
slouken@0
   362
#ifdef DEBUG_AUDIO
slouken@0
   363
		fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
slouken@0
   364
#endif
slouken@0
   365
		switch ( test_format ) {
slouken@0
   366
			case AUDIO_U8:
slouken@0
   367
				if ( value & AFMT_U8 ) {
slouken@0
   368
					format = AFMT_U8;
slouken@0
   369
				}
slouken@0
   370
				break;
slouken@0
   371
			case AUDIO_S8:
slouken@0
   372
				if ( value & AFMT_S8 ) {
slouken@0
   373
					format = AFMT_S8;
slouken@0
   374
				}
slouken@0
   375
				break;
slouken@0
   376
			case AUDIO_S16LSB:
slouken@0
   377
				if ( value & AFMT_S16_LE ) {
slouken@0
   378
					format = AFMT_S16_LE;
slouken@0
   379
				}
slouken@0
   380
				break;
slouken@0
   381
			case AUDIO_S16MSB:
slouken@0
   382
				if ( value & AFMT_S16_BE ) {
slouken@0
   383
					format = AFMT_S16_BE;
slouken@0
   384
				}
slouken@0
   385
				break;
slouken@0
   386
			case AUDIO_U16LSB:
slouken@0
   387
				if ( value & AFMT_U16_LE ) {
slouken@0
   388
					format = AFMT_U16_LE;
slouken@0
   389
				}
slouken@0
   390
				break;
slouken@0
   391
			case AUDIO_U16MSB:
slouken@0
   392
				if ( value & AFMT_U16_BE ) {
slouken@0
   393
					format = AFMT_U16_BE;
slouken@0
   394
				}
slouken@0
   395
				break;
slouken@0
   396
			default:
slouken@0
   397
				break;
slouken@0
   398
		}
slouken@0
   399
		if ( ! format ) {
slouken@0
   400
			test_format = SDL_NextAudioFormat();
slouken@0
   401
		}
slouken@0
   402
	}
slouken@0
   403
	if ( format == 0 ) {
slouken@0
   404
		SDL_SetError("Couldn't find any hardware audio formats");
slouken@0
   405
		return(-1);
slouken@0
   406
	}
slouken@0
   407
	spec->format = test_format;
slouken@0
   408
slouken@0
   409
	/* Set the audio format */
slouken@0
   410
	value = format;
slouken@0
   411
	if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) ||
slouken@0
   412
						(value != format) ) {
slouken@0
   413
		SDL_SetError("Couldn't set audio format");
slouken@0
   414
		return(-1);
slouken@0
   415
	}
slouken@0
   416
slouken@0
   417
	/* Set the number of channels of output */
slouken@0
   418
	value = spec->channels;
slouken@0
   419
#ifdef SNDCTL_DSP_CHANNELS
slouken@0
   420
	if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0 ) {
slouken@0
   421
#endif
slouken@0
   422
		value = (spec->channels > 1);
slouken@0
   423
		ioctl(audio_fd, SNDCTL_DSP_STEREO, &value);
slouken@0
   424
		value = (value ? 2 : 1);
slouken@0
   425
#ifdef SNDCTL_DSP_CHANNELS
slouken@0
   426
	}
slouken@0
   427
#endif
slouken@0
   428
	spec->channels = value;
slouken@0
   429
slouken@0
   430
	/* Because some drivers don't allow setting the buffer size
slouken@0
   431
	   after setting the format, we must re-open the audio device
slouken@0
   432
	   once we know what format and channels are supported
slouken@0
   433
	 */
slouken@0
   434
	if ( DSP_ReopenAudio(this, audiodev, format, spec) < 0 ) {
slouken@0
   435
		/* Error is set by DSP_ReopenAudio() */
slouken@0
   436
		return(-1);
slouken@0
   437
	}
slouken@0
   438
slouken@0
   439
	/* Allocate mixing buffer */
slouken@0
   440
	mixlen = spec->size;
slouken@0
   441
	mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
slouken@0
   442
	if ( mixbuf == NULL ) {
slouken@0
   443
		return(-1);
slouken@0
   444
	}
slouken@0
   445
	memset(mixbuf, spec->silence, spec->size);
slouken@0
   446
slouken@0
   447
#ifndef USE_BLOCKING_WRITES
slouken@0
   448
	/* Check to see if we need to use select() workaround */
slouken@0
   449
	{ char *workaround;
slouken@0
   450
		workaround = getenv("SDL_DSP_NOSELECT");
slouken@0
   451
		if ( workaround ) {
slouken@0
   452
			frame_ticks = (float)(spec->samples*1000)/spec->freq;
slouken@0
   453
			next_frame = SDL_GetTicks()+frame_ticks;
slouken@0
   454
		}
slouken@0
   455
	}
slouken@0
   456
#endif /* !USE_BLOCKING_WRITES */
slouken@0
   457
slouken@0
   458
	/* Get the parent process id (we're the parent of the audio thread) */
slouken@0
   459
	parent = getpid();
slouken@0
   460
slouken@0
   461
	/* We're ready to rock and roll. :-) */
slouken@0
   462
	return(0);
slouken@0
   463
}