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

+3 -7
View File
@@ -193,26 +193,22 @@ void InstrumentTrack::processAudioBuffer( sampleFrame* buf, const fpp_t frames,
// is no problem for us since we just bypass the envelopes+LFOs
if( m_instrument->flags().testFlag( Instrument::IsSingleStreamed ) == false && n != NULL )
{
m_soundShaping.processAudioBuffer( buf, frames, n );
const f_cnt_t offset = n->noteOffset();
m_soundShaping.processAudioBuffer( buf + offset, frames - offset, n );
v_scale *= ( (float) n->getVolume() / DefaultVolume );
}
m_audioPort.setNextFxChannel( m_effectChannelModel.value() );
int framesToMix = frames;
int offset = 0;
int panning = m_panningModel.value();
if( n )
{
framesToMix = qMin<f_cnt_t>( n->framesLeftForCurrentPeriod(), framesToMix );
offset = n->offset();
panning += n->getPanning();
panning = tLimit<int>( panning, PanningLeft, PanningRight );
}
engine::mixer()->bufferToPort( buf, framesToMix, offset, panningToVolumeVector( panning, v_scale ), &m_audioPort );
engine::mixer()->bufferToPort( buf, frames, panningToVolumeVector( panning, v_scale ), &m_audioPort );
}