kcApp.h/cpp : Added TakeSeqBldr related controls.
This commit is contained in:
parent
a8e4e137d2
commit
a96fd43cab
197
src/kc/kcApp.cpp
197
src/kc/kcApp.cpp
@ -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,24 +2272,56 @@ 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( cmAdIfSendMsgToAudioDSP(
|
||||
_aiH,
|
||||
cp->asSubIdx,
|
||||
cp->mstrFl ? kUiMstrSelAsId : kUiSelAsId,
|
||||
kValueDuiId,
|
||||
0,
|
||||
cp->instId,
|
||||
instVarId,
|
||||
&value) != kOkAiRC)
|
||||
{
|
||||
cmErrMsg(&_ctx->err,kEngFailKmRC,"An attempt to send a UI message to the audio DSP interface failed.");
|
||||
}
|
||||
if( instVarId != cmInvalidId )
|
||||
if( cmAdIfSendMsgToAudioDSP(
|
||||
_aiH,
|
||||
cp->asSubIdx,
|
||||
cp->mstrFl ? kUiMstrSelAsId : kUiSelAsId,
|
||||
kValueDuiId,
|
||||
0,
|
||||
cp->instId,
|
||||
instVarId,
|
||||
&value) != kOkAiRC)
|
||||
{
|
||||
cmErrMsg(&_ctx->err,kEngFailKmRC,"An attempt to send a UI message to the audio DSP interface failed.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -48,17 +48,17 @@ public:
|
||||
virtual void tlCtlNewScoreFile( tlCtl* tlCtl, const cmChar_t* fn );
|
||||
|
||||
|
||||
void print( const char* fmt, ... );
|
||||
void print( const char* fmt, ... );
|
||||
void vprint( const char* fmt, va_list vl );
|
||||
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
kMenuH = 30,
|
||||
kMenuH = 30,
|
||||
kStatusH = 30,
|
||||
kIndH = 25,
|
||||
kIndW = 25,
|
||||
kIndH = 25,
|
||||
kIndW = 25,
|
||||
|
||||
kSsPhaseMax = 20
|
||||
};
|
||||
@ -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 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user