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