Whoops, almost forgot the smoothed play range stuff for multiple channels

This commit is contained in:
xenakios 2018-02-23 21:01:39 +02:00
parent 3a8da6de0c
commit a988086ec6

View File

@ -171,10 +171,7 @@ public:
readinc = -1; readinc = -1;
for (int i = 0; i < nsmps; ++i) for (int i = 0; i < nsmps; ++i)
{ {
float seekfadegain = 1.0f;
if (inchans == 1 && numchans > 0)
{
float sig = getCrossFadedSampleLambda(m_currentsample, 0, subsect_t0, subsect_t1, xfadelen);
if (m_seekfade.state == 1) if (m_seekfade.state == 1)
{ {
//Logger::writeToLog("Seek requested to pos " + String(m_seekfade.requestedpos)); //Logger::writeToLog("Seek requested to pos " + String(m_seekfade.requestedpos));
@ -182,8 +179,7 @@ public:
} }
if (m_seekfade.state == 2) if (m_seekfade.state == 2)
{ {
float seekfadegain = 1.0-(1.0 / m_seekfade.length*m_seekfade.counter); seekfadegain = 1.0 - (1.0 / m_seekfade.length*m_seekfade.counter);
sig *= seekfadegain;
++m_seekfade.counter; ++m_seekfade.counter;
if (m_seekfade.counter >= m_seekfade.length) if (m_seekfade.counter >= m_seekfade.length)
{ {
@ -202,8 +198,7 @@ public:
} }
if (m_seekfade.state == 3) if (m_seekfade.state == 3)
{ {
float seekfadegain = 1.0 / m_seekfade.length*m_seekfade.counter; seekfadegain = 1.0 / m_seekfade.length*m_seekfade.counter;
sig *= seekfadegain;
++m_seekfade.counter; ++m_seekfade.counter;
if (m_seekfade.counter >= m_seekfade.length) if (m_seekfade.counter >= m_seekfade.length)
{ {
@ -214,9 +209,13 @@ public:
m_seekfade.requestedrange = Range<double>(); m_seekfade.requestedrange = Range<double>();
} }
} }
jassert(seekfadegain >= 0.0f && seekfadegain<=1.0f);
if (inchans == 1 && numchans > 0)
{
float sig = getCrossFadedSampleLambda(m_currentsample, 0, subsect_t0, subsect_t1, xfadelen);
for (int j = 0; j < numchans; ++j) for (int j = 0; j < numchans; ++j)
{ {
smps[j][i] = sig; smps[j][i] = sig*seekfadegain;
} }
} }
else if (inchans > 1 && numchans > 1) else if (inchans > 1 && numchans > 1)
@ -224,7 +223,8 @@ public:
for (int j = 0; j < numchans; ++j) for (int j = 0; j < numchans; ++j)
{ {
int inchantouse = j % inchans; int inchantouse = j % inchans;
smps[j][i] = getCrossFadedSampleLambda(m_currentsample, inchantouse, subsect_t0, subsect_t1,xfadelen); smps[j][i] = seekfadegain*getCrossFadedSampleLambda(m_currentsample, inchantouse,
subsect_t0, subsect_t1,xfadelen);
} }
} }