forked from len0rd/rockbox
Fixed track changing problems.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7201 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
30b8378b68
commit
d83b659fa7
2 changed files with 21 additions and 25 deletions
|
|
@ -85,7 +85,7 @@ volatile int pcmbuf_write_index;
|
|||
int pcmbuf_unplayed_bytes;
|
||||
int pcmbuf_watermark;
|
||||
void (*pcmbuf_watermark_event)(int bytes_left);
|
||||
static int last_chunksize;
|
||||
//static int last_chunksize;
|
||||
|
||||
static void pcmbuf_boost(bool state)
|
||||
{
|
||||
|
|
@ -110,11 +110,6 @@ int pcmbuf_num_used_buffers(void)
|
|||
static void pcmbuf_callback(unsigned char** start, long* size)
|
||||
{
|
||||
struct pcmbufdesc *desc = &pcmbuffers[pcmbuf_read_index];
|
||||
int sz;
|
||||
|
||||
pcmbuf_unplayed_bytes -= last_chunksize;
|
||||
audiobuffer_free += last_chunksize;
|
||||
|
||||
|
||||
if(desc->size == 0)
|
||||
{
|
||||
|
|
@ -129,17 +124,15 @@ static void pcmbuf_callback(unsigned char** start, long* size)
|
|||
|
||||
if(pcmbuf_num_used_buffers())
|
||||
{
|
||||
/* Play max 64K at a time */
|
||||
//sz = MIN(desc->size, 32768);
|
||||
sz = desc->size;
|
||||
pcmbuf_unplayed_bytes -= desc->size;
|
||||
audiobuffer_free += desc->size;
|
||||
|
||||
*start = desc->addr;
|
||||
*size = sz;
|
||||
*size = desc->size;
|
||||
|
||||
/* Update the buffer descriptor */
|
||||
desc->size -= sz;
|
||||
desc->addr += sz;
|
||||
|
||||
last_chunksize = sz;
|
||||
desc->addr += desc->size;
|
||||
desc->size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -243,7 +236,7 @@ bool pcmbuf_crossfade_init(void)
|
|||
void pcmbuf_play_stop(void)
|
||||
{
|
||||
pcm_play_stop();
|
||||
last_chunksize = 0;
|
||||
//last_chunksize = 0;
|
||||
pcmbuf_unplayed_bytes = 0;
|
||||
pcmbuf_read_index = 0;
|
||||
pcmbuf_write_index = 0;
|
||||
|
|
@ -278,6 +271,7 @@ void pcmbuf_flush_audio(void)
|
|||
return ;
|
||||
}
|
||||
|
||||
pcmbuf_boost(true);
|
||||
crossfade_mode = CFM_FLUSH;
|
||||
crossfade_init = true;
|
||||
}
|
||||
|
|
@ -296,7 +290,8 @@ void pcmbuf_flush_fillpos(void)
|
|||
/* This is a fatal error situation that should never happen. */
|
||||
if (!pcm_is_playing()) {
|
||||
logf("pcm_flush_fillpos error");
|
||||
break ;
|
||||
pcm_play_data(pcmbuf_callback);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
pcmbuf_event_handler = NULL;
|
||||
|
|
@ -320,7 +315,7 @@ static void crossfade_start(void)
|
|||
}
|
||||
|
||||
logf("crossfade_start");
|
||||
pcmbuf_flush_fillpos();
|
||||
audiobuffer_fillpos = 0;
|
||||
pcmbuf_boost(true);
|
||||
crossfade_active = true;
|
||||
crossfade_pos = audiobuffer_pos;
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ void codec_advance_buffer_callback(long amount)
|
|||
if (amount > cur_ti->available + cur_ti->filerem)
|
||||
amount = cur_ti->available + cur_ti->filerem;
|
||||
|
||||
if (amount > cur_ti->available) {
|
||||
if (amount > cur_ti->available && !filling) {
|
||||
if (!rebuffer_and_seek(ci.curpos + amount))
|
||||
ci.stop_codec = true;
|
||||
return ;
|
||||
|
|
@ -1346,16 +1346,16 @@ static void initiate_track_change(int peek_index)
|
|||
if (!playlist_check(peek_index))
|
||||
return ;
|
||||
|
||||
new_track = peek_index;
|
||||
ci.reload_codec = true;
|
||||
|
||||
/* Detect if disk is spinning.. */
|
||||
if (filling) {
|
||||
ci.stop_codec = true;
|
||||
playlist_next(peek_index);
|
||||
queue_post(&audio_queue, AUDIO_PLAY, 0);
|
||||
} else {
|
||||
pcmbuf_crossfade_init();
|
||||
new_track = peek_index;
|
||||
ci.reload_codec = true;
|
||||
if (!pcmbuf_is_crossfade_enabled())
|
||||
pcmbuf_flush_audio();
|
||||
}
|
||||
|
||||
codec_track_changed();
|
||||
|
|
@ -1384,8 +1384,9 @@ void audio_thread(void)
|
|||
ci.stop_codec = true;
|
||||
ci.reload_codec = false;
|
||||
ci.seek_time = 0;
|
||||
if (!pcmbuf_is_crossfade_active())
|
||||
pcmbuf_crossfade_init();
|
||||
while (codec_loaded)
|
||||
yield();
|
||||
audio_play_start((int)ev.data);
|
||||
playlist_update_resume_info(audio_current_track());
|
||||
break ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue