mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-Refactored Observer to TimeObserver
This commit is contained in:
parent
b64576cbdf
commit
30ef6c4330
6 changed files with 17 additions and 15 deletions
|
@ -13,14 +13,14 @@ extern Jack* jack;
|
|||
|
||||
Looper::Looper(int t) :
|
||||
AudioProcessor(),
|
||||
Observer(),
|
||||
TimeObserver(),
|
||||
track(t),
|
||||
uiUpdateConstant(44100/30.f),
|
||||
uiUpdateCounter(44100/30.f)
|
||||
{
|
||||
// pre-zero the internal sample
|
||||
//tmpRecordBuffer = (float*)malloc( sizeof(float) * MAX_BUFFER_SIZE );
|
||||
//memset( tmpRecordBuffer, 0, sizeof(float) * MAX_BUFFER_SIZE );
|
||||
tmpRecordBuffer = (float*)malloc( sizeof(float) * MAX_BUFFER_SIZE );
|
||||
memset( tmpRecordBuffer, 0, sizeof(float) * MAX_BUFFER_SIZE );
|
||||
|
||||
for(int i = 0; i < 10; i++ )
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "audioprocessor.hxx"
|
||||
|
||||
#include "looperclip.hxx"
|
||||
#include "observer/observer.hxx"
|
||||
#include "observer/time.hxx"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -18,7 +18,7 @@ using namespace std;
|
|||
* The class which reads from LooperClips, and reads/ writes the data using the
|
||||
* track buffer. Scene recording / playback is the essential functionality here.
|
||||
**/
|
||||
class Looper : public AudioProcessor, public Observer
|
||||
class Looper : public AudioProcessor, public TimeObserver
|
||||
{
|
||||
public:
|
||||
Looper(int t);
|
||||
|
|
|
@ -35,7 +35,7 @@ class LooperClip
|
|||
_playhead = 0;
|
||||
}
|
||||
|
||||
// loads a sample: eg from disk
|
||||
/// loads a sample: eg from disk
|
||||
void load( AudioBuffer* ab )
|
||||
{
|
||||
_loaded = true;
|
||||
|
@ -53,10 +53,12 @@ class LooperClip
|
|||
_playing = true;
|
||||
}
|
||||
|
||||
/// 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
|
||||
void setRequestedBuffer( AudioBuffer* ab )
|
||||
{
|
||||
// here we copy the data from the existing buffer into the new one,
|
||||
// and send the old one away to be deallocated.
|
||||
|
||||
}
|
||||
|
||||
void record(int count, float* L, float* R)
|
||||
|
|
|
@ -7,15 +7,16 @@
|
|||
|
||||
#include "buffers.hxx"
|
||||
|
||||
#include "observer/observer.hxx"
|
||||
#include "observer/time.hxx"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// simple metronome class
|
||||
class Metronome : public Observer
|
||||
class Metronome : public TimeObserver
|
||||
{
|
||||
public:
|
||||
Metronome() :
|
||||
TimeObserver(),
|
||||
playBar (false),
|
||||
active (false),
|
||||
playPoint (0)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#ifndef LUPPP_OBSERVER_H
|
||||
#define LUPPP_OBSERVER_H
|
||||
|
||||
class Observer
|
||||
class TimeObserver
|
||||
{
|
||||
public:
|
||||
virtual void setFpb(int fpb){};
|
|
@ -8,11 +8,10 @@
|
|||
#include "buffers.hxx"
|
||||
#include "eventhandler.hxx"
|
||||
|
||||
#include "observer/observer.hxx"
|
||||
#include "observer/time.hxx"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// inherits from ObserverSubject
|
||||
class TimeManager
|
||||
{
|
||||
public:
|
||||
|
@ -47,7 +46,7 @@ class TimeManager
|
|||
}
|
||||
}
|
||||
|
||||
void registerObserver(Observer* o)
|
||||
void registerObserver(TimeObserver* o)
|
||||
{
|
||||
cout << "registerObserver() " << o << endl;
|
||||
observers.push_back(o);
|
||||
|
@ -151,7 +150,7 @@ class TimeManager
|
|||
int tapTempoPos;
|
||||
int tapTempo[3];
|
||||
|
||||
std::vector<Observer*> observers;
|
||||
std::vector<TimeObserver*> observers;
|
||||
};
|
||||
|
||||
#endif // LUPPP_TIME_H
|
||||
|
|
Loading…
Add table
Reference in a new issue