Commit a5464282 authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

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
parent b89b0197
...@@ -371,11 +371,9 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * ...@@ -371,11 +371,9 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
1=enabled; -1=disabled */ 1=enabled; -1=disabled */
int doCrossFade = 0; int doCrossFade = 0;
unsigned int crossFadeChunks = 0; unsigned int crossFadeChunks = 0;
unsigned int fadePosition;
/** the position of the next cross-faded chunk in the next /** the position of the next cross-faded chunk in the next
song */ song */
int nextChunk = -1; int nextChunk = -1;
unsigned int test;
int decodeWaitedOn = 0; int decodeWaitedOn = 0;
static const char silence[CHUNK_SIZE]; static const char silence[CHUNK_SIZE];
double sizeToTime = 0.0; double sizeToTime = 0.0;
...@@ -496,6 +494,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * ...@@ -496,6 +494,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
if (pause) if (pause)
player_sleep(); player_sleep();
else if (cb->begin != end && cb->begin != next) { else if (cb->begin != end && cb->begin != next) {
unsigned int fadePosition;
if (doCrossFade == 1 && next >= 0 && if (doCrossFade == 1 && next >= 0 &&
((next > cb->begin && ((next > cb->begin &&
(fadePosition = next - cb->begin) (fadePosition = next - cb->begin)
...@@ -504,6 +503,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * ...@@ -504,6 +503,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
(fadePosition = next - cb->begin + (fadePosition = next - cb->begin +
buffered_chunks) <= crossFadeChunks))) { buffered_chunks) <= crossFadeChunks))) {
/* perform cross fade */ /* perform cross fade */
unsigned int test = end;
if (nextChunk < 0) { if (nextChunk < 0) {
/* beginning of the cross fade /* beginning of the cross fade
- adjust crossFadeChunks - adjust crossFadeChunks
...@@ -512,7 +512,6 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * ...@@ -512,7 +512,6 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
chunks in the old song */ chunks in the old song */
crossFadeChunks = fadePosition; crossFadeChunks = fadePosition;
} }
test = end;
if (end < cb->begin) if (end < cb->begin)
test += buffered_chunks; test += buffered_chunks;
nextChunk = cb->begin + crossFadeChunks; nextChunk = cb->begin + crossFadeChunks;
...@@ -576,8 +575,8 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * ...@@ -576,8 +575,8 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
/* the cross-fade is finished; skip /* the cross-fade is finished; skip
the section which was cross-faded the section which was cross-faded
(and thus already played) */ (and thus already played) */
unsigned int test = end;
nextChunk = cb->begin + crossFadeChunks; nextChunk = cb->begin + crossFadeChunks;
test = end;
if (end < cb->begin) if (end < cb->begin)
test += buffered_chunks; test += buffered_chunks;
if ((unsigned)nextChunk < test) { if ((unsigned)nextChunk < test) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment