Search
lxdream.org :: lxdream/src/aica/audio.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/aica/audio.c
changeset 736:a02d1475ccfd
prev700:4650d0c7f6f9
next759:f16975739abc
author nkeynes
date Mon Jul 14 07:44:42 2008 +0000 (13 years ago)
permissions -rw-r--r--
last change Re-indent everything consistently
Fix include guards for consistency as well
file annotate diff log raw
1.1 --- a/src/aica/audio.c Sun Jun 22 06:49:00 2008 +0000
1.2 +++ b/src/aica/audio.c Mon Jul 14 07:44:42 2008 +0000
1.3 @@ -33,19 +33,19 @@
1.4
1.5 audio_driver_t audio_driver_list[] = {
1.6 #ifdef HAVE_CORE_AUDIO
1.7 - &audio_osx_driver,
1.8 + &audio_osx_driver,
1.9 #endif
1.10 #ifdef HAVE_PULSE
1.11 - &audio_pulse_driver,
1.12 + &audio_pulse_driver,
1.13 #endif
1.14 #ifdef HAVE_ESOUND
1.15 - &audio_esd_driver,
1.16 + &audio_esd_driver,
1.17 #endif
1.18 #ifdef HAVE_ALSA
1.19 - &audio_alsa_driver,
1.20 + &audio_alsa_driver,
1.21 #endif
1.22 - &audio_null_driver,
1.23 - NULL };
1.24 + &audio_null_driver,
1.25 + NULL };
1.26
1.27 #define NUM_BUFFERS 3
1.28 #define MS_PER_BUFFER 100
1.29 @@ -105,7 +105,7 @@
1.30 fprintf( out, "Available audio drivers:\n" );
1.31 for( i=0; audio_driver_list[i] != NULL; i++ ) {
1.32 fprintf( out, " %-8s %s\n", audio_driver_list[i]->name,
1.33 - gettext(audio_driver_list[i]->description) );
1.34 + gettext(audio_driver_list[i]->description) );
1.35 }
1.36 }
1.37
1.38 @@ -239,23 +239,23 @@
1.39 */
1.40
1.41 #define CLAMP_TO_SHORT(value) \
1.42 -if (value > 32767) \
1.43 + if (value > 32767) \
1.44 value = 32767; \
1.45 -else if (value < -32768) \
1.46 + else if (value < -32768) \
1.47 value = -32768; \
1.48
1.49 static const int yamaha_indexscale[] = {
1.50 - 230, 230, 230, 230, 307, 409, 512, 614,
1.51 - 230, 230, 230, 230, 307, 409, 512, 614
1.52 + 230, 230, 230, 230, 307, 409, 512, 614,
1.53 + 230, 230, 230, 230, 307, 409, 512, 614
1.54 };
1.55
1.56 static const int yamaha_difflookup[] = {
1.57 - 1, 3, 5, 7, 9, 11, 13, 15,
1.58 - -1, -3, -5, -7, -9, -11, -13, -15
1.59 + 1, 3, 5, 7, 9, 11, 13, 15,
1.60 + -1, -3, -5, -7, -9, -11, -13, -15
1.61 };
1.62
1.63 static inline short adpcm_yamaha_decode_nibble( audio_channel_t c,
1.64 - unsigned char nibble )
1.65 + unsigned char nibble )
1.66 {
1.67 if( c->adpcm_step == 0 ) {
1.68 c->adpcm_predict = 0;
1.69 @@ -371,7 +371,7 @@
1.70 }
1.71 }
1.72 }
1.73 -
1.74 +
1.75 /* Down-render to the final output format */
1.76 audio_buffer_t buf = audio.output_buffers[audio.write_buffer];
1.77 if( buf->status == BUFFER_FULL ) {
1.78 @@ -380,7 +380,7 @@
1.79 return;
1.80 }
1.81 }
1.82 -
1.83 +
1.84 switch( audio.output_format & AUDIO_FMT_SAMPLE_MASK ) {
1.85 case AUDIO_FMT_FLOAT: {
1.86 float scale = 1.0/SHRT_MAX;
1.87 @@ -447,11 +447,11 @@
1.88 void audio_start_stop_channel( int channel, gboolean start )
1.89 {
1.90 if( audio.channels[channel].active ) {
1.91 - if( !start ) {
1.92 - audio_stop_channel(channel);
1.93 - }
1.94 + if( !start ) {
1.95 + audio_stop_channel(channel);
1.96 + }
1.97 } else if( start ) {
1.98 - audio_start_channel(channel);
1.99 + audio_start_channel(channel);
1.100 }
1.101 }
1.102
1.103 @@ -467,9 +467,9 @@
1.104 audio.channels[channel].posn_left = 0;
1.105 audio.channels[channel].active = TRUE;
1.106 if( audio.channels[channel].sample_format == AUDIO_FMT_ADPCM ) {
1.107 - audio.channels[channel].adpcm_step = 0;
1.108 - audio.channels[channel].adpcm_predict = 0;
1.109 - uint8_t data = ((uint8_t *)(arm_mem + audio.channels[channel].start))[0];
1.110 - adpcm_yamaha_decode_nibble( &audio.channels[channel], data & 0x0F );
1.111 + audio.channels[channel].adpcm_step = 0;
1.112 + audio.channels[channel].adpcm_predict = 0;
1.113 + uint8_t data = ((uint8_t *)(arm_mem + audio.channels[channel].start))[0];
1.114 + adpcm_yamaha_decode_nibble( &audio.channels[channel], data & 0x0F );
1.115 }
1.116 }
.