cwIo.h/cpp,cwIoAudioMidi.cpp,cwIOAudioMidiApp.cpp,cwIoAudioPanel.cpp,cwIoPresetSelApp.cpp,wcIoSocketChat.cpp: Changed due to cwUi interface changes and new non-recursive object_t.get() default policy.

This commit is contained in:
kevin 2021-11-03 11:09:07 -04:00
parent dce46bd419
commit fff58a8d4c
7 changed files with 149 additions and 140 deletions

124
cwIo.cpp
View File

@ -455,8 +455,14 @@ namespace cw
{ {
rc_t rc = kOkRC; rc_t rc = kOkRC;
unsigned parserBufByteN = 1024; unsigned parserBufByteN = 1024;
const object_t* cfg = nullptr;
if((rc = c->getv( // get the MIDI port cfg
if((cfg = c->find("midi")) == nullptr)
return cwLogError(kSyntaxErrorRC,"Unable to locate the 'MIDI' configuration.");
if((rc = cfg->getv(
"parserBufByteN", parserBufByteN )) != kOkRC ) "parserBufByteN", parserBufByteN )) != kOkRC )
{ {
rc = cwLogError(kSyntaxErrorRC,"MIDI configuration parse failed."); rc = cwLogError(kSyntaxErrorRC,"MIDI configuration parse failed.");
@ -1478,14 +1484,14 @@ namespace cw
} }
// parse the audio group list // parse the audio group list
if((rc = _audioDeviceParseAudioGroupList( p, cfg )) != kOkRC ) if((rc = _audioDeviceParseAudioGroupList( p, node )) != kOkRC )
{ {
rc = cwLogError(rc,"Parse audio group list."); rc = cwLogError(rc,"Parse audio group list.");
goto errLabel; goto errLabel;
} }
// parse the audio device list // parse the audio device list
if((rc = _audioDeviceParseAudioDeviceList( p, cfg )) != kOkRC ) if((rc = _audioDeviceParseAudioDeviceList( p, node )) != kOkRC )
{ {
rc = cwLogError(rc,"Parse audio device list."); rc = cwLogError(rc,"Parse audio device list.");
goto errLabel; goto errLabel;
@ -1546,13 +1552,13 @@ namespace cw
// //
// This function is called by the websocket with messages comring from a remote UI. // This function is called by the websocket with messages comring from a remote UI.
rc_t _uiCallback( void* cbArg, unsigned wsSessId, ui::opId_t opId, unsigned parentAppId, unsigned uuId, unsigned appId, const ui::value_t* v ) rc_t _uiCallback( void* cbArg, unsigned wsSessId, ui::opId_t opId, unsigned parentAppId, unsigned uuId, unsigned appId, unsigned chanId, const ui::value_t* v )
{ {
io_t* p = (io_t*)cbArg; io_t* p = (io_t*)cbArg;
msg_t r; msg_t r;
r.tid = kUiTId; r.tid = kUiTId;
r.u.ui = { .opId=opId, .wsSessId=wsSessId, .parentAppId=parentAppId, .uuId=uuId, .appId=appId, .value=v }; r.u.ui = { .opId=opId, .wsSessId=wsSessId, .parentAppId=parentAppId, .uuId=uuId, .appId=appId, .chanId=chanId, .value=v };
return p->cbFunc(p->cbArg,&r); return p->cbFunc(p->cbArg,&r);
} }
@ -2588,192 +2594,192 @@ unsigned cw::io::uiFindElementUuId( handle_t h, unsigned appId )
return kInvalidId; return kInvalidId;
} }
cw::rc_t cw::io::uiCreateFromObject( handle_t h, const object_t* o, unsigned wsSessId, unsigned parentUuId, const char* eleName) cw::rc_t cw::io::uiCreateFromObject( handle_t h, const object_t* o, unsigned parentUuId, unsigned chanId, const char* eleName)
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createFromObject(uiH,o,wsSessId,parentUuId,eleName); rc = ui::createFromObject(uiH,o,parentUuId,chanId,eleName);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateFromFile( handle_t h, const char* fn, unsigned wsSessId, unsigned parentUuId) cw::rc_t cw::io::uiCreateFromFile( handle_t h, const char* fn, unsigned parentUuId, unsigned chanId)
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createFromFile(uiH,fn,wsSessId,parentUuId); rc = ui::createFromFile(uiH,fn,parentUuId,chanId);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateFromText( handle_t h, const char* text, unsigned wsSessId, unsigned parentUuId) cw::rc_t cw::io::uiCreateFromText( handle_t h, const char* text, unsigned parentUuId, unsigned chanId)
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createFromText(uiH,text,wsSessId,parentUuId); rc = ui::createFromText(uiH,text,parentUuId, chanId);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateDiv( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ) cw::rc_t cw::io::uiCreateDiv( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createDiv(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title); rc = ui::createDiv(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateLabel( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ) cw::rc_t cw::io::uiCreateLabel( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createLabel(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title); rc = ui::createLabel(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateButton( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ) cw::rc_t cw::io::uiCreateButton( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createButton(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title); rc = ui::createButton(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateCheck( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ) cw::rc_t cw::io::uiCreateCheck( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createCheck(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title); rc = ui::createCheck(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateCheck( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, bool value ) cw::rc_t cw::io::uiCreateCheck( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, bool value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createCheck(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title,value); rc = ui::createCheck(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title,value);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateSelect( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ) cw::rc_t cw::io::uiCreateSelect( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createSelect(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title); rc = ui::createSelect(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateOption( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ) cw::rc_t cw::io::uiCreateOption( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createOption(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title); rc = ui::createOption(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateStr( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ) cw::rc_t cw::io::uiCreateStr( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createStr(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title); rc = ui::createStr(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateStr( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, const char* value ) cw::rc_t cw::io::uiCreateStr( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, const char* value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createStr(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title,value); rc = ui::createStr(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title,value);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateNumbDisplay(handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, unsigned decPl ) cw::rc_t cw::io::uiCreateNumbDisplay(handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, unsigned decPl )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createNumbDisplay(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title,decPl); rc = ui::createNumbDisplay(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title,decPl);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateNumbDisplay(handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, unsigned decPl, double value ) cw::rc_t cw::io::uiCreateNumbDisplay(handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, unsigned decPl, double value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createNumbDisplay(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title,value); rc = ui::createNumbDisplay(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title,value);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateNumb( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, double minValue, double maxValue, double stepValue, unsigned decPl ) cw::rc_t cw::io::uiCreateNumb( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, double minValue, double maxValue, double stepValue, unsigned decPl )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createNumb(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title,minValue,maxValue,stepValue,decPl); rc = ui::createNumb(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title,minValue,maxValue,stepValue,decPl);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateNumb( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, double minValue, double maxValue, double stepValue, unsigned decPl, double value ) cw::rc_t cw::io::uiCreateNumb( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, double minValue, double maxValue, double stepValue, unsigned decPl, double value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createNumb(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title,minValue,maxValue,stepValue,decPl,value); rc = ui::createNumb(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title,minValue,maxValue,stepValue,decPl,value);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateProg( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, double minValue, double maxValue ) cw::rc_t cw::io::uiCreateProg( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, double minValue, double maxValue )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createProg(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title,minValue,maxValue); rc = ui::createProg(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title,minValue,maxValue);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateProg( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, double minValue, double maxValue, double value ) cw::rc_t cw::io::uiCreateProg( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, double minValue, double maxValue, double value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createProg(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title,minValue,maxValue,value); rc = ui::createProg(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title,minValue,maxValue,value);
return rc; return rc;
} }
cw::rc_t cw::io::uiCreateLog( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ) cw::rc_t cw::io::uiCreateLog( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::createLog(uiH,uuIdRef,wsSessId,parentUuId,eleName,appId,clas,title); rc = ui::createLog(uiH,uuIdRef,parentUuId,eleName,appId,chanId,clas,title);
return rc; return rc;
} }
cw::rc_t cw::io::uiSetNumbRange( handle_t h, unsigned wsSessId, unsigned uuId, double minValue, double maxValue, double stepValue, unsigned decPl, double value ) cw::rc_t cw::io::uiSetNumbRange( handle_t h, unsigned uuId, double minValue, double maxValue, double stepValue, unsigned decPl, double value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::setNumbRange(uiH,wsSessId,uuId,minValue,maxValue,stepValue,decPl,value); rc = ui::setNumbRange(uiH,uuId,minValue,maxValue,stepValue,decPl,value);
return rc; return rc;
} }
cw::rc_t cw::io::uiSetProgRange( handle_t h, unsigned wsSessId, unsigned uuId, double minValue, double maxValue, double value ) cw::rc_t cw::io::uiSetProgRange( handle_t h, unsigned uuId, double minValue, double maxValue, double value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::setProgRange(uiH,wsSessId,uuId,minValue,maxValue,value); rc = ui::setProgRange(uiH,uuId,minValue,maxValue,value);
return rc; return rc;
} }
@ -2787,57 +2793,57 @@ cw::rc_t cw::io::uiRegisterAppIdMap( handle_t h, const ui::appIdMap_t* map, uns
return rc; return rc;
} }
cw::rc_t cw::io::uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, bool value ) cw::rc_t cw::io::uiSendValue( handle_t h, unsigned uuId, bool value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::sendValueBool(uiH, wsSessId, uuId, value ); rc = ui::sendValueBool(uiH, uuId, value );
return rc; return rc;
} }
cw::rc_t cw::io::uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, int value ) cw::rc_t cw::io::uiSendValue( handle_t h, unsigned uuId, int value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::sendValueInt(uiH, wsSessId, uuId, value ); rc = ui::sendValueInt(uiH, uuId, value );
return rc; return rc;
} }
cw::rc_t cw::io::uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, unsigned value ) cw::rc_t cw::io::uiSendValue( handle_t h, unsigned uuId, unsigned value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::sendValueUInt(uiH, wsSessId, uuId, value ); rc = ui::sendValueUInt(uiH, uuId, value );
return rc; return rc;
} }
cw::rc_t cw::io::uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, float value ) cw::rc_t cw::io::uiSendValue( handle_t h, unsigned uuId, float value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::sendValueFloat(uiH, wsSessId, uuId, value ); rc = ui::sendValueFloat(uiH, uuId, value );
return rc; return rc;
} }
cw::rc_t cw::io::uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, double value ) cw::rc_t cw::io::uiSendValue( handle_t h, unsigned uuId, double value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::sendValueDouble(uiH, wsSessId, uuId, value ); rc = ui::sendValueDouble(uiH, uuId, value );
return rc; return rc;
} }
cw::rc_t cw::io::uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, const char* value ) cw::rc_t cw::io::uiSendValue( handle_t h, unsigned uuId, const char* value )
{ {
rc_t rc; rc_t rc;
ui::handle_t uiH; ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC ) if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::sendValueString(uiH, wsSessId, uuId, value ); rc = ui::sendValueString(uiH, uuId, value );
return rc; return rc;
} }

56
cwIo.h
View File

@ -112,6 +112,7 @@ namespace cw
unsigned parentAppId; unsigned parentAppId;
unsigned uuId; unsigned uuId;
unsigned appId; unsigned appId;
unsigned chanId;
const ui::value_t* value; const ui::value_t* value;
} ui_msg_t; } ui_msg_t;
@ -275,50 +276,51 @@ namespace cw
unsigned uiFindElementUuId( handle_t h, const char* eleName ); unsigned uiFindElementUuId( handle_t h, const char* eleName );
unsigned uiFindElementUuId( handle_t h, unsigned appId ); unsigned uiFindElementUuId( handle_t h, unsigned appId );
rc_t uiCreateFromObject( handle_t h, const object_t* o, unsigned wsSessId, unsigned parentUuId=kInvalidId, const char* eleName=nullptr); rc_t uiCreateFromObject( handle_t h, const object_t* o, unsigned parentUuId=kInvalidId, unsigned chanId=kInvalidId, const char* eleName=nullptr);
rc_t uiCreateFromFile( handle_t h, const char* fn, unsigned wsSessId, unsigned parentUuId=kInvalidId); rc_t uiCreateFromFile( handle_t h, const char* fn, unsigned parentUuId=kInvalidId, unsigned chanId=kInvalidId );
rc_t uiCreateFromText( handle_t h, const char* text, unsigned wsSessId, unsigned parentUuId=kInvalidId); rc_t uiCreateFromText( handle_t h, const char* text, unsigned parentUuId=kInvalidId, unsigned chanId=kInvalidId );
rc_t uiCreateDiv( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title );
rc_t uiCreateLabel( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ); rc_t uiCreateDiv( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title );
rc_t uiCreateButton( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ); rc_t uiCreateLabel( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title );
rc_t uiCreateButton( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title );
// Create check: w/o value. The value will be read from the engine via the UI 'echo' event. // Create check: w/o value. The value will be read from the engine via the UI 'echo' event.
// Create check: w/ value. The value will be sent to the engine as the new value of the associated varaible. // Create check: w/ value. The value will be sent to the engine as the new value of the associated varaible.
rc_t uiCreateCheck( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ); rc_t uiCreateCheck( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title );
rc_t uiCreateCheck( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, bool value ); rc_t uiCreateCheck( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, bool value );
rc_t uiCreateSelect( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ); rc_t uiCreateSelect( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title );
rc_t uiCreateOption( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ); rc_t uiCreateOption( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title );
rc_t uiCreateStr( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ); rc_t uiCreateStr( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title );
rc_t uiCreateStr( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, const char* value ); rc_t uiCreateStr( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, const char* value );
rc_t uiCreateNumbDisplay(handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, unsigned decPl ); rc_t uiCreateNumbDisplay(handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, unsigned decPl );
rc_t uiCreateNumbDisplay(handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, unsigned decPl, double value ); rc_t uiCreateNumbDisplay(handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, unsigned decPl, double value );
rc_t uiCreateNumb( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, double minValue, double maxValue, double stepValue, unsigned decPl ); rc_t uiCreateNumb( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, double minValue, double maxValue, double stepValue, unsigned decPl );
rc_t uiCreateNumb( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, double minValue, double maxValue, double stepValue, unsigned decPl, double value ); rc_t uiCreateNumb( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, double minValue, double maxValue, double stepValue, unsigned decPl, double value );
rc_t uiCreateProg( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, double minValue, double maxValue ); rc_t uiCreateProg( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, double minValue, double maxValue );
rc_t uiCreateProg( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title, double minValue, double maxValue, double value ); rc_t uiCreateProg( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title, double minValue, double maxValue, double value );
rc_t uiCreateLog( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ); rc_t uiCreateLog( handle_t h, unsigned& uuIdRef, unsigned parentUuId, const char* eleName, unsigned appId, unsigned chanId, const char* clas, const char* title );
rc_t uiSetNumbRange( handle_t h, unsigned wsSessId, unsigned uuId, double minValue, double maxValue, double stepValue, unsigned decPl, double value ); rc_t uiSetNumbRange( handle_t h, unsigned uuId, double minValue, double maxValue, double stepValue, unsigned decPl, double value );
rc_t uiSetProgRange( handle_t h, unsigned wsSessId, unsigned uuId, double minValue, double maxValue, double value ); rc_t uiSetProgRange( handle_t h, unsigned uuId, double minValue, double maxValue, double value );
// Register parent/child/name app id's // Register parent/child/name app id's
rc_t uiRegisterAppIdMap( handle_t h, const ui::appIdMap_t* map, unsigned mapN ); rc_t uiRegisterAppIdMap( handle_t h, const ui::appIdMap_t* map, unsigned mapN );
// Send a value from the application to the UI. // Send a value from the application to the UI.
// Set wsSessId to kInvalidId to send to all sessions. // Set wsSessId to kInvalidId to send to all sessions.
rc_t uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, bool value ); rc_t uiSendValue( handle_t h, unsigned uuId, bool value );
rc_t uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, int value ); rc_t uiSendValue( handle_t h, unsigned uuId, int value );
rc_t uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, unsigned value ); rc_t uiSendValue( handle_t h, unsigned uuId, unsigned value );
rc_t uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, float value ); rc_t uiSendValue( handle_t h, unsigned uuId, float value );
rc_t uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, double value ); rc_t uiSendValue( handle_t h, unsigned uuId, double value );
rc_t uiSendValue( handle_t h, unsigned wsSessId, unsigned uuId, const char* value ); rc_t uiSendValue( handle_t h, unsigned uuId, const char* value );

