View Single Post
Old 12-01-2009, 11:12 AM   #115
ajaym
Human being with feelings
 
Join Date: Aug 2009
Posts: 157
Default Retrieving mute status

Ahhhhh

Thanks folks

I found that I couldn't include the whole generated header file - Reaproject, referenced in some of the function declarations, is not a defined symbol anywhere including in the other header files, so I manually created the necessary extern definition for the API and added it to the dynamic load code.

Then the following code (iTrackNo starts from 0 because Sonar tracks are zero-based so we add 1)

bool bVal = false;
MediaTrack *tr=CSurf_TrackFromID(iTrackNo+1,false);
if (tr) bVal=*(bool *)GetSetMediaTrackInfo(tr,"B_MUTE",NULL);

seems to correctly return true and false.

I looked into the callback functions e.g SetSurfaceMute and found to my surprise that on a test project with one track and a single master and nothing else, this gets called about 10 times at startup (and my code to set muting was disabled at the time, because I already confirmed that if you programmatically set the mute value, you'll get the callback subsequently)

This seems rather more callbacks than I would expect, (I'd have thought just a couple, for the track and master mute status), although at present this is a bit academic because I'll get the whole thing working in 'Sonar' mode, where each poll we reconcile the surface status with the current project status, since Sonar doesn't support event change callbacks - it's not quite as efficient but in practice the CPU overhead is pretty negligible.

So at present I have one mute button working in full duplex. A very promising start. Next step is to get mute, solo, channel gain and pan up and running - these should be simple enough since there's a call for gain and pan I've already confirmed works, and then I need to check that the console and its scribble strips can be gotten working. That should also be straightforward enough since the console needs no changes; it's a completely out of process UI written in VB6 and the control surface task sends a COM method call to it with the required data in a safearray, and then the console immediately returns and posts itself a callback so as not to block the surface thread. This will all work in exactly the same way with Reaper. So, looking promising.

Where I request strings for track names etc. I take it that I need to free the string from the heap each time as you mention; this is presumably generally true where Reaper returns me a string, I'm guessing.

I'm still not entirely clear how to access the master channel's properties, though. My test project has just one track plus the master and the reported track count I get back is 1. I assume that track indexes start from 1 (in Sonar they start from 0) because this is setting the mute for the first track in my project.

Still, I'll press on with the other work and see where I next get stuck. Once again many thanks indeed.
ajaym is offline   Reply With Quote