View Single Post
Old 12-02-2009, 06:21 AM   #118
Human being with feelings
Join Date: Aug 2009
Posts: 157
Default BCR2000 control surface development

Well, making progress. Have record arm, mute, solo, and channel gain all working fine now (Yves, thanks for your comments, by the way. Yes, I did use the BCF2000 surface as a reference, but my design is quite different and what I am trying to do is keep the internal 'core' code the same between the Sonar and Reaper versions, as it is quite complex and already fully debugged. You can see the full source code for the Sonar version at It has quite a lot of functionality including a full console UI that doesn't really correspond to the functionality currently in the BCF2000 controller for Reaper, apart from the physical differences between the two control surfaces themselves, of course)

This is quite simple; I just shim the fairly small number of places where the control surface calls Sonar to create compatible APIs that map to Reaper.

I will go back and turn the design into a callback-driven design once I have it fully working polled, although I would need to be confident that Reaper is going to give me what I need in that mode. For instance, switching active project tabs would require the surface to fully invalidate its current settings so I assume Reaper will call me back on that, similarly, if tracks are added or deleted or moved. Otherwise the surface will get out of sync, a problem that does not occur with the polled design, comparatively inefficient though it is, of course. (note: it's all you get with Sonar, which does not support callbacks like Reaper; however the overhead of the Sonar version has been carefully tested and it is not measurable as far as I can determine, so unless Reaper's APIs are comparatively expensive to call, the polled design ought to be a good first cut)


My current roadblock is the transport controls. I would like the play button to toggle between play and pause, not play and stop, because in Reaper this rewinds, in Sonar the transport simply stops at the current point and resumes when play is pressed again.

Of course, therefore, this (cribbed essentially from the BCF code) works

if (bTransportState)

but there appears to be no corresponding CSurf_OnPause(). Searching through headers etc. I found CSurf_SetPlayState which I assume to be a callback from Reaper on transport changes, and OnPauseButtonEx() which *appears* to be the appropriate API, but calling this resulted in an access violation.
ajaym is offline   Reply With Quote