mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-Updated AudioBuffer class, added ID's again, updated beat handling
This commit is contained in:
parent
7218a86da4
commit
cbd4e347cc
3 changed files with 20 additions and 8 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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() :
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Add table
Reference in a new issue