PDA

View Full Version : saving and restoring csurf parameters


hereander
06-01-2008, 03:30 PM
Hi!
I've almost finished my mcu-mod with the "where-am-i"-display and some other improvements (from my p.o.v ;) ) especially for bcf2000 in mackie mode. The problem I have now is that I don't understand the mechanism of saving and restoring parameters for an instance of the controlsurface. can anyone explain this?

as far as i get it the parameters are sequentially stored in a string:
char *initConfigString
they are stored like:
sprintf(tmp,"%d %d %d %d",offs,size,indev,outdev);
lstrcpyn((char *)lParam, tmp,wParam);
and they are restored with parseParms from the array parms[4]

this means that there are only 4 params, all int < 10.

How can I store my own stuff in there (like a DWORD, boolean or other int's > 9)? wherever I try to add something to the string or the array i get stack overflows at runtime. ´(Run-Time Check Failure #2 - Stack around the variable 'parms' was corrupted.)

I hope is this is not too confusing...

hereander
06-03-2008, 02:29 AM
Seems to be all different now in the new SDK. It took me long time to think about a way to handle tracks with their states. All obsolete now... dunno if I will merge that with the new code. More pointers, new classes, much more object oriented.

EDIT: parseParms is still the same, there were only the new flags added. I still don't know how to put something >9 in there... any help?

Klinke
06-10-2009, 04:45 AM
About what "new SDK" are you talking? The page with the downloadable Mini-SDK still say that the last update was one year ago.

And i don't see a problem with putting numbers > 9 into the parameters, but when you add additional parameters you must increase the corresponding arrays of course (Your problem looks like you want to write something in parms with an index out of bounds).

hereander
06-10-2009, 04:41 PM
About what "new SDK" are you talking? The page with the downloadable Mini-SDK still say that the last update was one year ago.


oh, i guess i meant "new api" which would mean a new sdk COULD be necessary (if it wasnt backward compatible)
obviously there is no new sdk but as i couldnt get the old stuff to work with version 3 i thought i should wait for one. seems like it was just the problem with TimeMap_timeToBeats that needs to be replaced, like you described in another thread.

hereander
06-15-2009, 04:02 PM
btw...
I just found that there IS a new SDK (9.june 09) on landoleet. Just had a quick look. It has more project oriented stuff of the api exposed and some minor changes in the mcu code (for example). anybody tried this allready?

Klinke
06-17-2009, 03:00 PM
Thank you for this hint.

hereander
06-17-2009, 05:16 PM
I just merged my old code with the new sdk and it seem like there's something different with the tracks behaviour.
In my old plugin, in an empty project, i could do

MediaTrack *t=CSurf_TrackFromID(0,g_csurf_mcpmode);
color = *(DWORD*)GetSetMediaTrackInfo(t,"I_CUSTOMCOLOR",NULL);

now in reaper 3 the second line causes a memory access violation.

EDIT: My stupid mistake. The function was not imported at all. i forgot IMPAPI(GetSetMediaTrackInfo)
sorry...