-Updated Buffer handling in LooperClip

This commit is contained in:
Harry van Haaren 2013-08-22 01:35:43 +01:00
parent cbd4e347cc
commit 0e8c5ea91b
2 changed files with 9 additions and 6 deletions

View file

@ -16,11 +16,17 @@ class AudioBuffer
}
AudioBuffer(unsigned long size)
{
//ID = id;
/// no ID assigned: it *takes* the one from the previous buffer!
numBeats = 0;
buffer.resize(size);
}
/// this function is used for "resizing" an exisiting buffer, and should
/// not be called for any other reason.
void setID(int id)
{
ID = id;
}
int getID()
{

View file

@ -59,12 +59,9 @@ void LooperClip::setRequestedBuffer( AudioBuffer* ab )
if ( _buffer )
{
size_t size = _buffer->getData().size();
memcpy( &ab->getData().at(0), &_buffer->getData().at(0), sizeof(float)*size);
for(size_t i = 0; i < size; i++)
{
ab->getData().at(i) = _buffer->getData().at( i );
}
ab->setID ( _buffer->getID() );
ab->setBeats( _buffer->getBeats() );
EventDeallocateBuffer e( _buffer );