Added score control, cleaned up and removed dead code.

This commit is contained in:
kpl 2012-11-26 23:21:26 -08:00
parent e1593195ea
commit 662d12cc62
2 changed files with 218 additions and 146 deletions

View File

@ -63,11 +63,14 @@
kcApp::kcApp(cmCtx_t* ctx, cmTsMp1cH_t printqH, int w, int h, const cmChar_t* title, cmAiH_t aiH, int argc, char* argv[] )
: Fl_Double_Window(w, h,title),
splt(NULL),_menu(NULL),_aiH(aiH),
_statIdx(0),_pageList(NULL),_ctlList(NULL),
_ctx(ctx),_aiH(aiH),
_menu(NULL),_splt(NULL),_con(NULL),_tabs(NULL),_mstr_grp(NULL),
_as_btn(NULL),_ai_btn(NULL),_ao_btn(NULL),_pgm_btn(NULL),
_ss_btn(NULL),_sr_btn(NULL),_ena_chk(NULL),
_pageList(NULL),_ctlList(NULL),
_stopTimerFl(false),_newPageFl(true),
_incrColW(0),_colW(0),_horzBordFl(false),_horzBord(0),
_closeCnt(0),_ssCnt(0),_ssArray(0),_ssPhase(0),_ssUpdateFl(false),
_ssCnt(0),_ssArray(0),_ssPhase(0),_ssUpdateFl(false),
_printqH(printqH),_printFl(0),
_tlCtl(NULL)
{
@ -79,48 +82,48 @@ kcApp::kcApp(cmCtx_t* ctx, cmTsMp1cH_t printqH, int w, int h, const cmChar_t* ti
// and a horizontal splitter on the bottom
begin();
_createMenu(w,kMenuH);
splt = new Fl_HSplitter(0, kMenuH, w, h-kStatusH-kMenuH, h-kStatusH-kMenuH-100);
_splt = new Fl_HSplitter(0, kMenuH, w, h-kStatusH-kMenuH, h-kStatusH-kMenuH-100);
end();
// Create a text display object for console output andvadd it to the lower splitter area
buf = new Fl_Text_Buffer();
con = new Fl_Text_Display(splt->container2->x(),splt->container2->y(),splt->container2->w(),splt->container2->h());
con->buffer(buf);
splt->container2->add(con);
Fl_Text_Buffer* buf = new Fl_Text_Buffer();
_con = new Fl_Text_Display(_splt->container2->x(),_splt->container2->y(),_splt->container2->w(),_splt->container2->h());
_con->buffer(buf);
_splt->container2->add(_con);
// Create a tab view and added it to the upper splitter area
tabs = new Fl_Tabs(splt->container1->x(),splt->container1->y(),splt->container1->w(),splt->container1->h());
tabs->callback(_s_tab_cb,this);
tabs->end();
splt->container1->add(tabs);
_tabs = new Fl_Tabs(_splt->container1->x(),_splt->container1->y(),_splt->container1->w(),_splt->container1->h());
_tabs->callback(_s_tab_cb,this);
_tabs->end();
_splt->container1->add(_tabs);
int tx,ty,th,tw;
tabs->client_area(tx,ty,tw,th);
_tabs->client_area(tx,ty,tw,th);
// Create the 'Setup' tab group
Fl_Group* setup_grp = new Fl_Group(tx,ty,tw,th,"Setup");
tabs->add(setup_grp);
_tabs->add(setup_grp);
_createSetupDlg(setup_grp);
// Create the master group
tabs->add(mstr_grp = new Fl_Group(tx,ty,tw,th,"Master"));
_tabs->add(_mstr_grp = new Fl_Group(tx,ty,tw,th,"Master"));
// Create an empty tab group and make it resizable
// to prevent the other tab groups from being resizable.
Fl_Group* wdgt = new Fl_Group(tx,ty+30,1,1);
tabs->add(wdgt);
tabs->resizable(wdgt); // make other tabs non-resizable
_tabs->add(wdgt);
_tabs->resizable(wdgt); // make other tabs non-resizable
// make the splitter the resizable group element (thereby making the menu non-resizable).
// see:http://fltk.org/articles.php?L415+I0+T+M1000+P1
resizable(splt);
resizable(_splt);
show(argc, argv);
// direct all output to the console window
cmRptSetup(&_ctx.rpt,_s_print,_s_print, this);
cmRptSetup(&_ctx->rpt,_s_print,_s_print, this);
cmTsMp1cSetCbFunc(_printqH, _s_print_queue_cb, this );
// install a timer to check for messages from the engine
@ -138,7 +141,7 @@ kcApp::~kcApp()
void kcApp::resize(int x, int y, int w, int h)
{
Fl_Double_Window::resize(x, y, w, h);
splt->resize(0, kMenuH, w, h-kStatusH);
_splt->resize(0, kMenuH, w, h-kStatusH);
}
void kcApp::tlCtlNewTimeLineFile( tlCtl* tlCtl, const cmChar_t* fn )
@ -161,41 +164,41 @@ void kcApp::_createSetupDlg( Fl_Group* grp )
btn->callback( _s_btn_cb, kAudDevRptBtnId );
yy += btn->h() + vBord;
as_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Audio System Cfg");
as_btn->callback( _s_btn_cb, kAudioSysCfgBtnId);
yy += as_btn->h() + vBord;
_as_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Audio System Cfg");
_as_btn->callback( _s_btn_cb, kAudioSysCfgBtnId);
yy += _as_btn->h() + vBord;
ai_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Audio Input Devices");
ai_btn->callback( _s_btn_cb, kInAudDevBtnId);
yy += ai_btn->h() + vBord;
_ai_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Audio Input Devices");
_ai_btn->callback( _s_btn_cb, kInAudDevBtnId);
yy += _ai_btn->h() + vBord;
ao_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Audio Output Devices");
ao_btn->callback( _s_btn_cb, kOutAudDevBtnId);
yy += ao_btn->h() + vBord;
_ao_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Audio Output Devices");
_ao_btn->callback( _s_btn_cb, kOutAudDevBtnId);
yy += _ao_btn->h() + vBord;
pgm_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Programs");
pgm_btn->callback( _s_btn_cb, kPgmBtnId);
yy += pgm_btn->h() + vBord;
_pgm_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Programs");
_pgm_btn->callback( _s_btn_cb, kPgmBtnId);
yy += _pgm_btn->h() + vBord;
ss_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Sub-System");
ss_btn->callback( _s_btn_cb, kSubSystemIdxBtnId);
yy += ss_btn->h() + vBord;
_ss_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Sub-System");
_ss_btn->callback( _s_btn_cb, kSubSystemIdxBtnId);
yy += _ss_btn->h() + vBord;
sr_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Sample Rate");
sr_btn->callback( _s_btn_cb, kSrateBtnId);
sr_btn->add("44100",0,NULL,(void*)44100,0);
sr_btn->add("48000",0,NULL,(void*)48000,0);
sr_btn->add("96000",0,NULL,(void*)96000,0);
_sr_btn = new Fl_Menu_Button(xx,yy,ctl_width,kMenuH,"Sample Rate");
_sr_btn->callback( _s_btn_cb, kSrateBtnId);
_sr_btn->add("44100",0,NULL,(void*)44100,0);
_sr_btn->add("48000",0,NULL,(void*)48000,0);
_sr_btn->add("96000",0,NULL,(void*)96000,0);
yy += sr_btn->h() + vBord;
yy += _sr_btn->h() + vBord;
btn = new Fl_Button(xx,yy,ctl_width,kMenuH,"Test");
btn->callback( _s_btn_cb, kTestBtnId );
yy += btn->h() + vBord;
ena_chk = new Fl_Check_Button(xx,yy,ctl_width,kMenuH,"Enable Audio");
ena_chk->callback( _s_btn_cb, kEnableBtnId );
yy += ena_chk->h() + vBord;
_ena_chk = new Fl_Check_Button(xx,yy,ctl_width,kMenuH,"Enable Audio");
_ena_chk->callback( _s_btn_cb, kEnableBtnId );
yy += _ena_chk->h() + vBord;
// place this ctrl in the lower left corner to prevent the other controls from resizing
Fl_Box* bx = new Fl_Box(FL_NO_BOX,xx+ctl_width,yy,10,10,NULL);
@ -222,7 +225,7 @@ void kcApp::_createMenu(int w, int h)
kcApp::page_t* kcApp::_createPage( const char* title )
{
int tx,ty,th,tw;
tabs->client_area(tx,ty,tw,th);
_tabs->client_area(tx,ty,tw,th);
page_t* page = new page_t;
page->link = _pageList;
@ -231,13 +234,13 @@ kcApp::page_t* kcApp::_createPage( const char* title )
_newPageFl = true;
// Create the 'Controls' tab group
tabs->begin();
_tabs->begin();
page->grp = new Fl_Group(tx,ty,tw,th,title);
page->grp->begin();
Fl_Box* bx = new Fl_Box(FL_NO_BOX,page->grp->x()+page->grp->w(),page->grp->y()+page->grp->h(),1,1,NULL);
page->grp->resizable(bx);
page->grp->end();
tabs->end();
_tabs->end();
return page;
}
@ -293,7 +296,7 @@ void kcApp::_clearCtlList(bool mstrFl)
_ctlList = ncl; // make the new ctl list the current ctl list
if( mstrFl )
mstr_grp->clear();
_mstr_grp->clear();
_tlCtl = NULL;
}
@ -484,7 +487,7 @@ void kcApp::_insertNewCtl( ctl_t* cp, const cmDspUiHdr_t* m, Fl_Widget* wdgt, un
// _genNewCtlPosn() should have been called before this - where a new page list would have been created.
assert( cp->mstrFl || (cp->mstrFl==false && _pageList != NULL) );
Fl_Group* grp = cp->mstrFl ? mstr_grp : _pageList->grp;
Fl_Group* grp = cp->mstrFl ? _mstr_grp : _pageList->grp;
cp->wdgtPtr = wdgt;
cp->wdgtPtr->callback(_s_ctl_cb, cp );
@ -746,15 +749,15 @@ kcApp::kcKmRC_t kcApp::_loadMlist( ctl_t* cp, const cmJsonNode_t* np )
switch(jsRC)
{
case kBufTooSmallJsRC:
rc = cmErrMsg(&_ctx.err,kMlistLoadFailKmRC,"The msg list line character buffer is too small at JSON array element index %i.",ri);
rc = cmErrMsg(&_ctx->err,kMlistLoadFailKmRC,"The msg list line character buffer is too small at JSON array element index %i.",ri);
break;
case kInvalidNodeTypeJsRC:
rc = cmErrMsg(&_ctx.err,kMlistLoadFailKmRC,"The msg list array element at index %i is not a JSON leaf node.",ri);
rc = cmErrMsg(&_ctx->err,kMlistLoadFailKmRC,"The msg list array element at index %i is not a JSON leaf node.",ri);
break;
default:
rc = cmErrMsg(&_ctx.err,kMlistLoadFailKmRC,"JSON to msg list text conversion failed on array element %i.",ri);
rc = cmErrMsg(&_ctx->err,kMlistLoadFailKmRC,"JSON to msg list text conversion failed on array element %i.",ri);
break;
}
break;
@ -768,7 +771,7 @@ kcApp::kcKmRC_t kcApp::_loadMlist( ctl_t* cp, const cmJsonNode_t* np )
if( j+1 < m )
{
if( bep - bbp < 1 )
rc = cmErrMsg(&_ctx.err,kMlistLoadFailKmRC,"The msg list line buffer is too small.");
rc = cmErrMsg(&_ctx->err,kMlistLoadFailKmRC,"The msg list line buffer is too small.");
else
{
*bbp++ = '\t';
@ -1093,13 +1096,17 @@ void kcApp::_createTmln( const cmDspUiHdr_t* m )
w = pg->grp->w();
h = pg->grp->h();
cp->u.tmln.tlctl = new tlCtl(&_ctx,this,_menu,this);
// currently we only support one time-line control because
// currently we only support one score control because
// we have not yet implmenented a method of providing
// timer callbacks to a list of UI controls
assert( _tlCtl == NULL );
_tlCtl = cp->u.tmln.tlctl;
if( _tlCtl != NULL )
cp->u.tmln.tlctl = _tlCtl;
else
{
_tlCtl = new tlCtl(_ctx,this,_menu,this);
cp->u.tmln.tlctl = _tlCtl;
}
Fl_Widget* wdgt = cp->u.tmln.tlctl->initTimeLineCtlr(x,y,w,h);
@ -1110,17 +1117,12 @@ void kcApp::_createTmln( const cmDspUiHdr_t* m )
void kcApp::_setTmlnValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp )
{
unsigned i=0;
//tlCtl* tp = cp->u.tmln.tlctl;
for(i=0; i<kTmlnVarCnt; ++i)
if( cp->u.tmln.varIdArray[i] == instVarId )
{
switch(i)
{
case kTmlnSelArgIdx:
//tp->value( cmDsvStrcz(vp));
break;
case kTmlnFileArgIdx:
{
@ -1144,12 +1146,80 @@ void kcApp::_setTmlnValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp
}
break;
case kTmlnSelArgIdx:
//tp->value( cmDsvStrcz(vp));
break;
case kTmlnCursArgIdx:
cp->u.tmln.tlctl->setAudioFileCursor(cmDsvUInt(vp));
break;
default:
{ assert(0); }
}
}
}
void kcApp::_createScor( const cmDspUiHdr_t* m )
{
int x,y,w=0,h=0;
page_t* pg = _createPage("Score");
ctl_t* cp = _createCtl(m, kScorTypeId, x,y,w,h, true );
w = pg->grp->w();
h = pg->grp->h();
// currently we only support one score control because
// we have not yet implmenented a method of providing
// timer callbacks to a list of UI controls
if( _tlCtl != NULL )
cp->u.scor.tlctl = _tlCtl;
else
{
_tlCtl = new tlCtl(_ctx,this,_menu,this);
cp->u.scor.tlctl = _tlCtl;
}
Fl_Widget* wdgt = cp->u.scor.tlctl->initScoreCtlr(x,y,w,h);
_insertNewCtl(cp,m,wdgt,cp->u.scor.varIdArray,kScorVarCnt);
}
void kcApp::_setScorValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp )
{
unsigned i=0;
//tlCtl* tp = cp->u.scor.tlctl;
for(i=0; i<kScorVarCnt; ++i)
if( cp->u.scor.varIdArray[i] == instVarId )
{
switch(i)
{
case kScorSelArgIdx:
//tp->value( cmDsvStrcz(vp));
break;
case kScorFileArgIdx:
{
const char* fn;
if((fn = cmDsvStrcz(vp)) != NULL )
{
cp->u.scor.tlctl->openScoreFile(fn);
//cp->u.scor.tlctl->redraw();
}
}
break;
default:
{ assert(0); }
}
}
}
void kcApp::_newColumn( const cmDspUiHdr_t* m )
{
@ -1162,14 +1232,14 @@ void kcApp::_newColumn( const cmDspUiHdr_t* m )
void kcApp::_insertAudioSysCfgLabel(unsigned long idx, const char* label)
{
if( idx == 0 )
as_btn->clear();
_as_btn->clear();
as_btn->add(label,0,NULL,(void*)idx,0);
_as_btn->add(label,0,NULL,(void*)idx,0);
}
void kcApp::_insertDeviceLabel( unsigned long devIdx, bool inputFl, const cmChar_t* label )
{
Fl_Menu_Button* bp = inputFl ? ai_btn : ao_btn;
Fl_Menu_Button* bp = inputFl ? _ai_btn : _ao_btn;
// ??? if( idx == 0 )
// bp->clear();
@ -1181,9 +1251,9 @@ void kcApp::_insertDeviceLabel( unsigned long devIdx, bool inputFl, const cmChar
void kcApp::_insertProgramLabel( unsigned long idx, const cmChar_t* label )
{
if( idx == 0 )
pgm_btn->clear();
_pgm_btn->clear();
pgm_btn->add(label,0,NULL,(void*)idx,0);
_pgm_btn->add(label,0,NULL,(void*)idx,0);
}
void kcApp::_insertSubSysCnt( unsigned long subSysCnt )
@ -1209,11 +1279,11 @@ void kcApp::_insertSubSysCnt( unsigned long subSysCnt )
id = i-1;
}
ss_btn->add(label,0,NULL,(void*)id);
_ss_btn->add(label,0,NULL,(void*)id);
}
ss_btn->value(0);
ss_btn->copy_label( ss_btn->mvalue()->label() );
_ss_btn->value(0);
_ss_btn->copy_label( _ss_btn->mvalue()->label() );
}
unsigned kcApp::_getCurAudioSubSysIdx()
@ -1221,7 +1291,7 @@ unsigned kcApp::_getCurAudioSubSysIdx()
const Fl_Menu_Item* mip;
unsigned retVal = 0;
if( (mip = ss_btn->mvalue()) != NULL)
if( (mip = _ss_btn->mvalue()) != NULL)
retVal = mip->argument();
return retVal;
@ -1249,7 +1319,7 @@ void kcApp::_setDeviceMenuButton( unsigned asSubIdx, bool inputFl, unsigned devI
if( _getCurAudioSubSysIdx() != asSubIdx )
return;
Fl_Menu_Button* mbp = inputFl ? ai_btn : ao_btn;
Fl_Menu_Button* mbp = inputFl ? _ai_btn : _ao_btn;
const Fl_Menu_Item* map = mbp->menu();
unsigned n = mbp->size();
@ -1270,18 +1340,18 @@ void kcApp::_setDeviceMenuButton( unsigned asSubIdx, bool inputFl, unsigned devI
void kcApp::_setSampleRateBtn( unsigned value )
{
unsigned i;
unsigned n = sr_btn->size();
unsigned n = _sr_btn->size();
for(i=0; i<n-1; ++i)
{
if( sr_btn->menu()[i].argument() == value )
if( _sr_btn->menu()[i].argument() == value )
{
sr_btn->value(i);
sr_btn->copy_label( sr_btn->mvalue()->label() );
_sr_btn->value(i);
_sr_btn->copy_label( _sr_btn->mvalue()->label() );
return;
}
}
sr_btn->copy_label("Sample Rate?");
_sr_btn->copy_label("Sample Rate?");
}
@ -1454,7 +1524,7 @@ void kcApp::_handleSsInitMsg( const cmAudioSysSsInitMsg_t* m, const cmChar_t* in
prog->minimum(0);
prog->maximum(1);
prog->copy_label(lblArray[i]);
mstr_grp->add(prog);
_mstr_grp->add(prog);
ss->cnt[i] = 0;
ss->prog[i] = prog;
@ -1551,6 +1621,10 @@ void kcApp::_onRecvValue( const cmDspUiHdr_t* m )
_setTmlnValue(cp, m->instVarId, &m->value);
break;
case kScorTypeId:
_setScorValue(cp, m->instVarId, &m->value);
break;
default:
assert(0);
}
@ -1564,7 +1638,7 @@ void kcApp::_handleUiMsg( const cmDspUiHdr_t* m )
switch( m->selId )
{
case kPrintDuiId:
cmDsvPrint(&m->value,NULL,&_ctx.rpt);
cmDsvPrint(&m->value,NULL,&_ctx->rpt);
break;
case kNumberDuiId:
@ -1604,6 +1678,10 @@ void kcApp::_handleUiMsg( const cmDspUiHdr_t* m )
_createTmln(m);
break;
case kScoreDuiId:
_createScor(m);
break;
case kValueDuiId:
_onRecvValue(m);
break;
@ -1640,7 +1718,7 @@ void kcApp::_handleUiMsg( const cmDspUiHdr_t* m )
break;
case kSetAudioCfgDuiId:
_setMenuButton(as_btn,cmDsvUInt(&m->value),"Audio System Cfg");
_setMenuButton(_as_btn,cmDsvUInt(&m->value),"Audio System Cfg");
break;
case kSetAudioDevDuiId:
@ -1652,12 +1730,12 @@ void kcApp::_handleUiMsg( const cmDspUiHdr_t* m )
break;
case kSetPgmDuiId:
_setMenuButton(pgm_btn,cmDsvUInt(&m->value),"Program?");
_setMenuButton(_pgm_btn,cmDsvUInt(&m->value),"Program?");
_clearCtlList(false);
break;
case kEnableDuiId:
ena_chk->value(m->flags);
_ena_chk->value(m->flags);
break;
}
@ -1685,7 +1763,7 @@ void kcApp::_getEngMsg()
if( aiRC == kNoMsgAiRC )
break;
cmErrMsg(&_ctx.err,kEngFailKmRC,"Audio DSP dispatch message request failed.");
cmErrMsg(&_ctx->err,kEngFailKmRC,"Audio DSP dispatch message request failed.");
break;
}
}
@ -1712,7 +1790,7 @@ void kcApp::_testStub()
cmAudioFileTest(
// "/Users/kevin/media/audio/20100819-Kreisberg/fragments/Bass End_21a.wav",
"/Users/kevin/media/audio/McGill-1/1 Audio Track.aiff",
"/Users/kevin/src/octave/cm_audio_file_test.m",_ctx.err.rpt );
"/Users/kevin/src/octave/cm_audio_file_test.m",_ctx->err.rpt );
*/
//cmSymTblTest(&_ctx);
@ -1741,32 +1819,10 @@ void kcApp::_callback(void* data)
{
if( Fl::event() == FL_CLOSE )
{
//unsigned cc = _closeCnt;
ctl_t* cp = _ctlList;
for(; cp!=NULL; cp=cp->linkPtr)
if( cp->typeId == kTmlnTypeId )
delete cp->u.tmln.tlctl;
delete _tlCtl;
_stopTimerFl = true;
// attempt to shut down the pgm
//if( audioDspFinalize() != kOkKmRC )
// ++_closeCnt;
// the first time the pgm fails to shut down
// do not allow the pgm to close the main window
// this will give a chance for the error messages
// to be diplayed in the console - all successive
// times the return value from finalizePgm() is
// ignored and the program is terminated.
/*
if( _closeCnt == 1 && cc==0)
{
deactivate(); // send a strong hint that a problem occurred
return;
}
*/
// When all windows are windows are closed then the app.
// will close - so hiding the application window
@ -1832,13 +1888,13 @@ void kcApp::_s_tab_cb(Fl_Widget* w, void* data)
void kcApp::_tab_cb(Fl_Widget*)
{
Fl_Widget* w = tabs->value();
_ssUpdateFl = w == (Fl_Widget*)mstr_grp;
Fl_Widget* w = _tabs->value();
_ssUpdateFl = w == (Fl_Widget*)_mstr_grp;
_ssPhase = kSsPhaseMax;
if( cmAdIfIsValid(_aiH) )
{
if( cmAdIfEnableStatusNotify(_aiH, _ssUpdateFl ) != kOkAiRC )
cmErrMsg(&_ctx.err,kEngFailKmRC,"A request to enable/disable status notification failed.");
cmErrMsg(&_ctx->err,kEngFailKmRC,"A request to enable/disable status notification failed.");
}
}
@ -1962,6 +2018,15 @@ void kcApp::_ctl_cb(ctl_t* cp)
}
break;
case kScorTypeId:
{
instVarId = cp->u.text.varIdArray[ kScorSelArgIdx ];
unsigned selEleIdx = cp->u.scor.tlctl->scoreSelectedEleIndex();
cmDsvSetUInt(&value, selEleIdx );
}
break;
default:
{assert(0);}
@ -1977,7 +2042,7 @@ void kcApp::_ctl_cb(ctl_t* cp)
instVarId,
&value) != kOkAiRC)
{
cmErrMsg(&_ctx.err,kEngFailKmRC,"An attempt to send a UI message to the audio DSP interface failed.");
cmErrMsg(&_ctx->err,kEngFailKmRC,"An attempt to send a UI message to the audio DSP interface failed.");
}
}
@ -2000,7 +2065,7 @@ void kcApp::vprint(const char* fmt, va_list vl )
{
// use _printFl to guard against recursion which would eventually overflow the stack.
++_printFl;
cmErrMsg(&_ctx.err,kQueueFailKmRC,"Print enqueue failed on msg:%s.",buf);
cmErrMsg(&_ctx->err,kQueueFailKmRC,"Print enqueue failed on msg:%s.",buf);
--_printFl;
}
@ -2035,15 +2100,15 @@ void kcApp::_checkPrintQueue()
if( cmTsMp1cDequeueMsg(_printqH, NULL, 0) != kOkThRC && _printFl==0 )
{
++_printFl;
cmErrMsg(&_ctx.err,kPrintQueFailKmRC,"Print dequeue failed.");
cmErrMsg(&_ctx->err,kPrintQueFailKmRC,"Print dequeue failed.");
--_printFl;
}
}
void kcApp::_print( const char* text )
{
if( con != NULL )
con->insert(text);
if( _con != NULL )
_con->insert(text);
#ifndef NDEBUG
fputs(text,stdout);
#endif

View File

@ -44,9 +44,6 @@ class kcApp : public Fl_Double_Window, public tlCtlRspdr
public:
typedef unsigned kcKmRC_t;
kcApp(cmCtx_t* ctx, cmTsMp1cH_t printQH, int w, int h, const cmChar_t* title, cmAiH_t aiH, int argc, char* argv[] );
virtual ~kcApp();
@ -71,24 +68,6 @@ private:
kSsPhaseMax = 20
};
//Fl_Menu_Bar* menu;
Fl_HSplitter* splt;
Fl_Box* ind[4];
Fl_Text_Buffer* buf;
Fl_Text_Display* con;
Fl_Tabs* tabs;
Fl_Check_Button* ena_chk;
//Fl_Group* ctl_grp;
Fl_Menu_Button* as_btn;
Fl_Menu_Button* ai_btn;
Fl_Menu_Button* ao_btn;
Fl_Menu_Button* pgm_btn;
Fl_Menu_Button* ss_btn;
Fl_Menu_Button* sr_btn;
Fl_Group* mstr_grp;
enum
{
@ -102,7 +81,7 @@ private:
kMlstTypeId,
kMetrTypeId,
kTmlnTypeId,
kScorTypeId,
kSldrMinArgIdx = 0,
kSldrMaxArgIdx = 1,
@ -146,7 +125,12 @@ private:
kTmlnFileArgIdx= 0,
kTmlnPathArgIdx= 1,
kTmlnSelArgIdx = 2,
kTmlnVarCnt = 3
kTmlnCursArgIdx= 3,
kTmlnVarCnt = 4,
kScorFileArgIdx = 0,
kScorSelArgIdx = 1,
kScorVarCnt = 2
};
@ -236,6 +220,13 @@ private:
unsigned varIdArray[ kTmlnVarCnt ];
} tmln_t;
typedef struct scor_str
{
tlCtl* tlctl;
char* val;
unsigned varIdArray[ kScorVarCnt ];
} scor_t;
typedef struct ctl_str
{
@ -256,6 +247,7 @@ private:
mlst_t mlst;
metr_t metr;
tmln_t tmln;
scor_t scor;
} u;
struct ctl_str* linkPtr;
} ctl_t;
@ -285,10 +277,23 @@ private:
} ss_t;
cmCtx_t _ctx;
Fl_Menu_Bar* _menu;
cmCtx_t* _ctx;
cmAiH_t _aiH;
unsigned _statIdx;
Fl_Menu_Bar* _menu;
Fl_HSplitter* _splt;
Fl_Text_Display* _con;
Fl_Tabs* _tabs;
Fl_Group* _mstr_grp;
Fl_Menu_Button* _as_btn;
Fl_Menu_Button* _ai_btn;
Fl_Menu_Button* _ao_btn;
Fl_Menu_Button* _pgm_btn;
Fl_Menu_Button* _ss_btn;
Fl_Menu_Button* _sr_btn;
Fl_Check_Button* _ena_chk;
page_t* _pageList;
ctl_t* _ctlList;
bool _stopTimerFl;
@ -297,7 +302,6 @@ private:
unsigned _colW;
bool _horzBordFl;
unsigned _horzBord;
unsigned _closeCnt;
unsigned _ssCnt; // count of audio system sub-systems (set in _handleSsInitMsg())
ss_t* _ssArray;
int _ssPhase;
@ -337,6 +341,9 @@ private:
void _setLabelValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
void _createTmln( const cmDspUiHdr_t* m );
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 _newColumn( const cmDspUiHdr_t* m );
void _insertAudioSysCfgLabel(unsigned long idx, const cmChar_t* label );