diff options
author | Max Kellermann <max@duempel.org> | 2010-05-02 15:31:31 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-05-02 17:46:07 +0200 |
commit | 5399a72ec1141307e79970993e4a90a8d643ac50 (patch) | |
tree | 87f3ecbbb6c4875f2754dd72b0a577a7b81d652d /src/player_thread.c | |
parent | d093fb2441ee99722670f0401215031fc324bb31 (diff) | |
download | mpd-5399a72ec1141307e79970993e4a90a8d643ac50.tar.gz mpd-5399a72ec1141307e79970993e4a90a8d643ac50.tar.xz mpd-5399a72ec1141307e79970993e4a90a8d643ac50.zip |
player_thread: move cross-fading to output thread
Remove cross_fade_apply(), and call pcm_mix() in the output thread,
mixing the chunk and chunk->other together.
Diffstat (limited to 'src/player_thread.c')
-rw-r--r-- | src/player_thread.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/player_thread.c b/src/player_thread.c index 8fa089c1f..1a420a7fa 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -651,10 +651,9 @@ play_next_chunk(struct player *player) } if (other_chunk != NULL) { - float mix_ratio; - chunk = music_pipe_shift(player->pipe); assert(chunk != NULL); + assert(chunk->other == NULL); /* don't send the tags of the new song (which is being faded in) yet; postpone it until @@ -665,16 +664,13 @@ play_next_chunk(struct player *player) other_chunk->tag = NULL; if (isnan(pc.mixramp_delay_seconds)) { - mix_ratio = ((float)cross_fade_position) + chunk->mix_ratio = ((float)cross_fade_position) / player->cross_fade_chunks; } else { - mix_ratio = nan(""); + chunk->mix_ratio = nan(""); } - cross_fade_apply(chunk, other_chunk, - &dc->out_audio_format, - mix_ratio); - music_buffer_return(player_buffer, other_chunk); + chunk->other = other_chunk; } else { /* there are not enough decoded chunks yet */ |