1
0
Fork 0
forked from len0rd/rockbox

Fix weirdness caused by not stopping buffering during pause, and generally use a more sane pause behavior on swcodec targets

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9221 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Brandon Low 2006-03-24 02:38:57 +00:00
parent 354941d966
commit 8307d0b388
2 changed files with 108 additions and 92 deletions

View file

@ -390,8 +390,11 @@ static void pcmbuf_flush_audio(void)
}
void pcmbuf_pause(bool pause) {
pcm_mute(pause);
if (pause)
pcm_mute(true);
pcm_play_pause(!pause);
if (!pause)
pcm_mute(false);
pcmbuf_boost(!pause);
}

View file

@ -61,9 +61,6 @@ static bool pcm_playing;
static bool pcm_paused;
static int pcm_freq = 0x6; /* 44.1 is default */
size_t next_size IBSS_ATTR;
unsigned char *next_start IBSS_ATTR;
/* Set up the DMA transfer that kicks in when the audio FIFO gets empty */
static void dma_start(const void *addr, size_t size)
{
@ -103,8 +100,6 @@ static void dma_stop(void)
#ifdef HAVE_SPDIF_OUT
EBU1CONFIG = IIS_RESET | EBU_DEFPARM;
#endif
pcm_paused = false;
}
/* sets frequency of input to DAC */
@ -150,7 +145,13 @@ void pcm_play_data(void (*get_more)(unsigned char** start, size_t* size),
return;
}
if (start && size)
{
dma_start(start, size);
if (pcm_paused) {
pcm_paused = false;
pcm_play_pause(false);
}
}
}
size_t pcm_get_bytes_waiting(void)
@ -176,12 +177,18 @@ void pcm_play_stop(void)
void pcm_play_pause(bool play)
{
if (!pcm_playing)
return ;
size_t next_size;
unsigned char *next_start;
bool needs_change = pcm_paused == play;
if(pcm_paused && play)
/* This must be done ahead of the rest of the function to prevent
* infinite recursion in dma_start */
pcm_paused = !play;
if (pcm_playing && needs_change)
{
if (BCR0 & 0xffffff)
if(play)
{
if (pcm_get_bytes_waiting())
{
logf("unpause");
/* Enable the FIFO and force one write to it */
@ -206,7 +213,7 @@ void pcm_play_pause(bool play)
}
}
}
else if(!pcm_paused && !play)
else
{
logf("pause");
@ -217,7 +224,7 @@ void pcm_play_pause(bool play)
EBU1CONFIG = IIS_RESET | EBU_DEFPARM;
#endif
}
pcm_paused = !play;
}
}
bool pcm_is_paused(void)
@ -247,6 +254,8 @@ void DMA0(void)
}
else
{
size_t next_size;
unsigned char *next_start;
{
void (*get_more)(unsigned char**, size_t*) = callback_for_more;
if (get_more)
@ -412,8 +421,6 @@ static void dma_stop(void)
#endif
disable_fiq();
pcm_paused = false;
}
void pcm_set_frequency(unsigned int frequency)
@ -436,8 +443,13 @@ void pcm_play_data(void (*get_more)(unsigned char** start, size_t* size),
else
return;
}
if (start && size)
if (start && size) {
dma_start(start, size);
if (pcm_paused) {
pcm_paused = false;
pcm_play_pause(false);
}
}
}
size_t pcm_get_bytes_waiting(void)
@ -464,10 +476,13 @@ void pcm_play_pause(bool play)
size_t next_size;
unsigned char *next_start;
if (!pcm_playing)
return ;
if(pcm_paused && play)
bool needs_change = pcm_paused == play;
/* This needs to be done ahead of the rest to prevent infinite
* recursion from dma_start */
pcm_paused = !play;
if (pcm_playing && needs_change)
{
if(play)
{
if (pcm_get_bytes_waiting())
{
@ -516,7 +531,7 @@ void pcm_play_pause(bool play)
}
}
}
else if(!pcm_paused && !play)
else
{
logf("pause");
@ -539,7 +554,7 @@ void pcm_play_pause(bool play)
disable_fiq();
}
pcm_paused = !play;
}
}
bool pcm_is_paused(void)
@ -615,8 +630,6 @@ void fiq(void)
"mrs r10, cpsr \n\t"
"orr r10, r10, #0x40 \n\t" /* disable FIQ */
"msr cpsr_c, r10 \n\t"
"ldr r10, =pcm_paused \n\t"
"strb r8, [r10] \n\t" /* pcm_paused = false */
".exit: \n\t"
"str r8, [r11, #4] \n\t"
"str r9, [r11] \n\t"