View File

@ -199,7 +199,7 @@ namespace cw
{ {
app->midiMsgArrayInIdx = next_idx; app->midiMsgArrayInIdx = next_idx;
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kMsgCntId), app->midiMsgArrayInIdx ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kMsgCntId), app->midiMsgArrayInIdx );
} }
@ -349,7 +349,7 @@ namespace cw
} }
// update UI msg count // update UI msg count
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kMsgCntId), app->midiMsgArrayInIdx ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kMsgCntId), app->midiMsgArrayInIdx );
file::close(fH); file::close(fH);
@ -652,7 +652,7 @@ namespace cw
} }
double audioSecs = (double)af_info.frameCnt / af_info.srate; double audioSecs = (double)af_info.frameCnt / af_info.srate;
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kAudioSecsId), audioSecs ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kAudioSecsId), audioSecs );
} }
@ -878,7 +878,7 @@ namespace cw
app->midiMsgArrayInIdx += 1; app->midiMsgArrayInIdx += 1;
// send msg count // send msg count
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kMsgCntId), app->midiMsgArrayInIdx ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kMsgCntId), app->midiMsgArrayInIdx );
} }
} }
} }

View File

@ -221,10 +221,10 @@ namespace cw
errLabel: errLabel:
mem::release(fn); mem::release(fn);
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) );
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kTotalMidiEvtCntId), midi_record_play::event_count(app->mrpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kTotalMidiEvtCntId), midi_record_play::event_count(app->mrpH) );
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurAudioSecsId), audio_record_play::current_loc_seconds(app->arpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurAudioSecsId), audio_record_play::current_loc_seconds(app->arpH) );
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kTotalAudioSecsId), audio_record_play::duration_seconds(app->arpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kTotalAudioSecsId), audio_record_play::duration_seconds(app->arpH) );
return rc; return rc;
@ -245,8 +245,8 @@ namespace cw
goto errLabel; goto errLabel;
} }
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) );
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurAudioSecsId), audio_record_play::current_loc_seconds(app->arpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurAudioSecsId), audio_record_play::current_loc_seconds(app->arpH) );
errLabel: errLabel:
return rc; return rc;
@ -323,8 +323,8 @@ namespace cw
goto errLabel; goto errLabel;
} }
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) );
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurAudioSecsId), audio_record_play::current_loc_seconds(app->arpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurAudioSecsId), audio_record_play::current_loc_seconds(app->arpH) );
errLabel: errLabel:
@ -454,14 +454,14 @@ namespace cw
{ {
midi_record_play::exec( app->mrpH, *m ); midi_record_play::exec( app->mrpH, *m );
if( midi_record_play::is_started(app->mrpH) ) if( midi_record_play::is_started(app->mrpH) )
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) );
} }
if( app->arpH.isValid() ) if( app->arpH.isValid() )
{ {
audio_record_play::exec( app->arpH, *m ); audio_record_play::exec( app->arpH, *m );
if( audio_record_play::is_started(app->arpH) ) if( audio_record_play::is_started(app->arpH) )
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurAudioSecsId), audio_record_play::current_loc_seconds(app->arpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurAudioSecsId), audio_record_play::current_loc_seconds(app->arpH) );
} }
switch( m->tid ) switch( m->tid )

