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
This commit is contained in:
Miika Pekkarinen 2005-12-02 08:54:38 +00:00
parent 727eab12b3
commit f0e733aed5

View file

@ -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_new; i++)
{
/* Convert the samples to little-endian so we only have to write later
@ -531,7 +528,7 @@ void DMA1(void)
if (write_index >= 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;
}