SampleRecordHandle: Obtain the offset to the record with a parameter
instead of hacking sampleBuffer ()->startFrame (). That solves a bug with `startFrame ()` being negetive in recording some cases.
This commit is contained in:
@@ -41,7 +41,7 @@ class Track;
|
||||
class SampleRecordHandle : public PlayHandle
|
||||
{
|
||||
public:
|
||||
SampleRecordHandle( SampleTCO* tco );
|
||||
explicit SampleRecordHandle(SampleTCO* tco, TimePos startRecordTimeOffset);
|
||||
virtual ~SampleRecordHandle();
|
||||
|
||||
void play( sampleFrame * _working_buffer ) override;
|
||||
@@ -65,7 +65,10 @@ private:
|
||||
Track * m_track;
|
||||
BBTrack * m_bbTrack;
|
||||
SampleTCO * m_tco;
|
||||
|
||||
|
||||
// The offset from the start of m_track that the record has
|
||||
// started from.
|
||||
TimePos m_startRecordTimeOffset;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -33,13 +33,14 @@
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
SampleRecordHandle::SampleRecordHandle( SampleTCO* tco ) :
|
||||
SampleRecordHandle::SampleRecordHandle(SampleTCO* tco , TimePos startRecordTimeOffset) :
|
||||
PlayHandle( TypeSamplePlayHandle ),
|
||||
m_framesRecorded( 0 ),
|
||||
m_minLength( tco->length() ),
|
||||
m_track( tco->getTrack() ),
|
||||
m_bbTrack( nullptr ),
|
||||
m_tco( tco )
|
||||
m_tco(tco),
|
||||
m_startRecordTimeOffset{startRecordTimeOffset}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -53,6 +54,8 @@ SampleRecordHandle::~SampleRecordHandle()
|
||||
SampleBuffer* sb;
|
||||
createSampleBuffer( &sb );
|
||||
m_tco->setSampleBuffer( sb );
|
||||
|
||||
m_tco->setStartTimeOffset(m_startRecordTimeOffset);
|
||||
}
|
||||
|
||||
while( !m_buffers.empty() )
|
||||
|
||||
@@ -144,7 +144,7 @@ bool SampleTrack::play( const TimePos & _start, const fpp_t _frames,
|
||||
{
|
||||
return played_a_note;
|
||||
}
|
||||
SampleRecordHandle* smpHandle = new SampleRecordHandle( st );
|
||||
SampleRecordHandle* smpHandle = new SampleRecordHandle( st , _start - st->startPosition ());
|
||||
handle = smpHandle;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user