Revert "Switch to libsamplerate's callback API in Sample (#7361)" (#7410)

This reverts commit 2f5f12aaae.
This commit is contained in:
saker
2024-08-04 11:01:26 -04:00
committed by GitHub
parent 735e483d9f
commit 5b366cfe3c
9 changed files with 265 additions and 69 deletions

View File

@@ -144,9 +144,9 @@ void AudioFileProcessor::playNote( NotePlayHandle * _n,
srcmode = SRC_SINC_MEDIUM_QUALITY;
break;
}
_n->m_pluginData = new Sample::PlaybackState(srcmode);
static_cast<Sample::PlaybackState*>(_n->m_pluginData)->frameIndex = m_nextPlayStartPoint;
static_cast<Sample::PlaybackState*>(_n->m_pluginData)->backwards = m_nextPlayBackwards;
_n->m_pluginData = new Sample::PlaybackState(_n->hasDetuningInfo(), srcmode);
static_cast<Sample::PlaybackState*>(_n->m_pluginData)->setFrameIndex(m_nextPlayStartPoint);
static_cast<Sample::PlaybackState*>(_n->m_pluginData)->setBackwards(m_nextPlayBackwards);
// debug code
/* qDebug( "frames %d", m_sample->frames() );
@@ -162,7 +162,7 @@ void AudioFileProcessor::playNote( NotePlayHandle * _n,
static_cast<Sample::Loop>(m_loopModel.value())))
{
applyRelease( _working_buffer, _n );
emit isPlaying(static_cast<Sample::PlaybackState*>(_n->m_pluginData)->frameIndex);
emit isPlaying(static_cast<Sample::PlaybackState*>(_n->m_pluginData)->frameIndex());
}
else
{
@@ -176,8 +176,8 @@ void AudioFileProcessor::playNote( NotePlayHandle * _n,
}
if( m_stutterModel.value() == true )
{
m_nextPlayStartPoint = static_cast<Sample::PlaybackState*>(_n->m_pluginData)->frameIndex;
m_nextPlayBackwards = static_cast<Sample::PlaybackState*>(_n->m_pluginData)->backwards;
m_nextPlayStartPoint = static_cast<Sample::PlaybackState*>(_n->m_pluginData)->frameIndex();
m_nextPlayBackwards = static_cast<Sample::PlaybackState*>(_n->m_pluginData)->backwards();
}
}

View File

@@ -437,7 +437,7 @@ void GigInstrument::play( SampleFrame* _working_buffer )
if (sample.region->PitchTrack == true) { freq_factor *= sample.freqFactor; }
// We need a bit of margin so we don't get glitching
samples = frames / freq_factor + s_interpolationMargins[m_interpolation];
samples = frames / freq_factor + Sample::s_interpolationMargins[m_interpolation];
}
// Load this note's data

View File

@@ -240,12 +240,6 @@ class GigInstrument : public Instrument
mapPropertyFromModel( int, getPatch, setPatch, m_patchNum );
public:
// values for buffer margins, used for various libsamplerate interpolation modes
// the array positions correspond to the converter_type parameter values in libsamplerate
// if there appears problems with playback on some interpolation mode, then the value for that mode
// may need to be higher - conversely, to optimize, some may work with lower values
static constexpr auto s_interpolationMargins = std::array<int, 5>{64, 64, 64, 4, 4};
GigInstrument( InstrumentTrack * _instrument_track );
~GigInstrument() override;