0

As described here, it should be possible to omit the status byte and only send data bytes after I set the status byte by sending the first command.

I'm testing with NoteOn command code (90 hex) and trying to play a chord, but it only works when the status byte is set at each call.

I tried putting the tone number into the lowest byte and velocity into second lowest but no sound was produced...

1 Answers1

0

What you describe sounds correct, however, if you are not getting the expected result then it's possible your MIDI device is not fully MIDI compliant.

The following example code successfully plays a broken chord using running status on the Windows built-in MIDI device on my Windows 11 machine:

#pragma comment(lib, "Winmm.lib")
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <mmsystem.h>
#include <mmeapi.h>
#include <iostream>

int main()
{
    try
    {
        HMIDIOUT hMidiOut = 0;
        MMRESULT mmResult = midiOutOpen(&hMidiOut, -1, NULL, NULL, CALLBACK_NULL);
        if (mmResult != MMSYSERR_NOERROR)
            throw std::exception("Failed to open the MIDI device.");
        mmResult = midiOutShortMsg(hMidiOut, 0x007F4090);
        if (mmResult != MMSYSERR_NOERROR)
            throw std::exception("midiOutShortMsg() failed.");
        Sleep(500);
        mmResult = midiOutShortMsg(hMidiOut, 0x00007F42);
        if (mmResult != MMSYSERR_NOERROR)
            throw std::exception("midiOutShortMsg() failed.");
        Sleep(500);
        mmResult = midiOutShortMsg(hMidiOut, 0x00007F44);
        if (mmResult != MMSYSERR_NOERROR)
            throw std::exception("midiOutShortMsg() failed.");
        Sleep(3000);
        midiOutReset(hMidiOut);
        midiOutClose(hMidiOut);
    }
    catch (const std::exception& e)
    {
        std::cout << e.what() << std::endl;
    }
}
EddieLotter
  • 324
  • 3
  • 8