Skip to content

Commit

Permalink
Merge remote branch 'johan/master' into soundcard-config
Browse files Browse the repository at this point in the history
  • Loading branch information
mflint committed Apr 23, 2011
2 parents 38935bb + ae36ca1 commit 1dcc375
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions hairtunes.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ int fmtp[32];
int sampling_rate;
int frame_size;

//Audio Device/driver variables
// Max num of chars " " - 32 character string, 1 reserved for null
char *audiodevice = "Speakers (Realtek High Definiti";
char *audiodriver = "wmm";
char *audiodeviceid = 0;

// FIFO name and file handle
char *pipename = 0;
int pipe_handle = -1;
Expand Down Expand Up @@ -740,16 +746,31 @@ void init_pipe(char* pipe) {
void* init_ao() {
ao_initialize();
int driver = ao_default_driver_id();

ao_sample_format fmt;
memset(&fmt, 0, sizeof(fmt));

ao_option aoo;
ao_option *ao_opts=0;
memset(&fmt, 0, sizeof(fmt));

fmt.bits = 16;
fmt.rate = sampling_rate;
fmt.channels = NUM_CHANNELS;
fmt.byte_format = AO_FMT_NATIVE;

ao_device *dev = ao_open_live(driver, &fmt, 0);

if(audiodriver!=0){
driver = ao_driver_id(audiodriver);
}
if(audiodeviceid!=0){
aoo.key="id";
aoo.value=audiodeviceid;
aoo.next=NULL;
ao_opts=&aoo;
} else if(audiodevice!=0){
aoo.key="dev";
aoo.value=audiodevice;
aoo.next=NULL;
ao_opts=&aoo;
}
ao_device *dev = ao_open_live(driver, &fmt, ao_opts);
return dev;
}

Expand Down

0 comments on commit 1dcc375

Please sign in to comment.