diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index df3c689c13..0976a57467 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -366,7 +366,7 @@ bool radio_screen(void) audio_stop(); #if CONFIG_CODEC != SWCODEC - audio_init_recording(); + audio_init_recording(talk_get_bufsize()); sound_settings_apply(); /* Yes, we use the D/A for monitoring */ diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 0d414292b2..f4a3580123 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -552,7 +552,7 @@ bool recording_screen(void) #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) ata_set_led_enabled(false); #endif - audio_init_recording(); + audio_init_recording(talk_get_bufsize()); sound_set_volume(global_settings.volume); @@ -1555,8 +1555,9 @@ void audio_beep(int duration) #ifdef SIMULATOR /* stubs for recording sim */ -void audio_init_recording(void) +void audio_init_recording(unsigned int buffer_offset) { + buffer_offset = buffer_offset; } void audio_close_recording(void) diff --git a/firmware/export/audio.h b/firmware/export/audio.h index 3ed1323701..6922dab1f6 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h @@ -87,7 +87,7 @@ void audio_beep(int duration); void audio_init_playback(void); /* audio recording functions */ -void audio_init_recording(void); +void audio_init_recording(unsigned int buffer_offset); void audio_close_recording(void); void audio_record(const char *filename); void audio_stop_recording(void); diff --git a/firmware/mpeg.c b/firmware/mpeg.c index c47c279d24..7034f3896b 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -2127,8 +2127,9 @@ void audio_init_playback(void) /**************************************************************************** * Recording functions ***************************************************************************/ -void audio_init_recording(void) +void audio_init_recording(unsigned int buffer_offset) { + buffer_offset = buffer_offset; init_recording_done = false; queue_post(&mpeg_queue, MPEG_INIT_RECORDING, NULL); @@ -2652,9 +2653,10 @@ void audio_set_recording_gain(int left, int right, int type) (void)right; (void)type; } -void audio_init_recording(void) +void audio_init_recording(unsigned int buffer_offset) { /* a dummy */ + (void)buffer_offset; } void audio_set_recording_options(int frequency, int quality, int source, int channel_mode, diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c index 8d34b345c8..a7d8bc707c 100644 --- a/firmware/pcm_record.c +++ b/firmware/pcm_record.c @@ -82,6 +82,7 @@ static short peak_left, peak_right; #define GET_CHUNK(x) (short*)(&rec_buffer[CHUNK_SIZE*(x)]) +static unsigned int rec_buffer_offset; static unsigned char *rec_buffer; /* Circular recording buffer */ static int num_chunks; /* Number of chunks available in rec_buffer */ @@ -136,8 +137,9 @@ void pcm_rec_init(void) * - Prepare for DMA transfers */ -void audio_init_recording(void) +void audio_init_recording(unsigned int buffer_offset) { + rec_buffer_offset = buffer_offset; init_done = false; queue_post(&pcmrec_queue, PCMREC_INIT, 0); @@ -820,8 +822,8 @@ static void pcmrec_init(void) is_paused = false; is_error = false; - rec_buffer = (unsigned char*)(((unsigned long)audiobuf + talk_get_bufsize()) & ~3); - buffer_size = (long)audiobufend - (long)audiobuf - talk_get_bufsize() - 16; + rec_buffer = (unsigned char*)(((unsigned long)audiobuf + rec_buffer_offset) & ~3); + buffer_size = (long)audiobufend - (long)audiobuf - rec_buffer_offset - 16; logf("buf size: %d kb", buffer_size/1024);