diff --git a/LICENSE.txt b/LICENSE.txt index cbf3eb1..8bb3cc5 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ Squeezelite - lightweight headless squeezebox emulator -(c) Adrian Smith 2012, 2013, triode1@btinternet.com +(c) Adrian Smith 2012-2014, triode1@btinternet.com Released under GPLv3 license: diff --git a/buffer.c b/buffer.c index 9b3c06a..814b012 100644 --- a/buffer.c +++ b/buffer.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/decode.c b/decode.c index 4707f83..316085d 100644 --- a/decode.c +++ b/decode.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/dop.c b/dop.c index fbc77f9..580dd38 100644 --- a/dop.c +++ b/dop.c @@ -81,9 +81,10 @@ } } -void dop_init(bool enable) { +void dop_init(bool enable, unsigned delay) { LOCK_O; output.has_dop = enable; + output.dop_delay = delay; UNLOCK_O; } diff --git a/dsd.c b/dsd.c index b2f3c7b..691d9cc 100644 --- a/dsd.c +++ b/dsd.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -215,8 +215,8 @@ unsigned bytes_per_frame = dop ? 2 : 1; if (bytes < d->block_size * d->channels) { - LOG_WARN("stream too short"); - return DECODE_ERROR; + LOG_INFO("stream too short"); // this can occur when scanning the track + return DECODE_COMPLETE; } IF_PROCESS( diff --git a/faad.c b/faad.c index 84d558e..7a2fb72 100644 --- a/faad.c +++ b/faad.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/ffmpeg.c b/ffmpeg.c index 87b88be..bc63381 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/mad.c b/mad.c index 255bbd8..e355134 100644 --- a/mad.c +++ b/mad.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/main.c b/main.c index a69e26a..c0be743 100644 --- a/main.c +++ b/main.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ #include -#define TITLE "Squeezelite " VERSION ", Copyright 2012, 2013 Adrian Smith." +#define TITLE "Squeezelite " VERSION ", Copyright 2012-2014 Adrian Smith." static void usage(const char *argv0) { printf(TITLE " See -t for license terms\n" @@ -68,7 +68,7 @@ " \t\t\t phase_response = 0-100 (0 = minimum / 50 = linear / 100 = maximum)\n" #endif #if DSD - " -D\t\t\tOutput device supports DSD over PCM (DoP)\n" + " -D [delay]\t\tOutput device supports DSD over PCM (DoP), delay = optional delay switching between PCM and DoP in ms\n" #endif #if VISEXPORT " -v \t\t\tVisulizer support\n" @@ -169,6 +169,7 @@ #endif #if DSD bool dop = false; + unsigned dop_delay = 0; #endif #if VISEXPORT bool visexport = false; @@ -331,6 +332,9 @@ #if DSD case 'D': dop = true; + if (optind < argc && argv[optind] && argv[optind][0] != '-') { + dop_delay = atoi(argv[optind++]); + } break; #endif #if VISEXPORT @@ -406,7 +410,7 @@ } #if DSD - dop_init(dop); + dop_init(dop, dop_delay); #endif #if VISEXPORT diff --git a/mpg.c b/mpg.c index 774b566..9e1010c 100644 --- a/mpg.c +++ b/mpg.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/output.c b/output.c index cbf4aa7..2b4aa3f 100644 --- a/output.c +++ b/output.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -119,16 +119,33 @@ if (output.track_start && !silence) { if (output.track_start == outputbuf->readp) { + frames -= size; + IF_DSD( + if (output.dop != output.next_dop) { + if (output.dop_delay) { + // add silence delay in two halves, before and after track start and pcm-dop change + if (!output.dop_delay_active) { + output.pause_frames = output.current_sample_rate * output.dop_delay / 2000; + output.dop_delay_active = true; // first delay - don't process track start + break; + } else { + output.pause_frames = output.next_sample_rate * output.dop_delay / 2000; + output.dop_delay_active = false; // second delay - process track start + } + output.state = OUTPUT_PAUSE_FRAMES; + } + } + output.dop = output.next_dop; + ) LOG_INFO("track start sample rate: %u replay_gain: %u", output.next_sample_rate, output.next_replay_gain); output.frames_played = 0; output.track_started = true; output.current_sample_rate = output.next_sample_rate; - IF_DSD( output.dop = output.next_dop; ) if (!output.fade == FADE_ACTIVE || !output.fade_mode == FADE_CROSSFADE) { output.current_replay_gain = output.next_replay_gain; } output.track_start = NULL; - continue; + break; } else if (output.track_start > outputbuf->readp) { // reduce cont_frames so we find the next track start at beginning of next chunk cont_frames = min(cont_frames, (output.track_start - outputbuf->readp) / BYTES_PER_FRAME); @@ -397,6 +414,7 @@ if (output.error_opening) { output.current_sample_rate = output.default_sample_rate; } + IF_DSD( output.dop_delay_active = false; ) } output.frames_played = 0; UNLOCK; diff --git a/output_alsa.c b/output_alsa.c index 65ab64f..5526999 100644 --- a/output_alsa.c +++ b/output_alsa.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -532,6 +532,7 @@ continue; } LOG_INFO("start error: %s", snd_strerror(err)); + usleep(10000); } } else { start = false; diff --git a/output_pa.c b/output_pa.c index df049af..8d02791 100644 --- a/output_pa.c +++ b/output_pa.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/output_pack.c b/output_pack.c index 744cc8d..ed7845c 100644 --- a/output_pack.c +++ b/output_pack.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/output_stdout.c b/output_stdout.c index 4be963b..e72a927 100644 --- a/output_stdout.c +++ b/output_stdout.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/output_vis.c b/output_vis.c index 7e0967a..35a2cbc 100644 --- a/output_vis.c +++ b/output_vis.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/pcm.c b/pcm.c index 1ea070b..c59ea5b 100644 --- a/pcm.c +++ b/pcm.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/process.c b/process.c index 907f804..67ca3c2 100644 --- a/process.c +++ b/process.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/resample.c b/resample.c index 3290dc9..2f6fc11 100644 --- a/resample.c +++ b/resample.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/slimproto.c b/slimproto.c index d0c570c..629cec4 100644 --- a/slimproto.c +++ b/slimproto.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/slimproto.h b/slimproto.h index 7133dff..77f197d 100644 --- a/slimproto.h +++ b/slimproto.h @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/squeezelite.h b/squeezelite.h index 92f6fd5..4e74758 100644 --- a/squeezelite.h +++ b/squeezelite.h @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ // make may define: PORTAUDIO, SELFPIPE, RESAMPLE, VISEXPORT, DSD, LINKALL to influence build -#define VERSION "v1.4" +#define VERSION "v1.5-dev" // build detection #if defined(linux) @@ -528,6 +528,8 @@ bool next_dop; // set in decode thread bool dop; bool has_dop; // set in dop_init - output device supports dop + unsigned dop_delay; // set in dop_init - delay in ms switching to/from dop + bool dop_delay_active; #endif }; @@ -581,7 +583,7 @@ bool is_flac_dop(u32_t *lptr, u32_t *rptr, frames_t frames); void update_dop_marker(u32_t *ptr, frames_t frames); void dop_silence_frames(u32_t *ptr, frames_t frames); -void dop_init(bool enable); +void dop_init(bool enable, unsigned delay); #endif // codecs diff --git a/stream.c b/stream.c index fe97c78..8c4fd67 100644 --- a/stream.c +++ b/stream.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/utils.c b/utils.c index 45a3e76..af5d3f0 100644 --- a/utils.c +++ b/utils.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/vorbis.c b/vorbis.c index d739aca..e062ac4 100644 --- a/vorbis.c +++ b/vorbis.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by