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

Commit

Permalink
High level now lets user select a specific audio device with an envir…
Browse files Browse the repository at this point in the history
…onment

 variable, when the app requested the default device.
  • Loading branch information
icculus committed Oct 3, 2006
1 parent 38edc84 commit 2149666
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/audio/SDL_audio.c
Expand Up @@ -572,6 +572,11 @@ open_audio_device(const char *devname, int iscapture,
return 0;
}

/* If app doesn't care about a specific device, let the user override. */
if (devname == NULL) {
devname = SDL_getenv("SDL_AUDIO_DEVICE_NAME");
}

device = (SDL_AudioDevice *) SDL_AllocAudioMem(sizeof (SDL_AudioDevice));
if (device == NULL) {
SDL_OutOfMemory();
Expand Down
9 changes: 4 additions & 5 deletions src/audio/macosx/SDL_coreaudio.c
Expand Up @@ -223,8 +223,11 @@ outputCallback(void *inRefCon,
UInt32 remaining, len;
void *ptr;

/*
* !!! FIXME: I'm not sure if you can ever have more than one
* buffer, or what this signifies, or what to do with it...
*/
if (ioDataList->mNumberBuffers != 1) {
fprintf(stderr, "!!! FIXME SDL!\n");
return noErr;
}

Expand Down Expand Up @@ -406,10 +409,6 @@ prepare_audiounit(_THIS, const char *devname, int iscapture,
const AudioUnitScope scope = ((iscapture) ? kAudioUnitScope_Output :
kAudioUnitScope_Input);

/* !!! FIXME: move something like this to higher level. */
if ( (devname == NULL) && (SDL_getenv("SDL_AUDIO_DEVNAME")) )
devname = SDL_getenv("SDL_AUDIO_DEVNAME");

if (!find_device_by_name(this, devname, iscapture)) {
SDL_SetError("Couldn't find requested CoreAudio device");
return 0;
Expand Down

0 comments on commit 2149666

Please sign in to comment.