aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-10 18:51:29 +0100
committerMax Kellermann <max@duempel.org>2009-02-10 18:51:29 +0100
commit2a388c2aa7c414b525c95de9b81a837b8da54ea7 (patch)
treef72d9ba3912087f60b2abdfbb372b9cf549fbeb8 /src
parent34244398d01b4182558f45c6363be62d37c29b50 (diff)
downloadmpd-2a388c2aa7c414b525c95de9b81a837b8da54ea7.tar.gz
mpd-2a388c2aa7c414b525c95de9b81a837b8da54ea7.tar.xz
mpd-2a388c2aa7c414b525c95de9b81a837b8da54ea7.zip
crossfade: don't use isCurrentAudioFormat()
The crossfading code shouldn't depend on the audio output code. Pass the current audio format to cross_fade_calc() and let it compare directly, instead of using isCurrentAudioFormat().
Diffstat (limited to '')
-rw-r--r--src/crossfade.c5
-rw-r--r--src/crossfade.h1
-rw-r--r--src/player_thread.c1
3 files changed, 5 insertions, 2 deletions
diff --git a/src/crossfade.c b/src/crossfade.c
index a21b05fa2..fb3515fc4 100644
--- a/src/crossfade.c
+++ b/src/crossfade.c
@@ -18,7 +18,6 @@
*/
#include "crossfade.h"
-#include "audio.h"
#include "pcm_mix.h"
#include "pipe.h"
#include "audio_format.h"
@@ -29,12 +28,14 @@
unsigned cross_fade_calc(float duration, float total_time,
const struct audio_format *af,
+ const struct audio_format *old_format,
unsigned max_chunks)
{
unsigned int chunks;
if (duration <= 0 || duration >= total_time ||
- !isCurrentAudioFormat(af))
+ /* we can't crossfade when the audio formats are different */
+ !audio_format_equals(af, old_format))
return 0;
assert(duration > 0);
diff --git a/src/crossfade.h b/src/crossfade.h
index 34ddcb433..31495f806 100644
--- a/src/crossfade.h
+++ b/src/crossfade.h
@@ -25,6 +25,7 @@ struct music_chunk;
unsigned cross_fade_calc(float duration, float total_time,
const struct audio_format *af,
+ const struct audio_format *old_format,
unsigned max_chunks);
void cross_fade_apply(struct music_chunk *a, const struct music_chunk *b,
diff --git a/src/player_thread.c b/src/player_thread.c
index b1b08c52d..239fbab2d 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -403,6 +403,7 @@ static void do_play(void)
crossFadeChunks =
cross_fade_calc(pc.cross_fade_seconds, dc.total_time,
&dc.out_audio_format,
+ &play_audio_format,
music_pipe_size() -
pc.buffered_before_play);
if (crossFadeChunks > 0) {