View File

@ -127,6 +127,7 @@ namespace cw {
unsigned parentUuId = ui::kRootAppId; unsigned parentUuId = ui::kRootAppId;
unsigned divUuId = kInvalidId; unsigned divUuId = kInvalidId;
unsigned titleUuId = kInvalidId; unsigned titleUuId = kInvalidId;
unsigned chanId = kInvalidId;
const char* title = inputFl ? "Input" : "Output"; const char* title = inputFl ? "Input" : "Output";
const char* divEleName = inputFl ? "inMeterId" : "outMeterId"; const char* divEleName = inputFl ? "inMeterId" : "outMeterId";
unsigned divAppId = inputFl ? kInMeterDivId : kOutMeterDivId; unsigned divAppId = inputFl ? kInMeterDivId : kOutMeterDivId;
@ -137,14 +138,14 @@ namespace cw {
unsigned colUuId; unsigned colUuId;
unsigned uuid; unsigned uuid;
uiCreateLabel(p->ioH, titleUuId, wsSessId, parentUuId, nullptr, kInvalidId, nullptr, title ); uiCreateLabel(p->ioH, titleUuId, parentUuId, nullptr, kInvalidId, chanId, nullptr, title );
uiCreateDiv( p->ioH, divUuId, wsSessId, parentUuId, divEleName, d->baseAppId + divAppId, "uiRow", nullptr ); uiCreateDiv( p->ioH, divUuId, parentUuId, divEleName, d->baseAppId + divAppId, chanId, "uiRow", nullptr );
uiCreateDiv( p->ioH, colUuId, wsSessId, divUuId, nullptr, kInvalidId, "uiCol", nullptr ); uiCreateDiv( p->ioH, colUuId, divUuId, nullptr, kInvalidId, chanId, "uiCol", nullptr );
uiCreateLabel(p->ioH, uuid, wsSessId, colUuId, nullptr, kInvalidId, nullptr, "Tone" ); uiCreateLabel(p->ioH, uuid, colUuId, nullptr, kInvalidId, chanId, nullptr, "Tone" );
uiCreateLabel(p->ioH, uuid, wsSessId, colUuId, nullptr, kInvalidId, nullptr, "Mute" ); uiCreateLabel(p->ioH, uuid, colUuId, nullptr, kInvalidId, chanId, nullptr, "Mute" );
uiCreateLabel(p->ioH, uuid, wsSessId, colUuId, nullptr, kInvalidId, nullptr, "Gain" ); uiCreateLabel(p->ioH, uuid, colUuId, nullptr, kInvalidId, chanId, nullptr, "Gain" );
uiCreateLabel(p->ioH, uuid, wsSessId, colUuId, nullptr, kInvalidId, nullptr, "Meter" ); uiCreateLabel(p->ioH, uuid, colUuId, nullptr, kInvalidId, chanId, nullptr, "Meter" );
for(unsigned i=0; i<chCnt; ++i) for(unsigned i=0; i<chCnt; ++i)
{ {
@ -152,11 +153,11 @@ namespace cw {
char chLabel[ chLabelN+1 ]; char chLabel[ chLabelN+1 ];
snprintf(chLabel,chLabelN,"%i",i+1); snprintf(chLabel,chLabelN,"%i",i+1);
uiCreateDiv( p->ioH, colUuId, wsSessId, divUuId, nullptr, kInvalidId, "uiCol", chLabel ); uiCreateDiv( p->ioH, colUuId, divUuId, nullptr, kInvalidId, kInvalidId, "uiCol", chLabel );
uiCreateCheck(p->ioH, uuid, wsSessId, colUuId, nullptr, d->baseAppId + baseToneId + i, "checkClass", nullptr, false ); uiCreateCheck(p->ioH, uuid, colUuId, nullptr, d->baseAppId + baseToneId + i, i, "checkClass", nullptr, false );
uiCreateCheck(p->ioH, uuid, wsSessId, colUuId, nullptr, d->baseAppId + baseMuteId + i, "checkClass", nullptr, false ); uiCreateCheck(p->ioH, uuid, colUuId, nullptr, d->baseAppId + baseMuteId + i, i, "checkClass", nullptr, false );
uiCreateNumb( p->ioH, uuid, wsSessId, colUuId, nullptr, d->baseAppId + baseGainId + i, "floatClass", nullptr, 0.0, 3.0, 0.001, 3, 0 ); uiCreateNumb( p->ioH, uuid, colUuId, nullptr, d->baseAppId + baseGainId + i, i, "floatClass", nullptr, 0.0, 3.0, 0.001, 3, 0 );
uiCreateNumb( p->ioH, uuid, wsSessId, colUuId, nullptr, d->baseAppId + baseMeterId + i, "floatClass", nullptr, -100.0, 100, 1, 2, 0 ); uiCreateNumb( p->ioH, uuid, colUuId, nullptr, d->baseAppId + baseMeterId + i, i, "floatClass", nullptr, -100.0, 100, 1, 2, 0 );
} }
return rc; return rc;
@ -170,8 +171,8 @@ namespace cw {
for(; d!=nullptr; d=d->link) for(; d!=nullptr; d=d->link)
{ {
_create_meters( p, d, m.wsSessId, d->iChCnt, true ); _create_meters( p, d, kInvalidId, d->iChCnt, true );
_create_meters( p, d, m.wsSessId, d->oChCnt, false ); _create_meters( p, d, kInvalidId, d->oChCnt, false );
} }
return rc; return rc;
@ -250,7 +251,7 @@ namespace cw {
for(unsigned i=0; i<chCnt; ++i) for(unsigned i=0; i<chCnt; ++i)
{ {
unsigned appId = apd->baseAppId + meterAppId + i; unsigned appId = apd->baseAppId + meterAppId + i;
uiSendValue( p->ioH, kInvalidId, uiFindElementUuId(p->ioH,appId), agd.meterA[i] ); uiSendValue( p->ioH, uiFindElementUuId(p->ioH,appId), agd.meterA[i] );
} }
return kOkRC; return kOkRC;

View File

@ -106,19 +106,17 @@ namespace cw
} app_t; } app_t;
rc_t _parseCfg(app_t* app, const object_t* cfg ) rc_t _parseCfg(app_t* app, const object_t* cfg, const object_t*& params_cfgRef )
{ {
rc_t rc = kOkRC; rc_t rc = kOkRC;
const object_t* params = nullptr; if((rc = cfg->getv( "params", params_cfgRef)) != kOkRC )
if((rc = cfg->getv( "params", params)) != kOkRC )
{ {
rc = cwLogError(kSyntaxErrorRC,"Preset Select App 'params' cfg record not found."); rc = cwLogError(kSyntaxErrorRC,"Preset Select App 'params' cfg record not found.");
goto errLabel; goto errLabel;
} }
if((rc = params->getv( "record_dir", app->record_dir, if((rc = params_cfgRef->getv( "record_dir", app->record_dir,
"record_folder", app->record_folder, "record_folder", app->record_folder,
"record_fn_ext", app->record_fn_ext, "record_fn_ext", app->record_fn_ext,
"score_fn", app->scoreFn )) != kOkRC ) "score_fn", app->scoreFn )) != kOkRC )
@ -288,8 +286,8 @@ namespace cw
errLabel: errLabel:
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) );
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kTotalMidiEvtCntId), midi_record_play::event_count(app->mrpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kTotalMidiEvtCntId), midi_record_play::event_count(app->mrpH) );
return rc; return rc;
} }
@ -310,7 +308,7 @@ namespace cw
// goto errLabel; // goto errLabel;
//} //}
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) );
//io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurAudioSecsId), audio_record_play::current_loc_seconds(app->arpH) ); //io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurAudioSecsId), audio_record_play::current_loc_seconds(app->arpH) );
errLabel: errLabel:
@ -364,7 +362,7 @@ namespace cw
else else
{ {
start( app->mrpH, false ); start( app->mrpH, false );
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) );
} }
break; break;
@ -493,7 +491,7 @@ namespace cw
{ {
midi_record_play::exec( app->mrpH, *m ); midi_record_play::exec( app->mrpH, *m );
if( midi_record_play::is_started(app->mrpH) ) if( midi_record_play::is_started(app->mrpH) )
io::uiSendValue( app->ioH, kInvalidId, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) ); io::uiSendValue( app->ioH, uiFindElementUuId(app->ioH,kCurMidiEvtCntId), midi_record_play::event_index(app->mrpH) );
} }
/* /*
@ -549,9 +547,10 @@ cw::rc_t cw::preset_sel_app::main( const object_t* cfg )
{ {
rc_t rc; rc_t rc;
app_t app = {}; app_t app = {};
const object_t* params_cfg = nullptr;
// Parse the configuration // Parse the configuration
if((rc = _parseCfg(&app,cfg)) != kOkRC ) if((rc = _parseCfg(&app,cfg,params_cfg)) != kOkRC )
goto errLabel; goto errLabel;
// create the io framework instance // create the io framework instance
@ -562,7 +561,7 @@ cw::rc_t cw::preset_sel_app::main( const object_t* cfg )
} }
// create the MIDI record-play object // create the MIDI record-play object
if((rc = midi_record_play::create(app.mrpH,app.ioH,*cfg,_midi_play_callback,&app)) != kOkRC ) if((rc = midi_record_play::create(app.mrpH,app.ioH,*params_cfg,_midi_play_callback,&app)) != kOkRC )
{ {
rc = cwLogError(rc,"MIDI record-play object create failed."); rc = cwLogError(rc,"MIDI record-play object create failed.");
goto errLabel; goto errLabel;

View File

@ -62,6 +62,7 @@ namespace cw {
{ {
rc_t rc = kOkRC; rc_t rc = kOkRC;
unsigned parentUuId = ui::kRootAppId; unsigned parentUuId = ui::kRootAppId;
unsigned chanId = kInvalidId;
unsigned divUuId; unsigned divUuId;
unsigned uuid; unsigned uuid;
@ -69,12 +70,12 @@ namespace cw {
char s[sn+1]; char s[sn+1];
snprintf(s,sn,"Chat: %i", io::socketPort(p->ioH, p->sockIdx )); snprintf(s,sn,"Chat: %i", io::socketPort(p->ioH, p->sockIdx ));
uiCreateDiv( p->ioH, divUuId, m.wsSessId, parentUuId, nullptr, p->baseAppId + kUiDivAppId, "uiCol", s ); uiCreateDiv( p->ioH, divUuId, parentUuId, nullptr, p->baseAppId + kUiDivAppId, chanId, "uiCol", s );
uiCreateStr( p->ioH, uuid, m.wsSessId, divUuId, nullptr, p->baseAppId + kUiSendTextAppId, "uiText", "Send" ); uiCreateStr( p->ioH, uuid, divUuId, nullptr, p->baseAppId + kUiSendTextAppId, chanId, "uiText", "Send" );
uiCreateStr( p->ioH, uuid, m.wsSessId, divUuId, nullptr, p->baseAppId + kUiRemoteAddrAppId, "uiText", "Addr", "127.0.0.1" ); uiCreateStr( p->ioH, uuid, divUuId, nullptr, p->baseAppId + kUiRemoteAddrAppId, chanId, "uiText", "Addr", "127.0.0.1" );
uiCreateNumb( p->ioH, uuid, m.wsSessId, divUuId, nullptr, p->baseAppId + kUiRemotePortAppId, "uiNumb", "Port", 0, 0xffff, 1, 0, 0 ); uiCreateNumb( p->ioH, uuid, divUuId, nullptr, p->baseAppId + kUiRemotePortAppId, chanId, "uiNumb", "Port", 0, 0xffff, 1, 0, 0 );
uiCreateButton(p->ioH, uuid, m.wsSessId, divUuId, nullptr, p->baseAppId + kUiSendBtnAppId, "uiBtn", "Send" ); uiCreateButton(p->ioH, uuid, divUuId, nullptr, p->baseAppId + kUiSendBtnAppId, chanId, "uiBtn", "Send" );
uiCreateStr( p->ioH, p->recvTextUuId, m.wsSessId, divUuId, nullptr, p->baseAppId + kUiRecvTextAppId, "uiText", "Recv" ); uiCreateStr( p->ioH, p->recvTextUuId, divUuId, nullptr, p->baseAppId + kUiRecvTextAppId, chanId, "uiText", "Recv" );
return rc; return rc;
} }
@ -145,21 +146,21 @@ namespace cw {
{ {
case kUiSendTextAppId: case kUiSendTextAppId:
if( p->sendText ) if( p->sendText )
io::uiSendValue( p->ioH, m.wsSessId, m.uuId, p->sendText ); io::uiSendValue( p->ioH, m.uuId, p->sendText );
break; break;
case kUiRemoteAddrAppId: case kUiRemoteAddrAppId:
if( p->remoteAddr) if( p->remoteAddr)
io::uiSendValue( p->ioH, m.wsSessId, m.uuId, p->remoteAddr ); io::uiSendValue( p->ioH, m.uuId, p->remoteAddr );
break; break;
case kUiRecvTextAppId: case kUiRecvTextAppId:
if( p->recvText ) if( p->recvText )
io::uiSendValue( p->ioH, m.wsSessId, m.uuId, p->recvText ); io::uiSendValue( p->ioH, m.uuId, p->recvText );
break; break;
case kUiRemotePortAppId: case kUiRemotePortAppId:
io::uiSendValue( p->ioH, m.wsSessId, m.uuId, p->remotePort ); io::uiSendValue( p->ioH, m.uuId, p->remotePort );
break; break;
default: default:
@ -218,7 +219,7 @@ namespace cw {
if( m.byteA && p->sockIdx == m.sockIdx ) if( m.byteA && p->sockIdx == m.sockIdx )
{ {
p->recvText = mem::duplStr((const char*)m.byteA); p->recvText = mem::duplStr((const char*)m.byteA);
io::uiSendValue(p->ioH, kInvalidId, p->recvTextUuId, (const char*)m.byteA ); io::uiSendValue(p->ioH, p->recvTextUuId, (const char*)m.byteA );
} }
break; break;