Search
lxdream.org :: lxdream/src/drivers/audio_esd.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/audio_esd.c
changeset 697:479b8c213f61
prev643:653b0a70f173
next700:4650d0c7f6f9
author nkeynes
date Sun Jun 22 04:01:27 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Commit work-in-progress CoreAudio driver
(along with various changes to the audio subsystem)
file annotate diff log raw
1.1 --- a/src/drivers/audio_esd.c Tue Feb 26 01:10:48 2008 +0000
1.2 +++ b/src/drivers/audio_esd.c Sun Jun 22 04:01:27 2008 +0000
1.3 @@ -27,28 +27,26 @@
1.4
1.5 gboolean audio_esd_init()
1.6 {
1.7 - return TRUE;
1.8 -}
1.9 -
1.10 -gboolean audio_esd_set_format( uint32_t rate, uint32_t format )
1.11 -{
1.12 + int format = DEFAULT_SAMPLE_FORMAT;
1.13 + int rate = DEFAULT_SAMPLE_RATE;
1.14 +
1.15 if( esd_handle != -1 ) {
1.16 - esd_close(esd_handle);
1.17 + esd_close(esd_handle);
1.18 }
1.19 esd_format_t esd_format = 0;
1.20 esd_sample_size = 1;
1.21 if( format & AUDIO_FMT_16BIT ) {
1.22 - esd_format |= ESD_BITS16;
1.23 + esd_format |= ESD_BITS16;
1.24 } else esd_format |= ESD_BITS8;
1.25 if( format & AUDIO_FMT_STEREO ) {
1.26 - esd_format |= ESD_STEREO;
1.27 + esd_format |= ESD_STEREO;
1.28 }
1.29 else esd_format |= ESD_MONO;
1.30 -
1.31 +
1.32 esd_handle = esd_play_stream( esd_format, rate, "localhost", "lxdream" );
1.33 if( esd_handle == -1 ) {
1.34 - ERROR( "Unable to open audio output (ESD)" );
1.35 - return FALSE;
1.36 + ERROR( "Unable to open audio output (ESD)" );
1.37 + return FALSE;
1.38 }
1.39 return TRUE;
1.40 }
1.41 @@ -56,22 +54,27 @@
1.42 gboolean audio_esd_process_buffer( audio_buffer_t buffer )
1.43 {
1.44 if( esd_handle != -1 ) {
1.45 - write( esd_handle, buffer->data, buffer->length );
1.46 - return TRUE;
1.47 + write( esd_handle, buffer->data, buffer->length );
1.48 + return TRUE;
1.49 } else {
1.50 - ERROR( "ESD not initialized" );
1.51 - return FALSE;
1.52 + ERROR( "ESD not initialized" );
1.53 + return FALSE;
1.54 }
1.55 }
1.56
1.57 -gboolean audio_esd_close()
1.58 +gboolean audio_esd_shutdown()
1.59 {
1.60 - return TRUE;
1.61 + close(esd_handle);
1.62 + esd_handle = -1;
1.63 + return TRUE;
1.64 }
1.65
1.66 struct audio_driver audio_esd_driver = { "esd",
1.67 - audio_esd_init,
1.68 - audio_esd_set_format,
1.69 - audio_esd_process_buffer,
1.70 - audio_esd_close};
1.71 + DEFAULT_SAMPLE_RATE,
1.72 + DEFAULT_SAMPLE_FORMAT,
1.73 + audio_esd_init,
1.74 + NULL,
1.75 + audio_esd_process_buffer,
1.76 + NULL,
1.77 + audio_esd_shutdown};
1.78
.