move buffer resize request into LooperClip
This commit is contained in:
parent
3d3ac0a174
commit
c91d593818
3 changed files with 11 additions and 13 deletions
|
@ -115,13 +115,6 @@ void Looper::process(unsigned int nframes, Buffers* buffers)
|
|||
// handle state of clip, and do what needs doing:
|
||||
// record into buffer, play from buffer, etc
|
||||
if ( clips[clip]->recording() ) {
|
||||
if ( clips[clip]->recordSpaceAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST &&
|
||||
!clips[clip]->newBufferInTransit() ) {
|
||||
EventLooperClipRequestBuffer e( track, clip, clips[clip]->audioBufferSize() + LOOPER_SAMPLES_UPDATE_SIZE);
|
||||
writeToGuiRingbuffer( &e );
|
||||
clips[clip]->newBufferInTransit(true);
|
||||
}
|
||||
|
||||
// copy data from input buffer to recording buffer
|
||||
float* inputL = buffers->audio[Buffers::MASTER_INPUT_L];
|
||||
float* inputR = buffers->audio[Buffers::MASTER_INPUT_R];
|
||||
|
|
|
@ -38,7 +38,7 @@ LooperClip::LooperClip(int t, int s) :
|
|||
scene(s)
|
||||
{
|
||||
_buffer = new AudioBuffer();
|
||||
_buffer->nonRtResize( 4410 );
|
||||
_buffer->nonRtResize( LOOPER_SAMPLES_UPDATE_SIZE );
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -193,6 +193,11 @@ void LooperClip::setPlayHead(float ph)
|
|||
|
||||
void LooperClip::record(int count, float* L, float* R)
|
||||
{
|
||||
if (recordSpaceAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST && !newBufferInTransit()) {
|
||||
EventLooperClipRequestBuffer e( track, scene, audioBufferSize() + LOOPER_SAMPLES_UPDATE_SIZE);
|
||||
writeToGuiRingbuffer( &e );
|
||||
newBufferInTransit(true);
|
||||
}
|
||||
// write "count" samples into current buffer.
|
||||
if ( _buffer ) {
|
||||
size_t size = _buffer->getSize();
|
||||
|
|
|
@ -99,11 +99,6 @@ public:
|
|||
/// set buffer state
|
||||
void setBeats(int beats);
|
||||
|
||||
/// Luppp internal buffer resizing
|
||||
void newBufferInTransit(bool n);
|
||||
bool newBufferInTransit();
|
||||
unsigned long recordSpaceAvailable();
|
||||
|
||||
/** used to update the size of the buffer for this looperclip. The current
|
||||
* data is copied into the new buffer, then the smaller buffer is sent
|
||||
* for de-allocation.
|
||||
|
@ -143,6 +138,11 @@ private:
|
|||
|
||||
unsigned int _barsPlayed;
|
||||
AudioBuffer* _buffer;
|
||||
|
||||
/// Luppp internal buffer resizing
|
||||
void newBufferInTransit(bool n);
|
||||
bool newBufferInTransit();
|
||||
unsigned long recordSpaceAvailable();
|
||||
};
|
||||
|
||||
#endif // LUPPP_LOOPER_CLIP_H
|
||||
|
|
Loading…
Reference in a new issue