forked from len0rd/rockbox
Fixed a division by zero problem with simulator when crossfade is
disabled. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8245 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6d89649c42
commit
07fd5d9534
1 changed files with 9 additions and 4 deletions
|
@ -442,7 +442,9 @@ static void crossfade_start(void)
|
|||
break ;
|
||||
|
||||
case CFM_FLUSH:
|
||||
crossfade_rem = bytesleft /2;
|
||||
crossfade_rem = (bytesleft - CHUNK_SIZE) /2;
|
||||
crossfade_fade_in_rem = 0;
|
||||
crossfade_fade_in_amount = 0;
|
||||
break ;
|
||||
}
|
||||
|
||||
|
@ -537,9 +539,12 @@ int crossfade(short *buf, const short *buf2, int length)
|
|||
crossfade_rem -= size;
|
||||
if (crossfade_rem <= 0)
|
||||
{
|
||||
size_insert = MAX(0, MIN(crossfade_fade_in_rem, length - size));
|
||||
fade_insert(&buf2[size], size_insert*2);
|
||||
crossfade_fade_in_rem -= size_insert;
|
||||
if (crossfade_fade_in_rem > 0 && crossfade_fade_in_amount > 0)
|
||||
{
|
||||
size_insert = MAX(0, MIN(crossfade_fade_in_rem, length - size));
|
||||
fade_insert(&buf2[size], size_insert*2);
|
||||
crossfade_fade_in_rem -= size_insert;
|
||||
}
|
||||
|
||||
if (crossfade_fade_in_rem <= 0)
|
||||
crossfade_active = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue