cmDspFx.c,cmDspPgm.c: Finalized IntToSym.
This commit is contained in:
parent
77367919b7
commit
b16673bbc0
@ -5772,19 +5772,19 @@ cmDspRC_t _cmDspIntToSym_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt
|
||||
{
|
||||
cmDspRC_t rc = kOkDspRC;
|
||||
cmDspIntToSym_t* p = (cmDspIntToSym_t*)inst;
|
||||
unsigned idx = cmInvalidIdx;
|
||||
|
||||
// if an integer arrived at 'in'
|
||||
if( evt->dstVarId == kInItsId )
|
||||
{
|
||||
cmDspSetEvent(ctx,inst,evt);
|
||||
|
||||
unsigned i;
|
||||
int intVal = cmDspInt(inst,kInItsId);
|
||||
|
||||
for(i=0; i<p->symIdCnt; ++i)
|
||||
if( intVal == p->intArray[i] )
|
||||
{
|
||||
rc = _cmDspIntToSymSendOut( ctx, inst, idx );
|
||||
idx = i;
|
||||
rc = _cmDspIntToSymSendOut( ctx, inst, i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -5802,9 +5802,7 @@ cmDspRC_t _cmDspIntToSym_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt
|
||||
{
|
||||
cmDspSetEvent(ctx,inst,evt);
|
||||
|
||||
int x = cmDspInt( inst, evt->dstVarId );
|
||||
printf("%i %i\n", x, p->symIdArray[evt->dstVarId - p->baseIntItsId] );
|
||||
p->intArray[ evt->dstVarId - p->baseIntItsId ] = x;
|
||||
p->intArray[ evt->dstVarId - p->baseIntItsId ] = cmDspInt( inst, evt->dstVarId );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2909,13 +2909,14 @@ cmDspRC_t _cmDspSysPgm_IntToSym( cmDspSysH_t h, void** userPtrPtr )
|
||||
{
|
||||
cmDspRC_t rc = kOkDspRC;
|
||||
|
||||
inst_t* btn0 = button( "Btn0", 0.0 );
|
||||
inst_t* btn1 = button( "Btn1", 1.0 );
|
||||
inst_t* btn2 = button( "Btn2", 2.0 );
|
||||
inst_t* sel0 = scalar( "Sel0", 0.0, 10.0, 1.0, 1.0 );
|
||||
inst_t* sel1 = scalar( "Sel1", 0.0, 10.0, 1.0, 1.0 );
|
||||
inst_t* sel2 = scalar( "Sel2", 0.0, 10.0, 1.0, 1.0 );
|
||||
inst_t* val = scalar( "Val", 0.0, 10.0, 1.0, 1.0 );
|
||||
|
||||
inst_t* pts = inst( "IntToSym", NULL, 1, "one", 2, "two", 3, "three");
|
||||
inst_t* pts = inst( "IntToSym", NULL, 0, "one", 0, "two", 0, "three");
|
||||
|
||||
inst_t* pr0 = inst( "Printer", NULL, "btn:" );
|
||||
inst_t* pr0 = inst( "Printer", NULL, "val:" );
|
||||
inst_t* pr1 = inst( "Printer", NULL, "sym:" );
|
||||
inst_t* pr2 = inst( "Printer", NULL, "out:" );
|
||||
|
||||
@ -2923,13 +2924,12 @@ cmDspRC_t _cmDspSysPgm_IntToSym( cmDspSysH_t h, void** userPtrPtr )
|
||||
if((rc = cmDspSysLastRC(h)) != kOkDspRC )
|
||||
goto errLabel;
|
||||
|
||||
event( btn0, out, pts, one );
|
||||
event( btn1, out, pts, two );
|
||||
event( btn2, out, pts, three );
|
||||
event( sel0, val, pts, one-int );
|
||||
event( sel1, val, pts, two-int );
|
||||
event( sel2, val, pts, three-int );
|
||||
|
||||
event( btn0, out, pr0, in );
|
||||
event( btn1, out, pr0, in );
|
||||
event( btn2, out, pr0, in );
|
||||
event( val, val, pts, in );
|
||||
event( val, val, pr0, in );
|
||||
|
||||
event( pts, one, pr1, in );
|
||||
event( pts, two, pr1, in );
|
||||
|
Loading…
Reference in New Issue
Block a user