Commit 46c66a2a authored by Warren Dukes's avatar Warren Dukes

a few cleanups

git-svn-id: https://svn.musicpd.org/mpd/trunk@53 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 1ff12306
...@@ -93,10 +93,12 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) { ...@@ -93,10 +93,12 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) {
chunks = (af->sampleRate*af->bits*af->channels/8.0/CHUNK_SIZE); chunks = (af->sampleRate*af->bits*af->channels/8.0/CHUNK_SIZE);
chunks = (chunks*pc->crossFade+0.5); chunks = (chunks*pc->crossFade+0.5);
if(chunks>BUFFERED_CHUNKS-buffered_before_play) { if(chunks>(BUFFERED_CHUNKS-buffered_before_play)) {
chunks = BUFFERED_CHUNKS-buffered_before_play; chunks = BUFFERED_CHUNKS-buffered_before_play;
} }
if(chunks<0) chunks = 0;
return chunks; return chunks;
} }
...@@ -338,7 +340,7 @@ void decode() { ...@@ -338,7 +340,7 @@ void decode() {
(fadePosition=cb->next-cb->begin+ (fadePosition=cb->next-cb->begin+
BUFFERED_CHUNKS)<=crossFadeChunks))) BUFFERED_CHUNKS)<=crossFadeChunks)))
{ {
if(nextChunk==-1) { if(nextChunk<0) {
crossFadeChunks = fadePosition; crossFadeChunks = fadePosition;
} }
nextChunk = cb->begin+crossFadeChunks; nextChunk = cb->begin+crossFadeChunks;
......
...@@ -27,9 +27,13 @@ ...@@ -27,9 +27,13 @@
extern int logLevel; extern int logLevel;
#define ERROR(x, arg...) myfprintf(stderr, x , ##arg) #define ERROR(x, arg...) do { \
myfprintf(stderr, x , ##arg); \
} while(0);
#define LOG(x, arg...) myfprintf(stdout, x , ##arg) #define LOG(x, arg...) do { \
myfprintf(stdout, x , ##arg); \
} while(0);
#define SECURE(x, arg...) do { \ #define SECURE(x, arg...) do { \
if(logLevel>=LOG_LEVEL_SECURE) myfprintf(stdout, x , ##arg); \ if(logLevel>=LOG_LEVEL_SECURE) myfprintf(stdout, x , ##arg); \
......
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