From 36c940555c7f5a4f991937ff5a4c2214b6323f8e Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sun, 17 Dec 2006 11:03:19 +0000 Subject: [PATCH] SWCODEC recording: More cleanup of stuff after queue additions and audio driver unification. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11783 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/audio.h | 5 ++ firmware/pcm_record.c | 58 +++++++++---------- firmware/target/coldfire/iaudio/x5/audio-x5.c | 15 +---- .../target/coldfire/iriver/audio-iriver.c | 15 +---- 4 files changed, 33 insertions(+), 60 deletions(-) diff --git a/firmware/export/audio.h b/firmware/export/audio.h index 6a98d6f4c5..716b1ad5d3 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h @@ -186,7 +186,12 @@ void audio_record(const char *filename); void audio_stop_recording(void); void audio_pause_recording(void); void audio_resume_recording(void); +#if CONFIG_CODEC == SWCODEC +static inline void audio_new_file(const char *filename) + { audio_record(filename); } +#else void audio_new_file(const char *filename); +#endif /* CONFIG_CODEC == SWCODEC */ void audio_set_recording_options(struct audio_recording_options *options); void audio_set_recording_gain(int left, int right, int type); unsigned long audio_recorded_time(void); diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c index 7aa81f35a0..f03939bd3c 100644 --- a/firmware/pcm_record.c +++ b/firmware/pcm_record.c @@ -19,18 +19,12 @@ #include "system.h" #include "kernel.h" #include "logf.h" -#include "panic.h" #include "thread.h" #include #include "ata.h" #include "usb.h" -#if defined(HAVE_UDA1380) -#include "uda1380.h" -#include "general.h" -#elif defined(HAVE_TLV320) -#include "tlv320.h" -#endif #include "buffer.h" +#include "general.h" #include "audio.h" #include "sound.h" #include "id3.h" @@ -45,7 +39,6 @@ * Public - * pcm_init_recording * pcm_close_recording - * pcm_rec_mux * Semi-private - * pcm_rec_dma_start * pcm_rec_dma_stop @@ -234,11 +227,10 @@ enum PCMREC_INIT, /* enable recording */ PCMREC_CLOSE, /* close recording */ PCMREC_OPTIONS, /* set recording options */ - PCMREC_START, /* start recording */ + PCMREC_RECORD, /* record a new file */ PCMREC_STOP, /* stop the current recording */ PCMREC_PAUSE, /* pause the current recording */ PCMREC_RESUME, /* resume the current recording */ - PCMREC_NEW_FILE, /* start new file */ #if 0 PCMREC_FLUSH_NUM, /* flush a number of files out */ #endif @@ -427,20 +419,10 @@ void audio_set_recording_options(struct audio_recording_options *options) void audio_record(const char *filename) { logf("audio_record: %s", filename); - queue_send(&pcmrec_queue, PCMREC_START, (void *)filename); + queue_send(&pcmrec_queue, PCMREC_RECORD, (void *)filename); logf("audio_record_done"); } /* audio_record */ -/** - * Equivalent to audio_record() - */ -void audio_new_file(const char *filename) -{ - logf("audio_new_file: %s", filename); - queue_send(&pcmrec_queue, PCMREC_NEW_FILE, (void *)filename); - logf("audio_new_file done"); -} /* audio_new_file */ - /** * Stop current recording if recording */ @@ -471,6 +453,19 @@ void audio_resume_recording(void) logf("audio_resume_recording done"); } /* audio_resume_recording */ +/** + * Note that microphone is mono, only left value is used + * See audiohw_set_recvol() for exact ranges. + * + * @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN + * + */ +void audio_set_recording_gain(int left, int right, int type) +{ + //logf("rcmrec: t=%d l=%d r=%d", type, left, right); + audiohw_set_recvol(left, right, type); +} /* audio_set_recording_gain */ + /** Information about current state **/ /** @@ -1203,14 +1198,14 @@ static void pcmrec_set_recording_options(struct audio_recording_options *options } } /* pcmrec_set_recording_options */ -/* PCMREC_START/PCMREC_NEW_FILE - start recording (not gapless) - or split stream (gapless) */ -static void pcmrec_start(const char *filename) +/* PCMREC_RECORD - start recording (not gapless) + or split stream (gapless) */ +static void pcmrec_record(const char *filename) { unsigned long pre_sample_ticks; int rd_start; - logf("pcmrec_start: %s", filename); + logf("pcmrec_record: %s", filename); /* reset stats */ num_rec_bytes = 0; @@ -1223,7 +1218,7 @@ static void pcmrec_start(const char *filename) pcmrec_new_stream(filename, CHUNKF_START_FILE | CHUNKF_END_FILE, 0); - goto start_done; + goto record_done; } #if 0 @@ -1299,9 +1294,9 @@ static void pcmrec_start(const char *filename) (pre_sample_ticks > 0 ? CHUNKF_PRERECORD : 0), enc_rd_index); -start_done: - logf("pcmrec_start done"); -} /* pcmrec_start */ +record_done: + logf("pcmrec_record done"); +} /* pcmrec_record */ /* PCMREC_STOP */ static void pcmrec_stop(void) @@ -1445,9 +1440,8 @@ static void pcmrec_thread(void) (struct audio_recording_options *)ev.data); break; - case PCMREC_START: - case PCMREC_NEW_FILE: - pcmrec_start((const char *)ev.data); + case PCMREC_RECORD: + pcmrec_record((const char *)ev.data); break; case PCMREC_STOP: diff --git a/firmware/target/coldfire/iaudio/x5/audio-x5.c b/firmware/target/coldfire/iaudio/x5/audio-x5.c index 0e2ba60c1d..23aaa42cd6 100644 --- a/firmware/target/coldfire/iaudio/x5/audio-x5.c +++ b/firmware/target/coldfire/iaudio/x5/audio-x5.c @@ -19,20 +19,7 @@ #include "system.h" #include "cpu.h" #include "audio.h" -#include "tlv320.h" - -/** - * Note that microphone is mono, only left value is used - * See audiohw_set_recvol() for exact ranges. - * - * @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN - * - */ -void audio_set_recording_gain(int left, int right, int type) -{ - //logf("rcmrec: t=%d l=%d r=%d", type, left, right); - audiohw_set_recvol(left, right, type); -} /* audio_set_recording_gain */ +#include "sound.h" void audio_set_output_source(int source) { diff --git a/firmware/target/coldfire/iriver/audio-iriver.c b/firmware/target/coldfire/iriver/audio-iriver.c index 5a5e80bc46..751025d08a 100644 --- a/firmware/target/coldfire/iriver/audio-iriver.c +++ b/firmware/target/coldfire/iriver/audio-iriver.c @@ -19,20 +19,7 @@ #include "system.h" #include "cpu.h" #include "audio.h" -#include "uda1380.h" - -/** - * Note that microphone is mono, only left value is used - * See audiohw_set_recvol() for exact ranges. - * - * @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN - * - */ -void audio_set_recording_gain(int left, int right, int type) -{ - //logf("rcmrec: t=%d l=%d r=%d", type, left, right); - audiohw_set_recvol(left, right, type); -} /* audio_set_recording_gain */ +#include "sound.h" void audio_set_output_source(int source) {