Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Moved AudioBootstrap section in converted drivers to bottom of source…

…, so I

 could delete the predeclarations (one more thing to forget to update when
 changing the API, otherwise). There're a few other cleanups that snuck into
 this commit, too.
  • Loading branch information
icculus committed Oct 6, 2006
1 parent f49f4b1 commit c3b10ff85e0ce39519700ec644f0ccd65c817081
@@ -39,14 +39,6 @@
/* The tag name used by artsc audio */
#define ARTS_DRIVER_NAME "arts"

/* Audio driver functions */
static int ARTS_OpenDevice(_THIS, const char *devname, int iscapture);
static void ARTS_WaitDevice(_THIS);
static void ARTS_PlayDevice(_THIS);
static Uint8 *ARTS_GetDeviceBuf(_THIS);
static void ARTS_CloseDevice(_THIS);
static void ARTS_WaitDone(_THIS);

#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC

static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC;
@@ -160,28 +152,6 @@ ARTS_Available(void)
}


static int
ARTS_Init(SDL_AudioDriverImpl *impl)
{
/* Set the function pointers */
impl->OpenDevice = ARTS_OpenDevice;
impl->PlayDevice = ARTS_PlayDevice;
impl->WaitDevice = ARTS_WaitDevice;
impl->GetDeviceBuf = ARTS_GetDeviceBuf;
impl->CloseDevice = ARTS_CloseDevice;
impl->WaitDone = ARTS_WaitDone;
impl->OnlyHasDefaultOutputDevice = 1;

return 1;
}


AudioBootStrap ARTS_bootstrap = {
ARTS_DRIVER_NAME, "Analog RealTime Synthesizer",
ARTS_Available, ARTS_Init, 0
};


/* This function waits until it is possible to write a full sound buffer */
static void
ARTS_WaitDevice(_THIS)
@@ -370,4 +340,26 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture)
return 1;
}


static int
ARTS_Init(SDL_AudioDriverImpl *impl)
{
/* Set the function pointers */
impl->OpenDevice = ARTS_OpenDevice;
impl->PlayDevice = ARTS_PlayDevice;
impl->WaitDevice = ARTS_WaitDevice;
impl->GetDeviceBuf = ARTS_GetDeviceBuf;
impl->CloseDevice = ARTS_CloseDevice;
impl->WaitDone = ARTS_WaitDone;
impl->OnlyHasDefaultOutputDevice = 1;

return 1;
}


AudioBootStrap ARTS_bootstrap = {
ARTS_DRIVER_NAME, "Analog RealTime Synthesizer",
ARTS_Available, ARTS_Init, 0
};

/* vi: set ts=4 sw=4 expandtab: */
@@ -269,46 +269,18 @@ OBSD_Status(_THIS)
"waiting : %s\n"
"active : %s\n"
"",
info.
play.
buffer_size,
info.
play.
sample_rate,
info.
play.
channels,
info.
play.
precision,
info.
play.
encoding,
info.
play.
seek,
info.
play.
samples,
info.
play.
eof,
info.
play.
pause
?
"yes"
:
"no",
info.
play.
error
?
"yes"
:
"no",
info.
play.waiting ? "yes" : "no", info.play.active ? "yes" : "no");
info.play.buffer_size,
info.play.sample_rate,
info.play.channels,
info.play.precision,
info.play.encoding,
info.play.seek,
info.play.samples,
info.play.eof,
info.play.pause ? "yes" : "no",
info.play.error ? "yes" : "no",
info.play.waiting ? "yes" : "no",
info.play.active ? "yes" : "no");

fprintf(stderr, "\n"
"[audio info]\n"
@@ -28,7 +28,6 @@
#include "SDL_audio.h"
#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
#include "../SDL_audiodev_c.h"
#include "SDL_dcaudio.h"

#include "aica.h"
@@ -45,13 +45,6 @@
#define DISKENVR_WRITEDELAY "SDL_DISKAUDIODELAY"
#define DISKDEFAULT_WRITEDELAY 150

/* Audio driver functions */
static int DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture);
static void DISKAUD_WaitDevice(_THIS);
static void DISKAUD_PlayDevice(_THIS);
static Uint8 *DISKAUD_GetDeviceBuf(_THIS);
static void DISKAUD_CloseDevice(_THIS);

