diff options
author | Tim Phipps <mpd@phipps-hutton.freeserve.co.uk> | 2010-03-21 18:21:47 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-03-21 18:21:47 +0100 |
commit | e7a515c8b11c643332406d60a13ab1fe06d2b226 (patch) | |
tree | aa7179b453b6fe7b163d1b4b807157359cb436cf /src/player_thread.c | |
parent | e9b75d462c4d0ffee3b3b26582800ec4f657a333 (diff) | |
download | mpd-e7a515c8b11c643332406d60a13ab1fe06d2b226.tar.gz mpd-e7a515c8b11c643332406d60a13ab1fe06d2b226.tar.xz mpd-e7a515c8b11c643332406d60a13ab1fe06d2b226.zip |
Add support for MixRamp tags
Adds mixrampdb and mixrampdelay commands. Reads MIXRAP_START and
MIXRAMP_END tags from FLAC files and overlaps instead of crossfading.
Diffstat (limited to 'src/player_thread.c')
-rw-r--r-- | src/player_thread.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/player_thread.c b/src/player_thread.c index 2496f0cdb..d3f5d7ccb 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -644,13 +644,21 @@ play_next_chunk(struct player *player) } if (other_chunk != NULL) { + float mix_ratio; + chunk = music_pipe_shift(player->pipe); assert(chunk != NULL); + if (isnan(pc.mixramp_delay_seconds)) { + mix_ratio = ((float)cross_fade_position) + / player->cross_fade_chunks; + } else { + mix_ratio = nan(""); + } + cross_fade_apply(chunk, other_chunk, &dc->out_audio_format, - cross_fade_position, - player->cross_fade_chunks); + mix_ratio); music_buffer_return(player_buffer, other_chunk); } else { /* there are not enough decoded chunks yet */ @@ -865,6 +873,10 @@ static void do_play(struct decoder_control *dc) for it */ player.cross_fade_chunks = cross_fade_calc(pc.cross_fade_seconds, dc->total_time, + pc.mixramp_db, + pc.mixramp_delay_seconds, + dc->mixramp_start, + dc->mixramp_prev_end, &dc->out_audio_format, &player.play_audio_format, music_buffer_size(player_buffer) - |