Skip to content

Commit

Permalink
Added a vinylsoundemu to linear scaler when crossing zero rate
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Mar 28, 2015
1 parent 00d47e5 commit f8bfd6f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/engine/enginebufferscalelinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ CSAMPLE* EngineBufferScaleLinear::getScaled(unsigned long buf_size) {
samples_read += m_pReadAheadManager->getNextSamples(
rate_add_new, m_bufferInt, extra_samples);
}
//force a buffer read:
// force a buffer read:
m_bufferIntSize=0;
//make sure the indexes stay correct for interpolation
// make sure the indexes stay correct for interpolation
m_dCurrentFrame = 0 - m_dCurrentFrame + floor(m_dCurrentFrame);
m_dNextFrame = 1.0 - (m_dNextFrame - floor(m_dNextFrame));

Expand Down Expand Up @@ -370,6 +370,16 @@ CSAMPLE* EngineBufferScaleLinear::do_scale(CSAMPLE* buf,
i += 2 ;
}

// Vinylsoundemu:
// if we cross zero, ramp gain to zero
// this is the natural vinyl sound: no output without turning platter.
// This also deletes possible peaks with small buffers.
if (rate_add_old == 0) {
SampleUtil::applyRampingGain(buf, 0, 1.0, buf_size);
} else if (rate_add_new == 0) {
SampleUtil::applyRampingGain(buf, 1.0, 0, buf_size);
}

SampleUtil::clear(&buf[i], buf_size - i);

return buf;
Expand Down

0 comments on commit f8bfd6f

Please sign in to comment.