Search
lxdream.org :: lxdream/src/aica/audio.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/aica/audio.c
changeset 465:3bd7be575792
prev463:0655796f9bb5
next531:f0fee3ba71d1
author nkeynes
date Sat Oct 27 05:47:21 2007 +0000 (14 years ago)
permissions -rw-r--r--
last change Fix AICA save state section to include the current audio + IO state
file annotate diff log raw
1.1 --- a/src/aica/audio.c Wed Oct 24 21:24:09 2007 +0000
1.2 +++ b/src/aica/audio.c Sat Oct 27 05:47:21 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: audio.c,v 1.10 2007-10-24 21:24:09 nkeynes Exp $
1.6 + * $Id: audio.c,v 1.11 2007-10-27 05:47:21 nkeynes Exp $
1.7 *
1.8 * Audio mixer core. Combines all the active streams into a single sound
1.9 * buffer for output.
1.10 @@ -38,7 +38,7 @@
1.11 uint32_t output_format;
1.12 uint32_t output_rate;
1.13 uint32_t output_sample_size;
1.14 - struct audio_channel channels[64];
1.15 + struct audio_channel channels[AUDIO_CHANNEL_COUNT];
1.16 } audio;
1.17
1.18 audio_driver_t audio_driver = NULL;
1.19 @@ -48,6 +48,20 @@
1.20 extern char *arm_mem;
1.21
1.22 /**
1.23 + * Preserve audio channel state only - don't bother saving the buffers
1.24 + */
1.25 +void audio_save_state( FILE *f )
1.26 +{
1.27 + fwrite( &audio.channels[0], sizeof(struct audio_channel), AUDIO_CHANNEL_COUNT, f );
1.28 +}
1.29 +
1.30 +int audio_load_state( FILE *f )
1.31 +{
1.32 + int read = fread( &audio.channels[0], sizeof(struct audio_channel), AUDIO_CHANNEL_COUNT, f );
1.33 + return (read == AUDIO_CHANNEL_COUNT ? 0 : -1 );
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
1.39 * necessary.
1.40 @@ -189,7 +203,7 @@
1.41
1.42 memset( &result_buf, 0, sizeof(result_buf) );
1.43
1.44 - for( i=0; i < 64; i++ ) {
1.45 + for( i=0; i < AUDIO_CHANNEL_COUNT; i++ ) {
1.46 audio_channel_t channel = &audio.channels[i];
1.47 if( channel->active ) {
1.48 int32_t sample;
.