Mercurial > sdl-ios-xcode
changeset 3805:ef7f7be318da SDL-ryan-multiple-audio-device
Disk audio can now use device name for target filename.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Wed, 04 Oct 2006 22:23:57 +0000 |
parents | b12b7ec0dfcc |
children | 1485d42cf1a0 |
files | src/audio/disk/SDL_diskaudio.c |
diffstat | 1 files changed, 20 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audio/disk/SDL_diskaudio.c Wed Oct 04 22:16:46 2006 +0000 +++ b/src/audio/disk/SDL_diskaudio.c Wed Oct 04 22:23:57 2006 +0000 @@ -54,10 +54,15 @@ static void DISKAUD_CloseDevice(_THIS); static const char * -DISKAUD_GetOutputFilename(void) +DISKAUD_GetOutputFilename(const char *devname) { - const char *envr = SDL_getenv(DISKENVR_OUTFILE); - return ((envr != NULL) ? envr : DISKDEFAULT_OUTFILE); + if (devname == NULL) { + devname = SDL_getenv(DISKENVR_OUTFILE); + if (devname == NULL) { + devname = DISKDEFAULT_OUTFILE; + } + } + return devname; } /* Audio driver bootstrap functions */ @@ -122,29 +127,25 @@ static void DISKAUD_CloseDevice(_THIS) { - if (this->hidden->mixbuf != NULL) { - SDL_FreeAudioMem(this->hidden->mixbuf); - this->hidden->mixbuf = NULL; + if (this->hidden != NULL) { + if (this->hidden->mixbuf != NULL) { + SDL_FreeAudioMem(this->hidden->mixbuf); + this->hidden->mixbuf = NULL; + } + if (this->hidden->output != NULL) { + SDL_RWclose(this->hidden->output); + this->hidden->output = NULL; + } + SDL_free(this->hidden); + this->hidden = NULL; } - if (this->hidden->output != NULL) { - SDL_RWclose(this->hidden->output); - this->hidden->output = NULL; - } - SDL_free(this->hidden); - this->hidden = NULL; } static int DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture) { const char *envr = SDL_getenv(DISKENVR_WRITEDELAY); - const char *fname = DISKAUD_GetOutputFilename(); - - /* !!! FIXME: use device name for non-default filename? */ - if (devname != NULL) { - SDL_SetError("Disk audio device name must be NULL"); - return 0; - } + const char *fname = DISKAUD_GetOutputFilename(devname); this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof (*this->hidden));