static const char *
DISKAUD_GetOutputFilename(const char *devname)
{
@@ -71,27 +64,6 @@ DISKAUD_Available(void)
return 1; /* always available. */
}

static int
DISKAUD_Init(SDL_AudioDriverImpl *impl)
{
/* Initialize all variables that we clean on shutdown */
SDL_memset(impl, '\0', sizeof (SDL_AudioDriverImpl));

/* Set the function pointers */
impl->OpenDevice = DISKAUD_OpenDevice;
impl->WaitDevice = DISKAUD_WaitDevice;
impl->PlayDevice = DISKAUD_PlayDevice;
impl->GetDeviceBuf = DISKAUD_GetDeviceBuf;
impl->CloseDevice = DISKAUD_CloseDevice;

return 1;
}

AudioBootStrap DISKAUD_bootstrap = {
DISKAUD_DRIVER_NAME, "direct-to-disk audio",
DISKAUD_Available, DISKAUD_Init, 1
};

/* This function waits until it is possible to write a full sound buffer */
static void
DISKAUD_WaitDevice(_THIS)
@@ -183,4 +155,25 @@ DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture)
return 1;
}

static int
DISKAUD_Init(SDL_AudioDriverImpl *impl)
{
/* Initialize all variables that we clean on shutdown */
SDL_memset(impl, '\0', sizeof (SDL_AudioDriverImpl));

/* Set the function pointers */
impl->OpenDevice = DISKAUD_OpenDevice;
impl->WaitDevice = DISKAUD_WaitDevice;
impl->PlayDevice = DISKAUD_PlayDevice;
impl->GetDeviceBuf = DISKAUD_GetDeviceBuf;
impl->CloseDevice = DISKAUD_CloseDevice;

return 1;
}

AudioBootStrap DISKAUD_bootstrap = {
DISKAUD_DRIVER_NAME, "direct-to-disk audio",
DISKAUD_Available, DISKAUD_Init, 1
};

/* vi: set ts=4 sw=4 expandtab: */
@@ -62,18 +62,6 @@
#define OPEN_FLAGS_INPUT (O_RDWR|O_NONBLOCK)
#define OPEN_FLAGS_OUTPUT (O_RDWR|O_NONBLOCK)

/* Audio driver functions */
static int DMA_DetectDevices(int iscapture);
static const char *DMA_GetDeviceName(int index, int iscapture);
static int DMA_OpenDevice(_THIS, const char *devname, int iscapture);
static void DMA_WaitDevice(_THIS);
static void DMA_PlayDevice(_THIS);
static Uint8 *DMA_GetDeviceBuf(_THIS);
static void DMA_CloseDevice(_THIS);
static void DMA_Deinitialize(void);

/* Audio driver bootstrap functions */

static char **outputDevices = NULL;
static int outputDeviceCount = 0;
static char **inputDevices = NULL;
@@ -138,29 +126,6 @@ DMA_Available(void)
return available;
}


static int
DMA_Init(SDL_AudioDriverImpl *impl)
{
/* Set the function pointers */
impl->DetectDevices = DMA_DetectDevices;
impl->GetDeviceName = DMA_GetDeviceName;
impl->OpenDevice = DMA_OpenDevice;
impl->WaitDevice = DMA_WaitDevice;
impl->PlayDevice = DMA_PlayDevice;
impl->GetDeviceBuf = DMA_GetDeviceBuf;
impl->CloseDevice = DMA_CloseDevice;
impl->Deinitialize = DMA_Deinitialize;

build_device_lists();
return 1;
}

AudioBootStrap DMA_bootstrap = {
DMA_DRIVER_NAME, "OSS /dev/dsp DMA audio",
DMA_Available, DMA_Init, 0
};

static void DMA_Deinitialize(void)
{
free_device_lists();
@@ -557,4 +522,26 @@ DMA_CloseDevice(_THIS)
}
}

