Can postGoToTrack move to the master?
If so, could I get a nudge on how that'd be done? When I've tried here using -1 as master, my cursor ends up in no man's land off the bottom of the track list. IE, the first press of UpArrow selects the bottom-most track.
postGoToTrack is used to report the track info after it has been moved to. The track parameter is MediaTrack* track which means it it is a pointer to MediaTrack. It does work for the master track, but it requires a MediaTrack* pointing to the master track, not -1.
I Hope that makes sense. If not, paste the code that isn't working.
So as a learning project, I'm aiming to replace a few custom actions on the key map with our own proper actions, I'm aware of some where the feedback or visual tracking get messy. Here's the code I've got. It builds and half works, the master track does get selected as intended, but it breaks track navigation in a way that I've never seen before. It's like I get dumped off of the bottom of the track list (IE, the first press of UpArrow after running this new action reselects the bottom-most track).
void cmdGoToMaster(Command* command){ MediaTrack* track = GetMasterTrack(0); if(!track) { return; } SetOnlyTrackSelected(track); postGoToTrack(0); }
What hath I did wrongly?
Does it report anything when you run the action? I suspect Reaper's last touched track isn't being updated in this case.
No report nope. Thanks, I'll try that.
Is the master visible? I suspect it has to be. In case it makes any difference, cmdMoveToTrack selects in a different way, and that is what moves to the master successfully with uparrow.
// Always select so this will become the last touched track.
// The track might already be selected,
// so we must first unselected.
GetSetMediaTrackInfo(track, "I_SELECTED", &int0);
GetSetMediaTrackInfo(track, "I_SELECTED", &int1);
Main_OnCommand(40913, 0); // Track: Vertical scroll selected tracks into view (TCP)
SetMixerScroll(track); // MCP
I think the last two lines are purely visual.
cmdMoveToTrack worked better in this case, Thanks! Protected against a crash that could happen if the master wasn't visible now as well. I just wanna get some eyes on finding out whether those two lines about scrolling are effective. If so, guess I'll add those into our go to first and last track actions.