kcApp.h/cpp : Added TakeSeqBldr related controls.

This commit is contained in:
Kevin Larke 2015-03-31 11:02:18 -07:00
parent a8e4e137d2
commit a96fd43cab
2 changed files with 220 additions and 20 deletions

View File

@ -48,6 +48,7 @@
#include "cmMidiFile.h"
#include "cmTimeLine.h"
#include "cmScore.h"
#include "cmTakeSeqBldr.h"
#include "cmdIf.h"
#include "tlCtl.h"
#include "kcApp.h"
@ -58,6 +59,9 @@
#include "cmGrPlot.h"
#include "cmGrPage.h"
#include "cmGrFltk.h"
#include "cmGrFltk.h"
#include "gvHashFunc.h"
#include "cmGrTksbFltk.h"
#define TIMER_PERIOD (1.0/20.0) // 50ms
@ -648,8 +652,6 @@ void kcApp::_setTextValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp
}
}
void kcApp::_createFnameCtl( const cmDspUiHdr_t* m )
{
int x,y,w=0,h=0;
@ -1275,6 +1277,125 @@ void kcApp::_setScorValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp
}
}
void kcApp::_createTksb( const cmDspUiHdr_t* m )
{
int x,y,w=0,h=0;
page_t* pg = _createPage("Bldr");
ctl_t* cp = _createCtl(m, kTksbTypeId, x,y,w,h, true );
w = pg->grp->w();
h = pg->grp->h();
// currently we only support one Take sequence builder control because
// we have not yet implmenented a method of providing
// timer callbacks to a list of UI controls
if( _tlCtl != NULL )
cp->u.tksb.tlctl = _tlCtl;
else
{
_tlCtl = new tlCtl(_ctx,this,_menu,this);
cp->u.tksb.tlctl = _tlCtl;
}
Fl_Widget* wdgt = cp->u.tksb.tlctl->initTakeSeqBldrCtlr(x,y,w,h);
_insertNewCtl(cp,m,wdgt,cp->u.tksb.varIdArray,kTksbVarCnt);
}
void kcApp::_setTksbValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp )
{
unsigned i;
for(i=0; i<kTksbVarCnt; ++i)
if( cp->u.tksb.varIdArray[i] == instVarId )
{
switch(i)
{
case kTksbFileArgIdx:
break;
case kTksbPtrArgIdx:
if( _tlCtl != NULL )
_tlCtl->openTakeSeqBldr(cmDsvPtr(vp));
break;
case kTksbSelArgIdx:
// TODO: call cmGrTksbFltk from here to to animate the time cursor
// with a new location
break;
case kTksbRefreshArgIdx:
break;
default:
{ assert(0); }
}
}
}
void kcApp::_createTksr( const cmDspUiHdr_t* m )
{
int x,y,w=0,h=0;
page_t* pg = _createPage("Rndr");
ctl_t* cp = _createCtl(m, kTksrTypeId, x,y,w,h, true );
w = pg->grp->w();
h = pg->grp->h();
// currently we only support one Take sequence builder control because
// we have not yet implmenented a method of providing
// timer callbacks to a list of UI controls
if( _tlCtl != NULL )
cp->u.tksr.tlctl = _tlCtl;
else
{
_tlCtl = new tlCtl(_ctx,this,_menu,this);
cp->u.tksr.tlctl = _tlCtl;
}
Fl_Widget* wdgt = cp->u.tksr.tlctl->initTakeSeqRendCtlr(x,y,w,h);
_insertNewCtl(cp,m,wdgt,cp->u.tksr.varIdArray,kTksrVarCnt);
}
void kcApp::_setTksrValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp )
{
unsigned i;
for(i=0; i<kTksrVarCnt; ++i)
if( cp->u.tksr.varIdArray[i] == instVarId )
{
switch(i)
{
case kTksrPtrArgIdx:
if( _tlCtl != NULL )
_tlCtl->openTakeSeqRend(cmDsvPtr(vp));
break;
case kTksrRefreshArgIdx:
if( _tlCtl != NULL )
_tlCtl->refreshTakeSeqRend();
break;
case kTksrSelArgIdx:
break;
default:
{ assert(0); }
}
}
}
void kcApp::_newColumn( const cmDspUiHdr_t* m )
{
_incrColW = cmDsvGetUInt(&m->value);
@ -1680,6 +1801,14 @@ void kcApp::_onRecvValue( const cmDspUiHdr_t* m )
_setScorValue(cp, m->instVarId, &m->value);
break;
case kTksbTypeId:
_setTksbValue(cp, m->instVarId, &m->value);
break;
case kTksrTypeId:
_setTksrValue(cp, m->instVarId, &m->value);
break;
default:
assert(0);
}
@ -1737,6 +1866,14 @@ void kcApp::_handleUiMsg( const cmDspUiHdr_t* m )
_createScor(m);
break;
case kTakeSeqBldrDuiId:
_createTksb(m);
break;
case kTakeSeqRendDuiId:
_createTksr(m);
break;
case kValueDuiId:
_onRecvValue(m);
break;
@ -2135,12 +2272,44 @@ void kcApp::_ctl_cb(ctl_t* cp)
}
break;
case kTksbTypeId:
{
cmGrTksbFltk* tksbCtl = dynamic_cast<cmGrTksbFltk*>(cp->wdgtPtr);
switch( tksbCtl->cbTypeId() )
{
case cmGrTksbFltk::kSelectTId:
{
instVarId = cp->u.tksb.varIdArray[ kTksbSelArgIdx ];
unsigned selEleIdx = cp->u.tksb.tlctl->tksbSelectedEleIndex();
cmDsvSetUInt(&value, selEleIdx );
}
break;
case cmGrTksbFltk::kRefreshTId:
instVarId = cp->u.tksb.varIdArray[ kTksbRefreshArgIdx ];
cmDsvSetInt(&value,0);
break;
default:
{ assert(0); }
}
}
break;
case kTksrTypeId:
{
}
break;
default:
{assert(0);}
}
if( instVarId != cmInvalidId )
if( cmAdIfSendMsgToAudioDSP(
_aiH,
cp->asSubIdx,

View File

@ -77,6 +77,8 @@ private:
kMetrTypeId,
kTmlnTypeId,
kScorTypeId,
kTksbTypeId,
kTksrTypeId,
kSldrMinArgIdx = 0,
kSldrMaxArgIdx = 1,
@ -133,7 +135,18 @@ private:
kScorDynArgIdx = 7,
kScorValTypeArgIdx = 8,
kScorValueArgIdx = 9,
kScorVarCnt = 10
kScorVarCnt = 10,
kTksbFileArgIdx = 0,
kTksbPtrArgIdx = 1,
kTksbSelArgIdx = 2,
kTksbRefreshArgIdx = 3,
kTksbVarCnt = 4,
kTksrPtrArgIdx = 0,
kTksrRefreshArgIdx = 1,
kTksrSelArgIdx = 2,
kTksrVarCnt = 3
};
@ -239,6 +252,18 @@ private:
unsigned varIdArray[ kScorVarCnt ];
} scor_t;
typedef struct tksb_str
{
tlCtl* tlctl;
unsigned varIdArray[ kTksbVarCnt ];
} tksb_t;
typedef struct tksr_str
{
tlCtl* tlctl;
unsigned varIdArray[ kTksrVarCnt ];
} tksr_t;
typedef struct ctl_str
{
@ -260,6 +285,8 @@ private:
metr_t metr;
tmln_t tmln;
scor_t scor;
tksb_t tksb;
tksr_t tksr;
} u;
struct ctl_str* linkPtr;
} ctl_t;
@ -288,7 +315,6 @@ private:
} ss_t;
cmCtx_t* _ctx;
cmPrH_t _prH;
cmAiH_t _aiH;
@ -355,6 +381,11 @@ private:
void _setTmlnValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
void _createScor( const cmDspUiHdr_t* m );
void _setScorValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
void _createTksb( const cmDspUiHdr_t* m );
void _setTksbValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
void _createTksr( const cmDspUiHdr_t* m );
void _setTksrValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
void _newColumn( const cmDspUiHdr_t* m );