From f0e733aed52590105b6a17130af5c26166eada6d Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Fri, 2 Dec 2005 08:54:38 +0000 Subject: Fixed recording peak meters to always work. Now it should be easy to add pre-recording support too. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8126 a1c6a512-1295-4272-9138-f99709370657 --- firmware/pcm_record.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'firmware/pcm_record.c') diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c index 0c10ea7b2e..d26a4d303a 100644 --- a/firmware/pcm_record.c +++ b/firmware/pcm_record.c @@ -342,12 +342,6 @@ void audio_resume_recording(void) void pcm_rec_get_peaks(int *left, int *right) { - if (!is_recording) - { - peak_left = 0; - peak_right = 0; - } - if (left) *left = peak_left; if (right) @@ -412,9 +406,6 @@ static void pcmrec_callback(bool flush) unsigned short *ptr; int i, j, w; - if ((!is_recording || is_paused) && !flush) - return; - w = write_index; num_new = w - read2_index; @@ -430,6 +421,12 @@ static void pcmrec_callback(bool flush) pcmrec_find_peaks(j); } + if ((!is_recording || is_paused) && !flush) + { + read_index = write_index; + return; + } + for (i=0; i= num_chunks) write_index = 0; - if (is_stopping || !is_recording) + if (is_stopping) { DCR1 = 0; /* Stop DMA transfer */ is_stopping = false; @@ -644,8 +641,6 @@ static void pcmrec_start(void) is_paused = false; is_recording = true; - pcmrec_dma_start(); - record_done = true; } @@ -680,6 +675,9 @@ static void pcmrec_stop(void) stop_done = true; + /* Finally start dma again for peakmeters and pre-recoding to work. */ + pcmrec_dma_start(); + logf("pcmrec_stop done"); } @@ -829,6 +827,8 @@ static void pcmrec_init(void) ICR7 = 0x1c; /* Enable interrupt at level 7, priority 0 */ IMR &= ~(1<<15); /* bit 15 is DMA1 */ + pcmrec_dma_start(); + init_done = 1; } -- cgit v1.2.3