Skip to content

Commit 649b65b

Browse files
ReflexePhysSong
authored andcommitted
SampleRecordHandle: Apply start offset to reocrded TCO.
Previously, begining record in any position would result the data being in the end of the TCO. @see LMMS#3947 (comment) Thanks to @-BaraMGB :)
1 parent 2cc3b89 commit 649b65b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/core/SampleRecordHandle.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,15 @@ SampleRecordHandle::~SampleRecordHandle()
5050
{
5151
if( !m_buffers.empty() )
5252
{
53+
auto sampleStart = m_tco->sampleBuffer ()->startFrame ();
54+
5355
SampleBuffer* sb;
5456
createSampleBuffer( &sb );
5557
m_tco->setSampleBuffer( sb );
58+
59+
// Apply the sample buffer offset from the start of the TCO.
60+
MidiTime startTimeOffset = (tick_t)( sampleStart / Engine::framesPerTick());
61+
m_tco->setStartTimeOffset (startTimeOffset);
5662
}
5763

5864
while( !m_buffers.empty() )

0 commit comments

Comments
 (0)