diff --git a/Makefile.am b/Makefile.am index 4ad3dad..c5ffda6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,8 +42,11 @@ cmSRC += src/libcm/dsp/cmDspSys.c src/libcm/dsp/cmDspClass.c src/libcm/dsp/cmDs cmHDR += src/libcm/dsp/cmDspBuiltIn.h src/libcm/dsp/cmDspFx.h cmSRC += src/libcm/dsp/cmDspBuiltIn.c src/libcm/dsp/cmDspFx.c -cmHDR += src/libcm/dsp/cmDspPgm.h src/libcm/dsp/cmDspKr.h src/libcm/dsp/cmDspPgmPP.h src/libcm/dsp/cmDspPgmPPMain.h -cmSRC += src/libcm/dsp/cmDspPgm.c src/libcm/dsp/cmDspKr.c src/libcm/dsp/cmDspPgmPP.c src/libcm/dsp/cmDspPgmPPMain.c +cmHDR += src/libcm/dsp/cmDspPgm.h src/libcm/dsp/cmDspPgmPP.h src/libcm/dsp/cmDspPgmPPMain.h +cmSRC += src/libcm/dsp/cmDspPgm.c src/libcm/dsp/cmDspPgmPP.c src/libcm/dsp/cmDspPgmPPMain.c + +cmHDR += src/libcm/dsp/cmDspKr.h src/libcm/dsp/cmDspPgmKr.h +cmSRC += src/libcm/dsp/cmDspKr.c src/libcm/dsp/cmDspPgmKr.c cmHDR += src/libcm/cmAudDsp.h src/libcm/cmAudDspIF.h src/libcm/cmAudDspLocal.h cmSRC += src/libcm/cmAudDsp.c src/libcm/cmAudDspIF.c src/libcm/cmAudDspLocal.c diff --git a/cmMsgProtocol.h b/cmMsgProtocol.h index 6ccb9f6..b0ad922 100644 --- a/cmMsgProtocol.h +++ b/cmMsgProtocol.h @@ -30,6 +30,7 @@ extern "C" { kButtonDuiId, // ui<--eng create button control kCheckDuiId, // ui<--eng create a check box control kLabelDuiId, // ui<--end create a label control + kTimeLineDuiId,// ui<--end create a time-line control kNumberDuiId, // ui<--eng create a number box kTextDuiId, // ui<--eng create a text entry control kFnameDuiId, // ui<--eng create a file/directory picker control diff --git a/dsp/cmDspBuiltIn.c b/dsp/cmDspBuiltIn.c index 18064b9..ed98d91 100644 --- a/dsp/cmDspBuiltIn.c +++ b/dsp/cmDspBuiltIn.c @@ -19,6 +19,7 @@ #include "cmDspCtx.h" #include "cmDspClass.h" #include "cmDspFx.h" +#include "cmDspKr.h" #include "cmMsgProtocol.h" #include "cmThread.h" #include "cmUdpPort.h" @@ -4990,6 +4991,9 @@ cmDspClassConsFunc_t _cmDspClassBuiltInArray[] = cmPresetClassCons, cmBcastSymClassCons, cmSegLineClassCons, + + cmTimeLineClassCons, + NULL, }; diff --git a/dsp/cmDspClass.h b/dsp/cmDspClass.h index ceec82b..50b68a7 100644 --- a/dsp/cmDspClass.h +++ b/dsp/cmDspClass.h @@ -392,6 +392,7 @@ extern "C" { cmDspRC_t cmDspUiMeterCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned minVarId, unsigned maxVarId, unsigned valVarId, unsigned lblVarId ); cmDspRC_t cmDspUiButtonCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned typeDuiId, unsigned outVarId, unsigned lblVarId ); cmDspRC_t cmDspUiLabelCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lblVarId, unsigned alignVarId ); + cmDspRC_t cmDspUiTimeLineCreate(cmDspCtx_t* ctx,cmDspInst_t* inst, unsigned valVarId, unsigned lblVarId ); cmDspRC_t cmDspUiNewColumn( cmDspCtx_t* ctx, unsigned colW ); cmDspRC_t cmDspUiInsertHorzBorder( cmDspCtx_t* ctx ); diff --git a/dsp/cmDspKr.c b/dsp/cmDspKr.c index 6e261f5..97bfa4c 100644 --- a/dsp/cmDspKr.c +++ b/dsp/cmDspKr.c @@ -56,49 +56,8 @@ typedef struct cmDspClass_t _cmKrDC; -// cm console output function -void _cmKrCmRptFunc( void* userDataPtr, const cmChar_t* fmt, va_list vl ) -{ - cmCtx_t* p = (cmCtx_t*)userDataPtr; - if( p == NULL ) - vprintf(fmt,vl); - else - cmRptVPrintf(&p->rpt,fmt,vl); -} -// initialize the cm library -/* -cmDspRC_t cmDspKrCmLibInit(cmCtx_t* cmCtx ) -{ - bool debugFl = false; -#ifdef NDEBUG - debugFl = true; -#endif - - unsigned memPadByteCnt = cmCtx->guardByteCnt; - unsigned memAlignByteCnt = cmCtx->alignByteCnt; - unsigned memAutoBlockByteCnt = 0; - unsigned memFlags = cmCtx->mmFlags; - - if( cmMallocDebugIsInit() == false ) - cmMallocDebugInitialize( memPadByteCnt, memAlignByteCnt, memAutoBlockByteCnt, memFlags, _cmKrCmRptFunc, cmCtx ); - - return kOkDspRC; -} - -// free the cm library -cmDspRC_t cmDspKrCmLibFinal() -{ -#ifdef NDEBUG - cmMallocDebugReport( vPrintF, _rptUserPtr, 0); -#endif - - if( cmMallocDebugIsInit() ) - cmMallocDebugFinalize(); - - return kOkDspRC; -} -*/ +//========================================================================================================================================== cmDspInst_t* _cmDspKrAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl ) { @@ -267,3 +226,71 @@ struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx ) } +//========================================================================================================================================== +enum +{ + kValTlId, + kLblTlId +}; + +cmDspClass_t _cmTimeLineDC; + +typedef struct +{ + cmDspInst_t inst; +} cmDspTimeLine_t; + +cmDspInst_t* _cmDspTimeLineAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl ) +{ + cmDspVarArg_t args[] = + { + { "val", kValTlId, 0, 0, kInDsvFl | kOutDsvFl | kStrzDsvFl | kReqArgDsvFl | kSendDfltDsvFl, "Current string"}, + { "lbl", kLblTlId, 0, 0, kStrzDsvFl | kOptArgDsvFl, "Label"}, + { NULL, 0, 0, 0, 0 } + }; + + cmDspTimeLine_t* p = cmDspInstAlloc(cmDspTimeLine_t,ctx,classPtr,args,instSymId,id,storeSymId,va_cnt,vl); + + // create the UI control + cmDspUiTimeLineCreate(ctx,&p->inst,kValTlId,kLblTlId); + + return &p->inst; +} + +cmDspRC_t _cmDspTimeLineReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt ) +{ + cmDspApplyAllDefaults(ctx,inst); + return kOkDspRC; +} + +cmDspRC_t _cmDspTimeLineRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt ) +{ + + switch( evt->dstVarId ) + { + case kValTlId: + cmDspSetEvent(ctx,inst,evt); + break; + + default: + {assert(0);} + } + + return kOkDspRC; +} + +struct cmDspClass_str* cmTimeLineClassCons( cmDspCtx_t* ctx ) +{ + cmDspClassSetup(&_cmTimeLineDC,ctx,"TimeLine", + NULL, + _cmDspTimeLineAlloc, + NULL, + _cmDspTimeLineReset, + NULL, + _cmDspTimeLineRecv, + NULL,NULL, + "Time Line control."); + + return &_cmTimeLineDC; +} + diff --git a/dsp/cmDspKr.h b/dsp/cmDspKr.h index 90ed639..9ba976f 100644 --- a/dsp/cmDspKr.h +++ b/dsp/cmDspKr.h @@ -6,7 +6,7 @@ extern "C" { #endif struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx ); - + struct cmDspClass_str* cmTimeLineClassCons( cmDspCtx_t* ctx ); #ifdef __cplusplus } diff --git a/dsp/cmDspPgm.c b/dsp/cmDspPgm.c index be255f9..358afdc 100644 --- a/dsp/cmDspPgm.c +++ b/dsp/cmDspPgm.c @@ -23,6 +23,7 @@ #include "cmDspSys.h" #include "cmDspPgm.h" #include "cmDspPgmPP.h" +#include "cmDspPgmKr.h" cmDspRC_t _cmDspSysPgm_Stereo_Through( cmDspSysH_t h, void** userPtrPtr ) { @@ -2312,6 +2313,7 @@ cmDspRC_t _cmDspSysPgm_SegLine( cmDspSysH_t h, void** userPtrPtr ) } _cmDspSysPgm_t _cmDspSysPgmArray[] = { + { "time_line", _cmDspSysPgm_TimeLine, NULL, NULL }, { "main", _cmDspSysPgm_Main, NULL, NULL }, { "array", _cmDspSysPgm_Array, NULL, NULL }, { "line", _cmDspSysPgm_Line, NULL, NULL }, diff --git a/dsp/cmDspPgmKr.c b/dsp/cmDspPgmKr.c new file mode 100644 index 0000000..d6efa23 --- /dev/null +++ b/dsp/cmDspPgmKr.c @@ -0,0 +1,51 @@ +#include "cmPrefix.h" +#include "cmGlobal.h" +#include "cmFloatTypes.h" +#include "cmRpt.h" +#include "cmErr.h" +#include "cmCtx.h" +#include "cmMem.h" +#include "cmMallocDebug.h" +#include "cmLinkedHeap.h" +#include "cmText.h" +#include "cmFileSys.h" +#include "cmSymTbl.h" +#include "cmJson.h" +#include "cmPrefs.h" +#include "cmDspValue.h" +#include "cmMsgProtocol.h" +#include "cmThread.h" +#include "cmUdpPort.h" +#include "cmUdpNet.h" +#include "cmAudioSys.h" +#include "cmProcObj.h" +#include "cmDspCtx.h" +#include "cmDspClass.h" +#include "cmDspSys.h" +#include "cmDspPgm.h" + + +#include "cmAudioFile.h" +#include "cmProcObj.h" +#include "cmProc.h" +#include "cmProc3.h" + +#include "cmVectOpsTemplateMain.h" +#include "cmVectOps.h" + + +cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr ) +{ + cmDspRC_t rc = kOkDspRC; + + cmDspInst_t* tlp = cmDspSysAllocInst(h,"TimeLine", "text", 1, "Hello" ); + cmDspInst_t* prp = cmDspSysAllocInst(h,"Printer", NULL, 1, ">" ); + + if((rc = cmDspSysLastRC(h)) != kOkDspRC ) + return rc; + + + cmDspSysInstallCb(h, tlp, "val", prp, "in", NULL ); + + return rc; +} diff --git a/dsp/cmDspPgmKr.h b/dsp/cmDspPgmKr.h new file mode 100644 index 0000000..401e538 --- /dev/null +++ b/dsp/cmDspPgmKr.h @@ -0,0 +1,14 @@ +#ifndef cmDspPgmKr_h +#define cmDspPgmKr_h + +#ifdef __cplusplus +extern "C" { +#endif + + cmDspRC_t _cmDspSysPgm_TimeLine( cmDspSysH_t h, void** userPtrPtr ); + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/dsp/cmDspUi.c b/dsp/cmDspUi.c index 1e1ebdf..0e9a408 100644 --- a/dsp/cmDspUi.c +++ b/dsp/cmDspUi.c @@ -361,6 +361,29 @@ cmDspRC_t cmDspUiLabelCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lbl return rc; } +cmDspRC_t cmDspUiTimeLineCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned valVarId, unsigned lblVarId ) +{ + cmDspRC_t rc; + unsigned arr[] = { valVarId, lblVarId }; + cmDspValue_t v; + unsigned vn = sizeof(arr)/sizeof(arr[0]); + cmDsvSetUIntMtx(&v,arr,vn,1); + + // tell the UI to create a time-line control + if((rc = _cmDspUiMsg( ctx, kUiSelAsId, kTimeLineDuiId, 0, inst, cmInvalidId, &v )) != kOkDspRC ) + return cmDspInstErr(ctx,inst,kUiEleCreateFailDspRC,"Time Line UI element create failed."); + + // use instance symbol as default label + if((rc = _cmDspUiUseInstSymbolAsLabel(ctx, inst, lblVarId, "TimeLine")) != kOkDspRC ) + return rc; + + // Set the kUiDsvFl on the variables used for the min/max/def/val for this scalar + // Setting this flag will cause their values to be sent to the UI whenever they change. + cmDspInstVarSetFlags( ctx, inst, valVarId, kUiDsvFl ); + return rc; +} + + cmDspRC_t cmDspUiNewColumn( cmDspCtx_t* ctx, unsigned colW ) { cmDspRC_t rc = kOkDspRC;