DSD gaplessness, part 2
We should be extrapolating right over top of the DSD decimator latency, rather than in front of it. Yeah, that'll do. Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
4b0f6b381f
commit
bec01b675a
|
@ -631,7 +631,9 @@ tryagain:
|
||||||
if(!skipResampler && !is_preextrapolated_) {
|
if(!skipResampler && !is_preextrapolated_) {
|
||||||
size_t samples_in_buffer = bytesReadFromInput / floatFormat.mBytesPerPacket;
|
size_t samples_in_buffer = bytesReadFromInput / floatFormat.mBytesPerPacket;
|
||||||
size_t prime = min(samples_in_buffer, PRIME_LEN_);
|
size_t prime = min(samples_in_buffer, PRIME_LEN_);
|
||||||
size_t newSize = N_samples_to_add_ * floatFormat.mBytesPerPacket;
|
size_t _N_samples_to_add_ = N_samples_to_add_;
|
||||||
|
if(dsd2pcm) _N_samples_to_add_ += dsd2pcmLatency;
|
||||||
|
size_t newSize = _N_samples_to_add_ * floatFormat.mBytesPerPacket;
|
||||||
newSize += bytesReadFromInput;
|
newSize += bytesReadFromInput;
|
||||||
|
|
||||||
if(newSize > inputBufferSize) {
|
if(newSize > inputBufferSize) {
|
||||||
|
@ -650,8 +652,8 @@ tryagain:
|
||||||
|
|
||||||
memmove(inputBuffer + N_samples_to_add_ * floatFormat.mBytesPerPacket, inputBuffer + bytesToSkip, bytesReadFromInput);
|
memmove(inputBuffer + N_samples_to_add_ * floatFormat.mBytesPerPacket, inputBuffer + bytesToSkip, bytesReadFromInput);
|
||||||
|
|
||||||
lpc_extrapolate_bkwd(inputBuffer + N_samples_to_add_ * floatFormat.mBytesPerPacket, samples_in_buffer, prime, floatFormat.mChannelsPerFrame, LPC_ORDER, N_samples_to_add_, &extrapolateBuffer, &extrapolateBufferSize);
|
lpc_extrapolate_bkwd(inputBuffer + _N_samples_to_add_ * floatFormat.mBytesPerPacket, samples_in_buffer, prime, floatFormat.mChannelsPerFrame, LPC_ORDER, _N_samples_to_add_, &extrapolateBuffer, &extrapolateBufferSize);
|
||||||
bytesReadFromInput += N_samples_to_add_ * floatFormat.mBytesPerPacket;
|
bytesReadFromInput += _N_samples_to_add_ * floatFormat.mBytesPerPacket;
|
||||||
latencyEaten = N_samples_to_drop_;
|
latencyEaten = N_samples_to_drop_;
|
||||||
if(dsd2pcm) latencyEaten += (int)ceil(dsd2pcmLatency * sampleRatio);
|
if(dsd2pcm) latencyEaten += (int)ceil(dsd2pcmLatency * sampleRatio);
|
||||||
is_preextrapolated_ = 2;
|
is_preextrapolated_ = 2;
|
||||||
|
@ -663,11 +665,6 @@ tryagain:
|
||||||
if(is_postextrapolated_ == 1) {
|
if(is_postextrapolated_ == 1) {
|
||||||
size_t samples_in_buffer = bytesReadFromInput / floatFormat.mBytesPerPacket;
|
size_t samples_in_buffer = bytesReadFromInput / floatFormat.mBytesPerPacket;
|
||||||
|
|
||||||
if(dsd2pcm) {
|
|
||||||
if(samples_in_buffer >= dsd2pcmLatency)
|
|
||||||
samples_in_buffer -= dsd2pcmLatency;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t prime = min(samples_in_buffer, PRIME_LEN_);
|
size_t prime = min(samples_in_buffer, PRIME_LEN_);
|
||||||
|
|
||||||
size_t newSize = bytesReadFromInput;
|
size_t newSize = bytesReadFromInput;
|
||||||
|
|
Loading…
Reference in New Issue