Control Surface MIDI Send?

Author
tstruzik
Max Output Level: -90 dBFS
  • Total Posts : 5
  • Joined: 2006/10/31 13:47:02
  • Status: offline
2006/11/04 11:48:17 (permalink)

Control Surface MIDI Send?

Using the MorotMix example from the Control Surface SDK. Got the as-delivered MotorMix surface code to compile. Workng on adding my own changes. Got it 99% there :-) Problem is that I need to send a midi command to the control surface and that's not working.

Tried both
HRESULT hr = m_pSurface->MidiOutLongMsg( dwTotalLen, pbyBuffer );
and
HRESULT hr = m_pSurface->MidiOutShortMsg( dwTotalLen);

Both calls return a '1' result with nothing going out the midi port :-( It looks like this should go, but nothing. The docs in the SDK are, hmm sketchy to say the least. Saw some other folks reference in another forum that there used to be a better 'guide' included in the SDK. The current "Guide to the Cakewalk Control Surface Interface and Framework.doc" sayz zilch about the ISonarMidiOut interface other than stating that it exists. I'm stumped!

Anyout out there successfull with this or have some better documentation? Thanks much!
#1

2 Replies Related Threads

    aj
    Max Output Level: -69 dBFS
    • Total Posts : 1084
    • Joined: 2003/12/08 08:21:36
    • Status: offline
    RE: Control Surface MIDI Send? 2006/11/24 07:41:54 (permalink)
    Yes, this is weird. There are two sets of documentation which overlap and contradict each other for the control surface SDK. But the old documentation is no longer there. I do have it, but really it would be nice if Cake put it back up or revised the SDK docs currently there - they do go on a bit about finite state machines and the like but are a bit short of solid examples

    Here's a fragment of code from my own working control surface project. I did not use the framework.

    union unMIDIShortMsg
    {
    DWORD dwMsg;
    typMIDIShortMsg tMsg;
    };


    struct typMIDIShortMsg
    {
    BYTE cMsgType;
    BYTE cMsgChan;
    BYTE cMsgVal;
    BYTE cUnused;
    };


    unMsg.tMsg.cMsgChan = i;
    unMsg.tMsg.cMsgVal = (BYTE)(fVol * 127);
    // and update control surface accordingly
    m_pMidiOut->MidiOutShortMsg(this,unMsg.dwMsg);

    in this case we're outputting channel gain. The union makes it convenient to manage the message as individual bytes or as a four-byte DWORD.

    Note that cMsgChan is not the midi channel in my structure; it is the CC number, really, for this message type. Thus i is the CC number for the MIDI message Must rename that structure member....

    #2
    tstruzik
    Max Output Level: -90 dBFS
    • Total Posts : 5
    • Joined: 2006/10/31 13:47:02
    • Status: offline
    RE: Control Surface MIDI Send? 2006/12/09 12:09:54 (permalink)
    thanks! Yeah after much digging I learned a couple of things.

    1) the return of 1 seems to indicate that there's no MIDI output associated with the control surface
    2) Seems that running Sonar under the debugger tends to leave the midi device in a hung state, which then on invocation makes the MIDI device unavailable to Sonar (and to the control surface, thus resulting in the return of 1)

    Appears what was happening was I'd get Sonar set up properly (with a MIDI device) and even get the control surface insert with a good MIDI OUTPUT, but during the course of debugging, hung the MIDI device (unsure exactly how that's happening). Then the MidiOutShortMsg starts returning 1 rather than 0. Even though the properties on the surface show that there's a MIDI Output it doesn't work. Side effect also that going into Sonar MIDI Options, you can't reselect the MIDI device. Too, part of the problem was that I'd once checked the Sonar box "don't show me again" on the "starting without a midi device" error, so I didn't know this was happening. Only way I found to clear the stuck MIDI device was reboot.

    Now, I'm more diligent in making sure that the MIDI device stays valid and sure enough MidiOutShortMsg works just fine. Thanks a bunch!
    #3
    Jump to:
    © 2024 APG vNext Commercial Version 5.1