Search
lxdream.org :: lxdream/src/aica/audio.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/aica/audio.c
changeset 531:f0fee3ba71d1
prev465:3bd7be575792
next561:533f6b478071
author nkeynes
date Thu Nov 22 11:10:15 2007 +0000 (16 years ago)
permissions -rw-r--r--
last change Re-add "Load Binary" menu item (misplaced in GUI rewrite)
Prevent running with no code loaded
file annotate diff log raw
1.1 --- a/src/aica/audio.c Sat Oct 27 05:47:21 2007 +0000
1.2 +++ b/src/aica/audio.c Thu Nov 22 11:10:15 2007 +0000
1.3 @@ -24,6 +24,13 @@
1.4 #include <assert.h>
1.5 #include <string.h>
1.6
1.7 +audio_driver_t audio_driver_list[] = {
1.8 +#ifdef HAVE_ESOUND
1.9 + &audio_esd_driver,
1.10 +#endif
1.11 + &audio_null_driver,
1.12 + NULL };
1.13 +
1.14 #define NUM_BUFFERS 3
1.15 #define MS_PER_BUFFER 100
1.16
1.17 @@ -61,6 +68,21 @@
1.18 return (read == AUDIO_CHANNEL_COUNT ? 0 : -1 );
1.19 }
1.20
1.21 +audio_driver_t get_audio_driver_by_name( const char *name )
1.22 +{
1.23 + int i;
1.24 + if( name == NULL ) {
1.25 + return audio_driver_list[0];
1.26 + }
1.27 + for( i=0; audio_driver_list[i] != NULL; i++ ) {
1.28 + if( strcasecmp( audio_driver_list[i]->name, name ) == 0 ) {
1.29 + return audio_driver_list[i];
1.30 + }
1.31 + }
1.32 +
1.33 + return NULL;
1.34 +}
1.35 +
1.36 /**
1.37 * Set the output driver, sample rate and format. Also initializes the
1.38 * output buffers, flushing any current data and reallocating as
.