-Updated AudioBuffer class, added ID's again, updated beat handling

This commit is contained in:
Harry van Haaren 2013-08-22 01:29:55 +01:00
parent 7218a86da4
commit cbd4e347cc
3 changed files with 20 additions and 8 deletions

View file

@ -11,21 +11,22 @@ class AudioBuffer
public:
AudioBuffer()
{
//ID = privateID++;
ID = privateID++;
numBeats = 0;
}
AudioBuffer(unsigned long size)
{
//ID = id;
numBeats = 4;
numBeats = 0;
buffer.resize(size);
}
/*
int getID()
{
return ID;
}
*/
int getBeats()
{
return numBeats;
@ -48,8 +49,8 @@ class AudioBuffer
}
protected:
//static int privateID;
//int ID;
static int privateID;
int ID;
int numBeats;

View file

@ -5,12 +5,14 @@
#include <cstring>
#include <iostream>
#include "audiobuffer.hxx"
#include "eventhandler.hxx"
#include "controller/gui.hxx"
using namespace std;
int AudioBuffer::privateID = 0;
extern int jackSamplerate;
Jack::Jack() :

View file

@ -22,7 +22,7 @@ LooperClip::LooperClip(int t, int s) :
_queueStop = false;
_queueRecord= false;
_buffer = 0; //new AudioBuffer(44100);
_buffer = new AudioBuffer(44100);
_newBufferInTransit = false;
_playhead = 0;
@ -65,6 +65,8 @@ void LooperClip::setRequestedBuffer( AudioBuffer* ab )
ab->getData().at(i) = _buffer->getData().at( i );
}
ab->setBeats( _buffer->getBeats() );
EventDeallocateBuffer e( _buffer );
writeToGuiRingbuffer( &e );
}
@ -162,6 +164,13 @@ void LooperClip::bar()
_recordhead = 0;
}
if ( _recording )
{
// FIXME: assumes 4 beats in a bar
_buffer->setBeats( _buffer->getBeats() + 4 );
}
if ( change )
{
jack->getControllerUpdater()->setSceneState(track, scene, s );