-Working on Clipselector, Stereo loading, and GenericMIDI cruft.

This commit is contained in:
Harry van Haaren 2013-11-19 23:34:12 +00:00
parent dabf78adbc
commit b4c36dbf4f
3 changed files with 21 additions and 67 deletions

View file

@ -103,9 +103,13 @@ void ClipSelector::draw()
int clipWidth = w - 2;
int clipHeight = (h / numClips);
int xOff = x+clipHeight/2;
int drawY = y + 1;
for( int i = 0; i < numClips; i++) // draw each clip
{
int yOff = drawY+13;
cairo_rectangle( cr, x+2, drawY, clipWidth-1, clipHeight - 4 );
cairo_set_source_rgba(cr, 66 / 255.f, 66 / 255.f , 66 / 255.f, 0.4);
cairo_fill(cr);
@ -116,7 +120,8 @@ void ClipSelector::draw()
{
cairo_set_source_rgba(cr, 1.f, 0 / 255.f , 0 / 255.f, 1.f);
cairo_fill(cr);
cairo_arc( cr, x+14, drawY+13, 4.3, 0, 6.29 );
//cairo_arc( cr, x+14, drawY+13, 4.3, 0, 6.29 );
cairo_arc( cr, xOff, yOff, 4.3, 0, 6.29 );
cairo_set_source_rgba(cr, 0, 0, 0, 1.f);
cairo_fill(cr);
}
@ -124,8 +129,8 @@ void ClipSelector::draw()
{
cairo_set_source_rgba(cr, 0.0, 1.0, 0, 1.f );
cairo_fill(cr);
cairo_move_to( cr, x+10, drawY+8 );
cairo_line_to( cr, x+19, drawY+13 );
cairo_move_to( cr, xOff-4, drawY+8 );
cairo_line_to( cr, xOff+5, drawY+13 );
cairo_line_to( cr, x+10, drawY+18 );
cairo_close_path(cr);
cairo_set_source_rgba(cr, 0, 0, 0, 1.f);

View file

@ -757,71 +757,21 @@ Binding* GenericMIDI::setupBinding( cJSON* binding )
tmp->status = statusJson->valueint;
tmp->data = dataJson->valueint;
// gets the Action type from the JSON string
tmp->action = Event::getTypeFromName(actionJson->valuestring);
tmp->send = Event::INPUT_TO_XSIDE;
/*
if ( strcmp( actionJson->valuestring, getPrettyName(TRACK_VOLUME) ) == 0 ) {
tmp->action = Event::TRACK_VOLUME;
} else if ( strcmp( actionJson->valuestring, getPrettyName(TRACK_SEND) ) == 0 ) {
tmp->action = Event::TRACK_SEND;
// FIXME: read this from the .ctlr file!!
tmp->send = Event::SEND_POSTFADER;
}
else if ( strcmp( actionJson->valuestring, getPrettyName(MASTER_INPUT_VOL) ) == 0 ) {
tmp->action = Event::MASTER_INPUT_VOL;
}
else if ( strcmp( actionJson->valuestring, getPrettyName(MASTER_INPUT_TO) ) == 0 ) {
tmp->action = Event::MASTER_INPUT_TO;
tmp->send = Event::INPUT_TO_MIX;
}
else if ( strcmp( actionJson->valuestring, getPrettyName(MASTER_INPUT_TO_ACTIVE) ) == 0 ) {
tmp->action = Event::MASTER_INPUT_TO_ACTIVE;
tmp->send = Event::INPUT_TO_MIX;
}
else if ( strcmp( actionJson->valuestring, getPrettyName(MASTER_INPUT_TO) ) == 0 ) {
tmp->action = Event::MASTER_INPUT_TO;
tmp->send = Event::INPUT_TO_SEND;
}
else if ( strcmp( actionJson->valuestring, "input:to_send_active" ) == 0 ) {
tmp->action = Event::MASTER_INPUT_TO_ACTIVE;
tmp->send = Event::INPUT_TO_SEND;
}
else if ( strcmp( actionJson->valuestring, "input:to_x_side" ) == 0 ) {
tmp->action = Event::MASTER_INPUT_TO;
tmp->send = Event::INPUT_TO_XSIDE;
}
else if ( strcmp( actionJson->valuestring, "input:to_x_side_active" ) == 0 ) {
tmp->action = Event::MASTER_INPUT_TO_ACTIVE;
tmp->send = Event::INPUT_TO_XSIDE;
}
else if ( strcmp( actionJson->valuestring, "track:xside" ) == 0 ) {
tmp->action = Event::TRACK_SEND;
tmp->send = Event::SEND_XSIDE;
}
else if ( strcmp( actionJson->valuestring, "track:send_active" ) == 0 ) {
tmp->action = Event::TRACK_SEND_ACTIVE;
tmp->send = Event::SEND_POSTFADER;
}
else if ( strcmp( actionJson->valuestring, "track:key_active" ) == 0 ) {
tmp->action = Event::TRACK_SEND_ACTIVE;
tmp->send = Event::SEND_KEY;
}
else if ( strcmp( actionJson->valuestring, "track:record_arm" ) == 0 ) {
tmp->action = Event::TRACK_RECORD_ARM;
// check what our send value should be:
tmp->send = -1;
cJSON* sendJson = cJSON_GetObjectItem( binding, "send" );
if ( sendJson )
{
tmp->send = sendJson->valueint;
}
else if ( strcmp( actionJson->valuestring, "grid:pressed" ) == 0 ) {
tmp->action = Event::GRID_EVENT;
tmp->active = 1; // press event
}
else if ( strcmp( actionJson->valuestring, "grid:released" ) == 0 ) {
tmp->action = Event::GRID_EVENT;
tmp->active = 0; // release event
}
*/
if ( strcmp( actionJson->valuestring, "grid:clipstate" ) == 0 ) {
if ( strcmp( actionJson->valuestring, "grid:clip_state" ) == 0 )
{
tmp->action = Event::GRID_STATE;
// read "state", to bind multiple values depending on clip state

View file

@ -109,9 +109,9 @@ int DiskReader::loadSample( int track, int scene, string path )
/// load the sample
SndfileHandle infile( path, SFM_READ );
std::vector<float> buf( infile.frames() );
infile.read( &buf[0] , infile.frames() );
infile.read( (float*)&buf[0] , infile.frames() );
LUPPP_NOTE("Loading file with %i chnls, frames %i", infile.channels(), infile.frames() );
LUPPP_NOTE("Loading file with %i chnls, frames %i,buffer size %i", infile.channels(), infile.frames(), buf.size() );
/// kick stereo channel?
int chnls = infile.channels();
@ -127,7 +127,6 @@ int DiskReader::loadSample( int track, int scene, string path )
tmp.at(i) = buf.at( i * chnls );
}
// swap the buffers
buf.swap( tmp );
}