I'm trying to open a midi output and send simple note on / off messages to
midi channels.
I'am unsure of the complete procedure for opening a midi output and sending
MIDI messages.
So far i know you need to call openMidiOut ... get a midi output handle, and
use midiOutShortMessage
to send a single MIDI event to the output.
When I tried the following test prog no sound was produced when the message
was sent.
HMIDIOUT m_hMidiOut; // Dlg Class member
// construction
CMIDITestDlg::CMidiTestDlg()
{
midiOpenOut( &m_hMidiOut ); // Initialize midiOut
}
// Handlers
CMIDITestDlg::OnOn()
{
sendMIDIEvent(192, 1, 0); // 192 = set channel 1 voice, 1 = Grand
Piano
sendMIDIMsg( 144, 50, 127 ); // 144 status byte = channel 1 note
on, 50 = note value, 127 = velocity
}
CMIDITestDlg::OnOff()
{
sendMIDIMsg( 128, 50, 127 ); 128 = channel 1 note off
}
// Function to send message
void CMIDITestDlg::sendMIDIEvent(BYTE bStatus, BYTE bData1, BYTE bData2)
{
union {
DWORD dwData;
BYTE bData[4];
} u;
// Construct the MIDI message.
u.bData[0] = bStatus; // MIDI status byte
u.bData[1] = bData1; // first MIDI data byte
u.bData[2] = bData2; // second MIDI data byte
u.bData[3] = 0;
// Send the message.
midiOutShortMsg( m_hMidiOut, u.dwData);
}
Is there any other initialization needed for the midi output, such as directing midi
output to the sound card synth or sound card output?
Any tips advice or directions would be greatly apreciated;
thank-you
"Chris Barbour" <Chris....@btinternet.com> wrote in message
news:#0uNspXhAHA.2096@tkmsftngp04...