static int
DMA_Init(SDL_AudioDriverImpl *impl)
{
/* Set the function pointers */
impl->DetectDevices = DMA_DetectDevices;
impl->GetDeviceName = DMA_GetDeviceName;
impl->OpenDevice = DMA_OpenDevice;
impl->WaitDevice = DMA_WaitDevice;
impl->PlayDevice = DMA_PlayDevice;
impl->GetDeviceBuf = DMA_GetDeviceBuf;
impl->CloseDevice = DMA_CloseDevice;
impl->Deinitialize = DMA_Deinitialize;

build_device_lists();
return 1;
}

AudioBootStrap DMA_bootstrap = {
DMA_DRIVER_NAME, "OSS /dev/dsp DMA audio",
DMA_Available, DMA_Init, 0
};

/* vi: set ts=4 sw=4 expandtab: */
@@ -58,16 +58,6 @@
#define OPEN_FLAGS_OUTPUT (O_WRONLY|O_NONBLOCK)
#define OPEN_FLAGS_INPUT (O_RDONLY|O_NONBLOCK)

/* Audio driver functions */
static int DSP_DetectDevices(int iscapture);
static const char *DSP_GetDeviceName(int index, int iscapture);
static int DSP_OpenDevice(_THIS, const char *devname, int iscapture);
static void DSP_WaitDevice(_THIS);
static void DSP_PlayDevice(_THIS);
static Uint8 *DSP_GetDeviceBuf(_THIS);
static void DSP_CloseDevice(_THIS);
static void DSP_Deinitialize(void);

/* Audio driver bootstrap functions */

static char **outputDevices = NULL;
@@ -116,29 +106,6 @@ DSP_Available(void)
}


static int
DSP_Init(SDL_AudioDriverImpl *impl)
{
/* Set the function pointers */
impl->DetectDevices = DSP_DetectDevices;
impl->GetDeviceName = DSP_GetDeviceName;
impl->OpenDevice = DSP_OpenDevice;
impl->PlayDevice = DSP_PlayDevice;
impl->GetDeviceBuf = DSP_GetDeviceBuf;
impl->CloseDevice = DSP_CloseDevice;
impl->Deinitialize = DSP_Deinitialize;

build_device_lists();
return 1;
}


AudioBootStrap DSP_bootstrap = {
DSP_DRIVER_NAME, "OSS /dev/dsp standard audio",
DSP_Available, DSP_Init, 0
};


static void DSP_Deinitialize(void)
{
free_device_lists();
@@ -402,4 +369,26 @@ DSP_CloseDevice(_THIS)
}
}

static int
DSP_Init(SDL_AudioDriverImpl *impl)
{
/* Set the function pointers */
impl->DetectDevices = DSP_DetectDevices;
impl->GetDeviceName = DSP_GetDeviceName;
impl->OpenDevice = DSP_OpenDevice;
impl->PlayDevice = DSP_PlayDevice;
impl->GetDeviceBuf = DSP_GetDeviceBuf;
impl->CloseDevice = DSP_CloseDevice;
impl->Deinitialize = DSP_Deinitialize;

build_device_lists();
return 1;
}


AudioBootStrap DSP_bootstrap = {
DSP_DRIVER_NAME, "OSS /dev/dsp standard audio",
DSP_Available, DSP_Init, 0
};

/* vi: set ts=4 sw=4 expandtab: */
@@ -35,16 +35,19 @@
/* The tag name used by DUMMY audio */
#define DUMMYAUD_DRIVER_NAME "dummy"

/* Audio driver functions */
static int DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture);

/* Audio driver bootstrap functions */
static int
DUMMYAUD_Available(void)
{
return 1; /* always available. */
}

static int
DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture)
{
return 1; /* always succeeds. */
}


static int
DUMMYAUD_Init(SDL_AudioDriverImpl *impl)
{
@@ -60,10 +63,4 @@ AudioBootStrap DUMMYAUD_bootstrap = {
DUMMYAUD_Available, DUMMYAUD_Init, 1
};

static int
DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture)
{
return 1; /* always succeeds. */
}

/* vi: set ts=4 sw=4 expandtab: */

0 comments on commit c3b10ff

Please sign in to comment.