Topic: MIDI programming question
Author: cs922081@ariel.yorku.ca (KEN M DUCK)
Date: Wed, 19 May 1993 14:21:12 GMT Raw View
Hello.
This question is for those of you with any BorlandC++ windows
programming experience, however it might help to have the BorlandC++
with multimedia applications.
I have recently been trying to write a program for MIDI usage and
ran into the following problem (It might be a simple mistake since I
am a fairly new C++ programmer):
PROBLEM BACKGROUND
To open up the device for output I am to use the command:
UINT midiOutOpen(lphMidiOut, wDeviceID, dwCallback, dwCallbackInstance,
dwFlags);
where LPHMIDIOUT lphMidiOut "specifies a far pointer to an HMIDIOUT
handle. This location is filled with a
handle identifying the opened MIDI output
device. Use this handle to identify the
device..."
An example of using the device handle is:
UINT midiOutClose(hMidiOut);
where HMIDIOUT hMidiOut "Specifies a handle to the MIDI output device..."
THE PROBLEM:
I define the LPHMIDIOUT pointer:
LPHMIDIOUT lphMidiOut;
I open the device:
intvar = midiOutOpen(lphMidiOut, ...);
I attempt to close the device:
newintvar = midiOutClose(*lphMidiOut);
this compiles and links fine, but when run the program crashes when
attempting to execute the midiOutClose command. An alternate route I
attempted was:
I define the HMIDIOUT handle:
HMIDIOUT hMidiOut;
I open the device:
intvar = midiOutOpen(&hMidiOut, ...);
I attempt to close the device:
newintvar = midiOutClose(hMidiOut);
This example compiles and links fine, but when attempting to close the
device the device will not close because the handle is invalid.
And help may be sent by email to:
cs922081@ariel.yorku.ca
Thanks for any input into my problem. Also, if there is any
example code floating around that might help me in my task feel free to
email it as well.
Ken Duck.