Merge branch 'master' of klarke.webfactional.com:webapps/git/repos/libcm

This commit is contained in:
kevin 2012-11-16 11:58:50 -08:00
commit 68f00dbbf9
10 changed files with 175 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 cmHDR += src/libcm/dsp/cmDspBuiltIn.h src/libcm/dsp/cmDspFx.h
cmSRC += src/libcm/dsp/cmDspBuiltIn.c src/libcm/dsp/cmDspFx.c 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 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/cmDspKr.c src/libcm/dsp/cmDspPgmPP.c src/libcm/dsp/cmDspPgmPPMain.c 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 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 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 kButtonDuiId, // ui<--eng create button control
kCheckDuiId, // ui<--eng create a check box control kCheckDuiId, // ui<--eng create a check box control
kLabelDuiId, // ui<--end create a label control kLabelDuiId, // ui<--end create a label control
kTimeLineDuiId,// ui<--end create a time-line control
kNumberDuiId, // ui<--eng create a number box kNumberDuiId, // ui<--eng create a number box
kTextDuiId, // ui<--eng create a text entry control kTextDuiId, // ui<--eng create a text entry control
kFnameDuiId, // ui<--eng create a file/directory picker control kFnameDuiId, // ui<--eng create a file/directory picker control

View File

@ -19,6 +19,7 @@
#include "cmDspCtx.h" #include "cmDspCtx.h"
#include "cmDspClass.h" #include "cmDspClass.h"
#include "cmDspFx.h" #include "cmDspFx.h"
#include "cmDspKr.h"
#include "cmMsgProtocol.h" #include "cmMsgProtocol.h"
#include "cmThread.h" #include "cmThread.h"
#include "cmUdpPort.h" #include "cmUdpPort.h"
@ -4990,6 +4991,9 @@ cmDspClassConsFunc_t _cmDspClassBuiltInArray[] =
cmPresetClassCons, cmPresetClassCons,
cmBcastSymClassCons, cmBcastSymClassCons,
cmSegLineClassCons, cmSegLineClassCons,
cmTimeLineClassCons,
NULL, 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 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 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 cmDspUiLabelCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lblVarId, unsigned alignVarId );
cmDspRC_t cmDspUiTimeLineCreate(cmDspCtx_t* ctx,cmDspInst_t* inst, unsigned valVarId, unsigned lblVarId, unsigned tlFileId, unsigned audPathId );
cmDspRC_t cmDspUiNewColumn( cmDspCtx_t* ctx, unsigned colW ); cmDspRC_t cmDspUiNewColumn( cmDspCtx_t* ctx, unsigned colW );
cmDspRC_t cmDspUiInsertHorzBorder( cmDspCtx_t* ctx ); cmDspRC_t cmDspUiInsertHorzBorder( cmDspCtx_t* ctx );

View File

@ -56,49 +56,8 @@ typedef struct
cmDspClass_t _cmKrDC; 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 ) cmDspInst_t* _cmDspKrAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
{ {
@ -267,3 +226,73 @@ struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx )
} }
//==========================================================================================================================================
enum
{
kValTlId,
kLblTlId,
kTlFileTlId,
kAudPathTlId
};
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,kTlFileTlId,kAudPathTlId);
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 #endif
struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx ); struct cmDspClass_str* cmKrClassCons( cmDspCtx_t* ctx );
struct cmDspClass_str* cmTimeLineClassCons( cmDspCtx_t* ctx );
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -23,6 +23,7 @@
#include "cmDspSys.h" #include "cmDspSys.h"
#include "cmDspPgm.h" #include "cmDspPgm.h"
#include "cmDspPgmPP.h" #include "cmDspPgmPP.h"
#include "cmDspPgmKr.h"
cmDspRC_t _cmDspSysPgm_Stereo_Through( cmDspSysH_t h, void** userPtrPtr ) 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[] = _cmDspSysPgm_t _cmDspSysPgmArray[] =
{ {
{ "time_line", _cmDspSysPgm_TimeLine, NULL, NULL },
{ "main", _cmDspSysPgm_Main, NULL, NULL }, { "main", _cmDspSysPgm_Main, NULL, NULL },
{ "array", _cmDspSysPgm_Array, NULL, NULL }, { "array", _cmDspSysPgm_Array, NULL, NULL },
{ "line", _cmDspSysPgm_Line, 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,31 @@ cmDspRC_t cmDspUiLabelCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lbl
return rc; return rc;
} }
cmDspRC_t cmDspUiTimeLineCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned valVarId, unsigned lblVarId, unsigned tlFileVarId, unsigned audPathVarId )
{
cmDspRC_t rc;
unsigned arr[] = { valVarId, lblVarId, tlFileVarId, audPathVarId };
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 );
cmDspInstVarSetFlags( ctx, inst, tlFileVarId, kUiDsvFl );
cmDspInstVarSetFlags( ctx, inst, audPathVarId, kUiDsvFl );
return rc;
}
cmDspRC_t cmDspUiNewColumn( cmDspCtx_t* ctx, unsigned colW ) cmDspRC_t cmDspUiNewColumn( cmDspCtx_t* ctx, unsigned colW )
{ {
cmDspRC_t rc = kOkDspRC; cmDspRC_t rc = kOkDspRC;