mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-UI now gets updates from Looper: all on track 1 scene 1, but working
This commit is contained in:
parent
a9bbec922a
commit
ce8f7537ab
8 changed files with 67 additions and 21 deletions
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "../looper.hxx"
|
||||
#include "../gclipselectoraction.hxx"
|
||||
|
||||
#include "../worker.hxx"
|
||||
|
@ -83,6 +84,37 @@ class ClipSelector : public Fl_Button
|
|||
mouseOver = false;
|
||||
}
|
||||
|
||||
void setState( int clipNum, Looper::State s )
|
||||
{
|
||||
switch(s)
|
||||
{
|
||||
case Looper::STATE_PLAYING:
|
||||
clips[clipNum].state = ClipState::CLIP_PLAYING;
|
||||
break;
|
||||
case Looper::STATE_PLAY_QUEUED:
|
||||
clips[clipNum].state = ClipState::CLIP_QUEUED;
|
||||
break;
|
||||
case Looper::STATE_RECORDING:
|
||||
clips[clipNum].state = ClipState::CLIP_RECORDING;
|
||||
break;
|
||||
case Looper::STATE_RECORD_QUEUED:
|
||||
clips[clipNum].state = ClipState::CLIP_QUEUED;
|
||||
break;
|
||||
case Looper::STATE_STOPPED:
|
||||
clips[clipNum].state = ClipState::CLIP_LOADED;
|
||||
break;
|
||||
case Looper::STATE_STOP_QUEUED:
|
||||
clips[clipNum].state = ClipState::CLIP_QUEUED;
|
||||
break;
|
||||
}
|
||||
redraw();
|
||||
}
|
||||
void setState( int clipNum, ClipState::State s )
|
||||
{
|
||||
clips[clipNum].state = s;
|
||||
redraw();
|
||||
}
|
||||
|
||||
static const int numClips = 10;
|
||||
ClipState clips[numClips];
|
||||
|
||||
|
@ -290,7 +322,7 @@ class ClipSelector : public Fl_Button
|
|||
else if ( strcmp(m->label(), "Record") == 0 )
|
||||
{
|
||||
clips[clipNum].state = ClipState::CLIP_RECORDING;
|
||||
EventLooperState e = EventLooperState( 0, Looper::STATE_RECORD_QUEUED);
|
||||
EventLooperState e = EventLooperState( 0, 0, Looper::STATE_RECORD_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
}
|
||||
|
@ -301,32 +333,34 @@ class ClipSelector : public Fl_Button
|
|||
case ClipState::CLIP_EMPTY:
|
||||
clips[clipNum].state = ClipState::CLIP_RECORDING;
|
||||
{
|
||||
EventLooperState e = EventLooperState( 0, Looper::STATE_RECORD_QUEUED);
|
||||
EventLooperState e = EventLooperState( 0, 0, Looper::STATE_RECORD_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
break;
|
||||
case ClipState::CLIP_LOADED:
|
||||
{
|
||||
EventLooperState e = EventLooperState( 0, Looper::STATE_PLAY_QUEUED);
|
||||
EventLooperState e = EventLooperState( 0, 0, Looper::STATE_PLAY_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
clips[clipNum].state = ClipState::CLIP_PLAYING;
|
||||
clips[clipNum].state = ClipState::CLIP_QUEUED;
|
||||
}
|
||||
break;
|
||||
case ClipState::CLIP_QUEUED:
|
||||
clips[clipNum].state = ClipState::CLIP_PLAYING;
|
||||
clips[clipNum].state = ClipState::CLIP_QUEUED;
|
||||
break;
|
||||
case ClipState::CLIP_PLAYING:
|
||||
{
|
||||
EventLooperState e = EventLooperState( 0, Looper::STATE_STOP_QUEUED);
|
||||
EventLooperState e = EventLooperState( 0, 0, Looper::STATE_STOP_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
clips[clipNum].state = ClipState::CLIP_LOADED;
|
||||
clips[clipNum].state = ClipState::CLIP_QUEUED;
|
||||
}
|
||||
break;
|
||||
case ClipState::CLIP_RECORDING:
|
||||
clips[clipNum].state = ClipState::CLIP_LOADED;
|
||||
case ClipState::CLIP_RECORDING: {
|
||||
clips[clipNum].state = ClipState::CLIP_QUEUED;
|
||||
EventLooperState e = EventLooperState( 0, 0, Looper::STATE_STOP_QUEUED);
|
||||
writeToDspRingbuffer( &e ); }
|
||||
break;
|
||||
case ClipState::CLIP_STOPPING:
|
||||
clips[clipNum].state = ClipState::CLIP_PLAYING;
|
||||
clips[clipNum].state = ClipState::CLIP_QUEUED;
|
||||
break;
|
||||
default:
|
||||
printf("Avtk::ClipSelector, warning: unknown clip type\n");
|
||||
|
|
|
@ -67,9 +67,10 @@ class EventLooperState : public EventBase
|
|||
uint32_t size() { return sizeof(EventLooperState); }
|
||||
|
||||
int track;
|
||||
int scene;
|
||||
Looper::State state;
|
||||
EventLooperState(){}
|
||||
EventLooperState(int t, Looper::State s) : track(t), state(s){}
|
||||
EventLooperState(int t, int sc, Looper::State s) : track(t), scene(sc), state(s){}
|
||||
};
|
||||
|
||||
class EventLooperProgress : public EventBase
|
||||
|
|
|
@ -50,6 +50,7 @@ void handleGuiEvents()
|
|||
if ( availableRead >= sizeof(EventLooperState) ) {
|
||||
EventLooperState ev;
|
||||
jack_ringbuffer_read( rbToGui, (char*)&ev, sizeof(EventLooperState) );
|
||||
gui->getTrack(ev.track)->getClipSelector()->setState(ev.scene, ev.state);
|
||||
//jack->setLooperState( ev.track, ev.state );
|
||||
} break; }
|
||||
case Event::LOOPER_LOOP_LENGTH: {
|
||||
|
|
|
@ -37,11 +37,5 @@ static void clipSelectorLoad(int track)
|
|||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
|
||||
static void clipSelectorPlay(int track, int scene)
|
||||
{
|
||||
EventLooperState e = EventLooperState(track, Looper::STATE_PLAY_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
|
||||
#endif // LUPPP_G_CLIP_SELECTOR_ACTION_H
|
||||
|
||||
|
|
|
@ -13,21 +13,21 @@ void gtrack_button_callback(Fl_Widget *w, void *data)
|
|||
|
||||
if ( strcmp( w->label() , "Rec" ) == 0 )
|
||||
{
|
||||
EventLooperState e = EventLooperState(track,Looper::STATE_RECORD_QUEUED);
|
||||
EventLooperState e = EventLooperState(track,0,Looper::STATE_RECORD_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
//w->tooltip( "Rec Clicked" );
|
||||
gui->setTooltip("Rec clicked");
|
||||
}
|
||||
else if ( strcmp( w->label() , "Play" ) == 0 )
|
||||
{
|
||||
EventLooperState e = EventLooperState(track,Looper::STATE_PLAY_QUEUED);
|
||||
EventLooperState e = EventLooperState(track,0,Looper::STATE_PLAY_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
//w->tooltip( "Play clicked" );
|
||||
gui->setTooltip("Play clicked");
|
||||
}
|
||||
else if ( strcmp( w->label() , "Stop" ) == 0 )
|
||||
{
|
||||
EventLooperState e = EventLooperState(track,Looper::STATE_STOP_QUEUED);
|
||||
EventLooperState e = EventLooperState(track,0,Looper::STATE_STOP_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
else if ( strcmp( w->label() , "+" ) == 0 )
|
||||
|
|
|
@ -29,6 +29,9 @@ extern void gtrack_button_callback(Fl_Widget *w, void *data);
|
|||
class GTrack : public Fl_Group
|
||||
{
|
||||
public:
|
||||
|
||||
Avtk::ClipSelector* getClipSelector(){return &clipSel;}
|
||||
|
||||
GTrack(int x, int y, int w, int h, const char* l = 0 ) :
|
||||
Fl_Group(x, y, w, h),
|
||||
title( strdup(l) ),
|
||||
|
|
|
@ -56,7 +56,7 @@ Gui::Gui() :
|
|||
Avtk::Image* headerImage = new Avtk::Image(0,0,1272,36,"header.png");
|
||||
headerImage->setPixbuf( header.pixel_data, 4 );
|
||||
|
||||
tooltipLabel = new Fl_Box(100, 20, 200, 20, "tooltips go here");
|
||||
//tooltipLabel = new Fl_Box(100, 20, 200, 20, "tooltips go here");
|
||||
|
||||
//window.resizable( headerImage );
|
||||
|
||||
|
|
|
@ -211,12 +211,21 @@ void Looper::bar()
|
|||
state = STATE_PLAYING;
|
||||
playPoint = 0;
|
||||
endPoint = lastWrittenSampleIndex;
|
||||
|
||||
|
||||
int scene = 0;
|
||||
EventLooperState e2( track, scene, STATE_PLAYING );
|
||||
writeToGuiRingbuffer( &e2 );
|
||||
}
|
||||
if ( state == STATE_RECORD_QUEUED )
|
||||
{
|
||||
EventGuiPrint e( "Looper Q->Recording" );
|
||||
writeToGuiRingbuffer( &e );
|
||||
|
||||
int scene = 0;
|
||||
EventLooperState e2( track, scene, STATE_RECORDING );
|
||||
writeToGuiRingbuffer( &e2 );
|
||||
|
||||
state = STATE_RECORDING;
|
||||
playPoint = 0;
|
||||
endPoint = 0;
|
||||
|
@ -227,6 +236,10 @@ void Looper::bar()
|
|||
EventGuiPrint e( "Looper Q->Stopped" );
|
||||
writeToGuiRingbuffer( &e );
|
||||
|
||||
int scene = 0;
|
||||
EventLooperState e2( track, scene, STATE_STOPPED );
|
||||
writeToGuiRingbuffer( &e2 );
|
||||
|
||||
state = STATE_STOPPED;
|
||||
endPoint = lastWrittenSampleIndex;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue