2013-07-25 00:23:30 +02:00
|
|
|
|
|
|
|
#include "gtrack.hxx"
|
|
|
|
#include "gui.hxx"
|
|
|
|
|
2013-09-10 23:26:37 +02:00
|
|
|
static void gtrack_vol_cb(Fl_Widget *w, void *data);
|
2013-10-03 02:50:16 +02:00
|
|
|
static void gtrack_key_cb(Fl_Widget *w, void *data);
|
|
|
|
static void gtrack_xsideDial_cb(Fl_Widget *w, void *data);
|
|
|
|
static void gtrack_sendDial_cb(Fl_Widget *w, void *data);
|
|
|
|
static void gtrack_send_cb(Fl_Widget *w, void *data);
|
2013-09-21 00:28:59 +02:00
|
|
|
static void gtrack_record_cb(Fl_Widget *w, void *data);
|
2013-09-10 23:26:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
GTrack::GTrack(int x, int y, int w, int h, const char* l ) :
|
|
|
|
Fl_Group(x, y, w, h),
|
2013-09-11 00:52:35 +02:00
|
|
|
bg( x, y , w, h, l ),
|
2013-09-10 23:26:37 +02:00
|
|
|
|
|
|
|
radial( x+5, y+ 26, 100, 100, ""),
|
|
|
|
|
|
|
|
clipSel(x + 5, y + 26 + 102, 100, 294,""),
|
|
|
|
|
|
|
|
volBox(x+5, y+422, 100, 172, ""),
|
|
|
|
volume(x+66, y +425, 36, 166, ""),
|
|
|
|
|
2013-09-23 11:18:58 +02:00
|
|
|
|
2013-10-03 02:50:16 +02:00
|
|
|
sendDial (x+21, y +430 + 0, 30, 30, ""),
|
|
|
|
sendActive (x+11, y +430 + 32, 50, 25, "Snd"),
|
2013-09-20 23:23:39 +02:00
|
|
|
|
2013-10-03 02:50:16 +02:00
|
|
|
xsideDial (x+21, y +430 + 69, 30, 30, ""),
|
|
|
|
keyActive (x+11, y +430 + 101, 50, 25, "Key"),
|
2013-09-20 23:23:39 +02:00
|
|
|
|
2013-11-10 00:27:47 +01:00
|
|
|
recordActive (x+11, y +430 + 132, 50, 25, "XRec")
|
2013-09-10 23:26:37 +02:00
|
|
|
{
|
|
|
|
ID = privateID++;
|
|
|
|
|
|
|
|
clipSel.setID( ID );
|
|
|
|
|
2013-10-03 02:50:16 +02:00
|
|
|
sendDial.callback( gtrack_sendDial_cb, this );
|
|
|
|
sendActive.setColor( 0, 1.0, 0.0 );
|
|
|
|
sendActive.callback( gtrack_send_cb, this );
|
|
|
|
|
|
|
|
xsideDial.callback( gtrack_xsideDial_cb, this );
|
|
|
|
xsideDial.align( FL_ALIGN_BOTTOM );
|
|
|
|
keyActive.callback( gtrack_key_cb, this );
|
|
|
|
keyActive.setColor( 0, 0.6, 1 );
|
|
|
|
|
|
|
|
|
|
|
|
recordActive.setColor( 1, 0.0, 0.0 );
|
|
|
|
recordActive.callback( gtrack_record_cb, this );
|
2013-09-10 23:26:37 +02:00
|
|
|
|
|
|
|
volume.callback( gtrack_vol_cb, this );
|
|
|
|
|
2013-10-18 13:32:57 +02:00
|
|
|
//volBox.color( fl_rgb_color( 0,0,0 ) );
|
2013-09-10 23:26:37 +02:00
|
|
|
|
|
|
|
end(); // close the group
|
|
|
|
}
|
|
|
|
|
2013-10-03 02:50:16 +02:00
|
|
|
float GTrack::getSend(){return sendDial.value(); }
|
|
|
|
float GTrack::getXSide(){return xsideDial.value(); }
|
|
|
|
|
|
|
|
bool GTrack::getSendActive (){return sendActive.value(); }
|
|
|
|
bool GTrack::getKeyActive (){return keyActive.value(); }
|
|
|
|
bool GTrack::getRecordActive(){return recordActive.value(); }
|
|
|
|
|
|
|
|
|
|
|
|
void GTrack::setSend(float s){ sendDial.value( s ); }
|
|
|
|
void GTrack::setXSide(float s){ xsideDial.value( s ); }
|
|
|
|
|
|
|
|
void GTrack::setSendActive(bool a){ sendActive.value( a ); }
|
|
|
|
void GTrack::setKeyActive(bool a){ keyActive.value( a ); }
|
|
|
|
void GTrack::setRecordActive(bool a){ recordActive.value( a ); }
|
|
|
|
|
|
|
|
|
|
|
|
void gtrack_sendDial_cb(Fl_Widget *w, void *data)
|
2013-09-10 23:26:37 +02:00
|
|
|
{
|
|
|
|
GTrack* track = (GTrack*) data;
|
2013-10-03 02:18:06 +02:00
|
|
|
EventTrackSend e( track->ID, SEND_POSTFADER, ((Avtk::Dial*)w)->value() );
|
2013-09-10 23:26:37 +02:00
|
|
|
writeToDspRingbuffer( &e );
|
2013-10-18 02:28:00 +02:00
|
|
|
//printf("track %i reverb send %f\n", track->ID, ((Avtk::Dial*)w)->value() );
|
2013-09-10 23:26:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-03 02:50:16 +02:00
|
|
|
void gtrack_key_cb(Fl_Widget *w, void *data)
|
2013-09-10 23:26:37 +02:00
|
|
|
{
|
|
|
|
GTrack* track = (GTrack*) data;
|
2013-09-11 03:06:33 +02:00
|
|
|
Avtk::LightButton* d = (Avtk::LightButton*)w;
|
|
|
|
bool b = d->value();
|
|
|
|
if ( b < 0.5 )
|
|
|
|
{
|
2013-10-03 02:18:06 +02:00
|
|
|
EventTrackSendActive e( track->ID, SEND_KEY, true );
|
2013-09-11 03:06:33 +02:00
|
|
|
writeToDspRingbuffer( &e );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-10-03 02:18:06 +02:00
|
|
|
EventTrackSendActive e( track->ID, SEND_KEY, false );
|
2013-09-11 03:06:33 +02:00
|
|
|
writeToDspRingbuffer( &e );
|
|
|
|
}
|
2013-10-18 02:28:00 +02:00
|
|
|
//printf("track %i post send %s\n", track->ID, b ? "off" : "on" );
|
2013-09-10 23:26:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-03 02:50:16 +02:00
|
|
|
void gtrack_xsideDial_cb(Fl_Widget *w, void *data)
|
2013-09-10 23:26:37 +02:00
|
|
|
{
|
|
|
|
GTrack* track = (GTrack*) data;
|
2013-10-03 02:18:06 +02:00
|
|
|
EventTrackSend e( track->ID, SEND_XSIDE, ((Avtk::Dial*)w)->value() );
|
2013-09-10 23:26:37 +02:00
|
|
|
writeToDspRingbuffer( &e );
|
2013-10-18 02:28:00 +02:00
|
|
|
//printf("track %i side send %f\n", track->ID, ((Avtk::Dial*)w)->value() );
|
2013-09-10 23:26:37 +02:00
|
|
|
}
|
2013-09-23 16:23:48 +02:00
|
|
|
|
2013-09-10 23:26:37 +02:00
|
|
|
void gtrack_vol_cb(Fl_Widget *w, void *data)
|
|
|
|
{
|
|
|
|
GTrack* track = (GTrack*) data;
|
|
|
|
EventTrackVol e( track->ID, ((Avtk::Volume*)w)->value() );
|
|
|
|
writeToDspRingbuffer( &e );
|
2013-10-18 02:28:00 +02:00
|
|
|
//printf("track %i vol %f\n", track->ID, ((Avtk::Dial*)w)->value() );
|
2013-09-10 23:26:37 +02:00
|
|
|
}
|
2013-09-23 16:23:48 +02:00
|
|
|
|
|
|
|
|
2013-10-03 02:50:16 +02:00
|
|
|
void gtrack_send_cb(Fl_Widget *w, void *data)
|
2013-09-21 00:28:59 +02:00
|
|
|
{
|
2013-09-23 13:51:41 +02:00
|
|
|
GTrack* track = (GTrack*) data;
|
2013-09-21 00:28:59 +02:00
|
|
|
Avtk::LightButton* d = (Avtk::LightButton*)w;
|
|
|
|
bool b = d->value();
|
|
|
|
d->value( !b );
|
|
|
|
if ( b < 0.5 )
|
|
|
|
{
|
2013-10-03 02:18:06 +02:00
|
|
|
EventTrackSendActive e( track->ID, SEND_POSTFADER, 1.0f );
|
2013-09-21 00:28:59 +02:00
|
|
|
writeToDspRingbuffer( &e );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-10-03 02:18:06 +02:00
|
|
|
EventTrackSendActive e( track->ID, SEND_POSTFADER, 0.0f );
|
2013-09-21 00:28:59 +02:00
|
|
|
writeToDspRingbuffer( &e );
|
|
|
|
}
|
2013-10-18 02:28:00 +02:00
|
|
|
//printf("track %i reverb send %s\n", track->ID, b ? "true" : "false" );
|
2013-09-21 00:28:59 +02:00
|
|
|
}
|
|
|
|
void gtrack_record_cb(Fl_Widget *w, void *data)
|
|
|
|
{
|
2013-09-23 13:51:41 +02:00
|
|
|
GTrack* track = (GTrack*) data;
|
2013-09-21 00:28:59 +02:00
|
|
|
Avtk::LightButton* d = (Avtk::LightButton*)w;
|
|
|
|
bool b = d->value();
|
2013-09-23 13:51:41 +02:00
|
|
|
if ( b < 0.5 )
|
|
|
|
{
|
|
|
|
EventTrackRecordArm e( track->ID, 1.0f );
|
|
|
|
writeToDspRingbuffer( &e );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EventTrackRecordArm e( track->ID, 0.0f );
|
|
|
|
writeToDspRingbuffer( &e );
|
|
|
|
}
|
2013-10-18 02:28:00 +02:00
|
|
|
//printf("track %i record Arm %s\n", track->ID, b ? "off" : "on" );
|
2013-09-23 13:51:41 +02:00
|
|
|
}
|
|
|
|
|