Revision of handling of frameoffset for NPH, SPH

Change in handling of frameoffset for multistreamed instruments and sampletracks.
- Instead of holding the offset for the lifetime of the playhandle, negate the offset in the first period
- Multistream-instruments require some small changes: they have to now check for the offset and accordingly leave empty space in the start of the period (already done in this commit)
- There are possibly optimizations that can be done later
- This change is necessary so that we can have sample-exact models, and sample-exact vol/pan knobs for all instruments. Earlier multistream instruments were always rendering some frames ahead-of-time, so applying sample-exact data for them would have been impossible, since we don't have the future-values yet...
This commit is contained in:
Vesa committed 2014-06-29 23:13:00 +03:00
1 parent a7bb31159e
commit 270af579b8
23 files changed
+137 -124

No files matched your search

+4 -2
View File
@@ -1245,14 +1245,16 @@ MonstroInstrument::~MonstroInstrument()
void MonstroInstrument::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
{
fpp_t frames = _n->framesLeftForCurrentPeriod();
if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL )
{
_working_buffer += _n->offset();
frames -= _n->offset();
const sample_rate_t samplerate = m_samplerate;
_n->m_pluginData = new MonstroSynth( this, _n, samplerate, m_fpp );
}
const fpp_t frames = _n->framesLeftForCurrentPeriod();
MonstroSynth * ms = static_cast<MonstroSynth *>( _n->m_pluginData );
ms->renderOutput( frames, _working_buffer );