make variables more local
Declare the variables "test" and "fadePosition" in the scope where they are really used. This removes some of the clutter in the function decodeParent(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7261 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
b89b019723
commit
a546428263
@ -371,11 +371,9 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
||||
1=enabled; -1=disabled */
|
||||
int doCrossFade = 0;
|
||||
unsigned int crossFadeChunks = 0;
|
||||
unsigned int fadePosition;
|
||||
/** the position of the next cross-faded chunk in the next
|
||||
song */
|
||||
int nextChunk = -1;
|
||||
unsigned int test;
|
||||
int decodeWaitedOn = 0;
|
||||
static const char silence[CHUNK_SIZE];
|
||||
double sizeToTime = 0.0;
|
||||
@ -496,6 +494,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
||||
if (pause)
|
||||
player_sleep();
|
||||
else if (cb->begin != end && cb->begin != next) {
|
||||
unsigned int fadePosition;
|
||||
if (doCrossFade == 1 && next >= 0 &&
|
||||
((next > cb->begin &&
|
||||
(fadePosition = next - cb->begin)
|
||||
@ -504,6 +503,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
||||
(fadePosition = next - cb->begin +
|
||||
buffered_chunks) <= crossFadeChunks))) {
|
||||
/* perform cross fade */
|
||||
unsigned int test = end;
|
||||
if (nextChunk < 0) {
|
||||
/* beginning of the cross fade
|
||||
- adjust crossFadeChunks
|
||||
@ -512,7 +512,6 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
||||
chunks in the old song */
|
||||
crossFadeChunks = fadePosition;
|
||||
}
|
||||
test = end;
|
||||
if (end < cb->begin)
|
||||
test += buffered_chunks;
|
||||
nextChunk = cb->begin + crossFadeChunks;
|
||||
@ -576,8 +575,8 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
|
||||
/* the cross-fade is finished; skip
|
||||
the section which was cross-faded
|
||||
(and thus already played) */
|
||||
unsigned int test = end;
|
||||
nextChunk = cb->begin + crossFadeChunks;
|
||||
test = end;
|
||||
if (end < cb->begin)
|
||||
test += buffered_chunks;
|
||||
if ((unsigned)nextChunk < test) {
|
||||
|
Loading…
Reference in New Issue
Block a user