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

Commit

Permalink
Moved AudioBootstrap section in converted drivers to bottom of source…
Browse files Browse the repository at this point in the history
…, 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 c3b10ff
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 273 deletions.
52 changes: 22 additions & 30 deletions src/audio/arts/SDL_artsaudio.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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: */
52 changes: 12 additions & 40 deletions src/audio/bsd/SDL_bsdaudio.c
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/audio/dc/SDL_dcaudio.c
Expand Up @@ -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"
Expand Down
49 changes: 21 additions & 28 deletions src/audio/disk/SDL_diskaudio.c
Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down Expand Up @@ -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: */
57 changes: 22 additions & 35 deletions src/audio/dma/SDL_dmaaudio.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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: */
55 changes: 22 additions & 33 deletions src/audio/dsp/SDL_dspaudio.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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: */
17 changes: 7 additions & 10 deletions src/audio/dummy/SDL_dummyaudio.c
Expand Up @@ -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)
{
Expand All @@ -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.