Added dummy DSP time line ctl and cmDspPgmKr.c/h

This commit is contained in:
kevin 2012-11-15 17:42:29 -08:00
parent c80368a549
commit 785762a88e
10 changed files with 171 additions and 45 deletions

View File

@ -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

View File

@ -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

View File

@ -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,
};

View File

@ -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 );

View File

@ -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;
}

View File

@ -6,7 +6,7 @@ extern "C" {
#endif
struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx );
struct cmDspClass_str* cmTimeLineClassCons( cmDspCtx_t* ctx );
#ifdef __cplusplus
}

View File

@ -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 },

51
dsp/cmDspPgmKr.c Normal file
View File

@ -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;
}

14
dsp/cmDspPgmKr.h Normal file
View File

@ -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

View File

@ -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;