-Loading clips now uses GridLogic, and _loaded status is in LooperClip

This commit is contained in:
Harry van Haaren 2013-08-22 00:05:00 +01:00
parent 36454399b6
commit 44f6e26da1
5 changed files with 15 additions and 10 deletions

View file

@ -56,9 +56,7 @@ void handleDspEvents()
if ( availableRead >= sizeof(EventLooperLoad) ) {
EventLooperLoad ev;
jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventLooperLoad) );
Looper* l = jack->getLooper( ev.track );
l->setSample( ev.clip, (AudioBuffer*)ev.audioBuffer );
jack->getGridLogic()->load( ev.track, ev.clip );
jack->getGridLogic()->load( ev.track, ev.clip, (AudioBuffer*)ev.audioBuffer );
} break; }
case Event::METRONOME_ACTIVE: {
if ( availableRead >= sizeof(EventMetronomeActive) ) {

View file

@ -2,6 +2,7 @@
#include "gridlogic.hxx"
#include "jack.hxx"
#include "audiobuffer.hxx"
extern Jack* jack;
@ -52,9 +53,9 @@ void GridLogic::released( int track, int scene )
jack->getControllerUpdater()->setSceneState(track, scene, state[track*NSCENES + scene] );
}
void GridLogic::load(int track, int scene)
void GridLogic::load(int track, int scene, AudioBuffer* ab)
{
state[track*NSCENES + scene] = STATE_LOADED;
jack->getLooper( track )->getClip( scene )->load( ab );
jack->getControllerUpdater()->setSceneState(track, scene, state[track*NSCENES + scene] );
}
@ -99,7 +100,6 @@ void GridLogic::bar()
if ( change )
{
jack->getControllerUpdater()->setSceneState(track, scene, state[track*NSCENES + scene] );
//printf("GridLogic::bar(), i = %i, track %i, scene %i\n", i, track, scene );
}
}

View file

@ -5,6 +5,8 @@
#include "config.hxx"
#include "observer/time.hxx"
class AudioBuffer;
/** GridLogic
* The logic code for the luppp tracks / grid resides here. This logic is
* separtated from the Looper class so it can be repurposed by different
@ -45,7 +47,7 @@ class GridLogic : public TimeObserver
void released( int track, int scene );
/// GUI load event
void load(int track, int scene);
void load(int track, int scene, AudioBuffer* ab);
/// resend entire grid state to controllers
void updateState();

View file

@ -9,6 +9,8 @@
LooperClip::LooperClip()
{
_state = GridLogic::STATE_EMPTY;
_loaded = false;
_playing = false;
_recording = false;

View file

@ -5,6 +5,8 @@
#include <stdio.h>
#include "config.hxx"
#include "gridlogic.hxx"
class AudioBuffer;
/** LooperClip
@ -40,11 +42,8 @@ class LooperClip
unsigned long recordSpaceAvailable();
void setBeats(int beats);
/// get clip state
bool loaded();
bool playing();
@ -68,6 +67,10 @@ class LooperClip
float getProgress();
private:
// internally, Luppp needs more than just the current state of the clip to
// accuratly handle it. Hence some bools are purposed: the *current*
// state of the grid is kept up to date by GridLogic.
GridLogic::State _state;
bool _loaded;
bool _playing;
bool _recording;