-Updated UI to send LOOPER_PLAY event on click

This commit is contained in:
Harry van Haaren 2013-07-25 01:47:19 +01:00
parent c9e19e4e02
commit 1121c068ca
7 changed files with 55 additions and 29 deletions

View file

@ -27,6 +27,8 @@
#include <string>
#include "../gclipselectoraction.hxx"
namespace Avtk
{
@ -51,7 +53,7 @@ class ClipState
state = CLIP_EMPTY;
name = n;
}
State state;
std::string name;
};
@ -249,7 +251,7 @@ class ClipSelector : public Fl_Button
}
else if ( strcmp(m->label(), "Load") == 0 )
{
fl_choice("Loading...", "OK", NULL, NULL);
clipSelectorLoad( 0 );
clips[clipNum].state = ClipState::CLIP_LOADED;
}
else if ( strcmp(m->label(), "Duration") == 0 )

View file

@ -0,0 +1,47 @@
#ifndef LUPPP_G_CLIP_SELECTOR_ACTION_H
#define LUPPP_G_CLIP_SELECTOR_ACTION_H
#include "config.hxx"
#include "worker.hxx"
#include "audiobuffer.hxx"
#include "eventhandler.hxx"
static string choose_file()
{
string path;
Fl_Native_File_Chooser fnfc;
fnfc.title("Pick a file");
fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE);
//fnfc.filter("Wav\t*.wav");
fnfc.directory( getenv("HOME") ); // default directory to use
// Show native chooser
switch ( fnfc.show() ) {
case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR
case 1: printf("CANCEL\n"); break; // CANCEL
default: printf("Loading directory: %s\n", fnfc.filename());
// update path and load it
path = fnfc.filename();
break; // FILE CHOSEN
}
return path;
}
static void clipSelectorLoad(int track)
{
AudioBuffer* ab = Worker::loadSample( choose_file() );
EventLooperLoad e = EventLooperLoad( track, 0, ab );
writeToDspRingbuffer( &e );
}
static void clipSelectorPlay(int track, int scene)
{
EventLooperPlay e = EventLooperPlay( track, scene );
writeToDspRingbuffer( &e );
}
#endif // LUPPP_G_CLIP_SELECTOR_ACTION_H

View file

@ -12,6 +12,7 @@
#include "avtk/avtk_dial.h"
#include "avtk/avtk_button.h"
#include "avtk/avtk_background.h"
#include "avtk/avtk_light_button.h"
#include "avtk/avtk_clip_selector.h"

View file

@ -24,28 +24,6 @@
using namespace std;
static string choose_file()
{
string path;
Fl_Native_File_Chooser fnfc;
fnfc.title("Pick a file");
fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE);
//fnfc.filter("Wav\t*.wav");
fnfc.directory( getenv("HOME") ); // default directory to use
// Show native chooser
switch ( fnfc.show() ) {
case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR
case 1: printf("CANCEL\n"); break; // CANCEL
default: printf("Loading directory: %s\n", fnfc.filename());
// update path and load it
path = fnfc.filename();
break; // FILE CHOSEN
}
return path;
}
extern void gtrack_button_callback(Fl_Widget *w, void *data);
class GTrack : public Fl_Group

View file

@ -56,7 +56,7 @@ Gui::Gui() :
Avtk::Image* headerImage = new Avtk::Image(0,0,1272,36,"header.png");
headerImage->setPixbuf( header.pixel_data, 4 );
Gui::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 );

View file

@ -6,8 +6,6 @@
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include "avtk/avtk_light_button.h"
#include "config.hxx"
#include "gtrack.hxx"
#include "gunittrack.hxx"

View file

@ -36,8 +36,8 @@ int main()
rbToGui = jack_ringbuffer_create( 5000 * sizeof(EventBase));
//jack = new Jack();
//jack->activate();
jack = new Jack();
jack->activate();
gui = new Gui();
gui->show();