Skip to content

Commit

Permalink
SampleRecordHandle: Apply start offset to reocrded TCO.
Browse files Browse the repository at this point in the history
Previously, begining record in any position would result the data being
in the end of the TCO.

@see LMMS#3947 (comment)

Thanks to @-BaraMGB :)
  • Loading branch information
Reflexe authored and PhysSong committed Mar 12, 2019
1 parent 02df78a commit 156bbca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/SampleRecordHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,15 @@ SampleRecordHandle::~SampleRecordHandle()
{
if( !m_buffers.empty() )
{
auto sampleStart = m_tco->sampleBuffer ()->startFrame ();

SampleBuffer* sb;
createSampleBuffer( &sb );
m_tco->setSampleBuffer( sb );

// Apply the sample buffer offset from the start of the TCO.
MidiTime startTimeOffset = (tick_t)( sampleStart / Engine::framesPerTick());
m_tco->setStartTimeOffset (startTimeOffset);
}

while( !m_buffers.empty() )
Expand Down

0 comments on commit 156bbca

Please sign in to comment.