The
midiConnect function connects a
MMRESULT midiConnect(
HMIDI hMidi,
HMIDIOUT hmo,
LPVOID pReserved
);
Parameters
hMidi
Handle of a
hmo
Handle of the
pReserved
Reserved; must be NULL.
Return Values
Returns MMSYSERR_NOERROR if
successful or an error otherwise. Possible error values include the
following:
Value |
Description |
|
MIDIERR_NOTREADY |
Specified input device is already connected to an output device. |
|
MMSYSERR_INVALHANDLE |
Specified device handle is invalid. |
Remarks
After
calling this function, the
A
thru driver is a special form of
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
See Also
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions, midiOutOpen, MIM_DATA
midiConnect
The
midiConnect function connects a
MMRESULT midiConnect(
HMIDI hMidi,
HMIDIOUT hmo,
LPVOID pReserved
);
Parameters
hMidi
Handle of a
hmo
Handle of the
pReserved
Reserved; must be NULL.
Return Values
Returns MMSYSERR_NOERROR if
successful or an error otherwise. Possible error values include the
following:
Value |
Description |
|
MIDIERR_NOTREADY |
Specified input device is already connected to an output device. |
|
MMSYSERR_INVALHANDLE |
Specified device handle is invalid. |
Remarks
After
calling this function, the
A
thru driver is a special form of
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
See Also
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions, midiOutOpen, MIM_DATA
The
midiDisconnect function disconnects a
MMRESULT midiDisconnect(
HMIDI hMidi,
HMIDIOUT hmo,
LPVOID pReserved
);
Parameters
hMidi
Handle of a
hmo
Handle of the
pReserved
Reserved; must be NULL.
Return Values
Returns MMSYSERR_NOERROR if
successful or an error otherwise. Possible error values include the
following:
Value |
Description |
MMSYSERR_INVALHANDLE |
Specified device handle is invalid. |
Remarks
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
See Also
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions, midiConnect, MIM_DATA
The
midiInAddBuffer function sends an input buffer
to a specified opened
MMRESULT midiInAddBuffer(
HMIDIIN hMidiIn,
LPMIDIHDR lpMidiInHdr,
UINT cbMidiInHdr
);
Parameters
hMidiIn
Handle of the
lpMidiInHdr
Address of a MIDIHDR structure that
identifies the buffer.
cbMidiInHdr
Size, in bytes, of the MIDIHDR structure.
Return Values
Returns MMSYSERR_NOERROR if
successful or an error otherwise. Possible error values include the
following:
Value |
Description |
|
|
MIDIERR_STILLPLAYING |
The buffer pointed to by lpMidiInHdr
is still in the queue. |
||
MIDIERR_UNPREPARED |
The buffer pointed to by lpMidiInHdr
has not been prepared. |
||
MMSYSERR_INVALHANDLE |
The specified device handle is invalid. |
||
MMSYSERR_INVALPARAM |
The specified pointer or structure is invalid. |
||
MMSYSERR_NOMEM |
The system is unable to allocate or lock memory. |
||
Remarks
When
the buffer is filled, it is sent back to the application.
The
buffer must be prepared by using the midiInPrepareHeader
function before it is passed to the midiInAddBuffer
function.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
See Also
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions, MIDIHDR, midiInPrepareHeader
The
midiInClose function closes the specified
MMRESULT midiInClose(
HMIDIIN hMidiIn
);
Parameters
hMidiIn
Handle of the
Return Values
Returns MMSYSERR_NOERROR if
successful or an error otherwise. Possible error values include the
following:
Value |
Description |
MIDIERR_STILLPLAYING |
Buffers are still in the queue. |
MMSYSERR_INVALHANDLE |
The specified device handle is invalid. |
MMSYSERR_NOMEM |
The system is unable to allocate or lock memory. |
Remarks
If
there are input buffers that have been sent by using the midiInAddBuffer
function and have not been returned to the application, the close operation
will fail. To return all pending buffers through the callback
function, use the midiInReset function.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
See Also
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions, midiInAddBuffer, midiInReset
The
midiInGetDevCaps function determines the
capabilities of a specified
MMRESULT midiInGetDevCaps(
UINT uDeviceID,
LPMIDIINCAPS lpMidiInCaps,
UINT cbMidiInCaps
);
Parameters
uDeviceID
Identifier of the
lpMidiInCaps
Address of a MIDIINCAPS structure that is
filled with information about the capabilities of the device.
cbMidiInCaps
Size, in bytes, of the MIDIINCAPS structure. Only cbMidiInCaps
bytes (or less) of information is copied to the location pointed to by lpMidiInCaps. If cbMidiInCaps
is zero, nothing is copied, and the function returns MMSYSERR_NOERROR.
Return Values
Returns MMSYSERR_NOERROR if
successful or an error otherwise. Possible error values include the following:
Value |
Description |
MMSYSERR_BADDEVICEID |
The specified device identifier is out of range. |
MMSYSERR_INVALPARAM |
The specified pointer or structure is invalid. |
MMSYSERR_NODRIVER |
The driver is not installed. |
MMSYSERR_NOMEM |
The system is unable to allocate or lock memory. |
Remarks
To
determine the number of
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows
NT.
See Also
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions, MIDIINCAPS, midiInGetNumDevs
The
midiInGetErrorText function retrieves a
textual description for an error identified by the specified error code.
MMRESULT midiInGetErrorText(
MMRESULT wError,
LPSTR lpText,
UINT cchText
);
Parameters
wError
Error code.
lpText
Address of the buffer to be filled
with the textual error description.
cchText
Length, in characters, of the
buffer pointed to by lpText.
Return Values
Returns MMSYSERR_NOERROR if
successful or an error otherwise. Possible error values include the
following:
Value |
Description |
|
MMSYSERR_BADERRNUM |
The specified error number is out of range. |
|
MMSYSERR_INVALPARAM |
The specified pointer or structure is invalid. |
|
MMSYSERR_NOMEM |
The system is unable to allocate or lock memory. |
Remarks
If
the textual error description is longer than the specified buffer, the
description is truncated. The returned error string is always null-terminated.
If cchText is zero, nothing is copied, and the
function returns zero. All error descriptions are less than MAXERRORLENGTH characters long.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows
NT.
See Also
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions
The
midiInGetID function gets the device
identifier for the given
This
function is supported for backward compatibility. New applications can cast a
handle of the device rather than retrieving the device identifier.
MMRESULT midiInGetID(
HMIDIIN hmi,
LPUINT puDeviceID
);
Parameters
hmi
Handle of the
puDeviceID
Address of a variable to be filled
with the device identifier.
Return Values
Returns MMSYSERR_NOERROR if
successful or an error otherwise. Possible error values include the
following:
Value |
Description |
|
MMSYSERR_INVALHANDLE |
The hwi parameter specifies an
invalid handle. |
|
MMSYSERR_NODRIVER |
No device driver is present. |
|
MMSYSERR_NOMEM |
Unable to allocate or lock memory. |
|
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
See Also
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions
The midiInGetNumDevs function retrieves the number of
UINT
midiInGetNumDevs(VOID);
This
function takes no parameters.
Returns the
number of
Windows
NT: Requires
version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions
The midiInGetNumDevs function retrieves the number of
UINT
midiInGetNumDevs(VOID);
This
function takes no parameters.
Returns the
number of
Windows
NT: Requires
version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions
The
midiInMessage function sends a message to the
DWORD midiInMessage(
HMIDIIN hMidiIn,
UINT msg,
DWORD dw1,
DWORD dw2
);
Parameters
hMidiIn
Handle of the
msg
Message to send.
dw1 and dw2
Message parameters.
Return Values
Returns
the value returned by the audio device driver.
Remarks
This
function is used only for driver-specific messages that are not supported by
the MIDI API.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
See Also
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions
midiInMessage
The
midiInMessage function sends a message to the
DWORD midiInMessage(
HMIDIIN hMidiIn,
UINT msg,
DWORD dw1,
DWORD dw2
);
Parameters
hMidiIn
Handle of the
msg
Message to send.
dw1 and dw2
Message parameters.
Return Values
Returns
the value returned by the audio device driver.
Remarks
This
function is used only for driver-specific messages that are not supported by
the MIDI API.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
midiInOpen
The
midiInOpen function opens a specified
MMRESULT midiInOpen(
LPHMIDIIN lphMidiIn,
UINT uDeviceID,
DWORD dwCallback,
DWORD dwCallbackInstance,
DWORD dwFlags
);
Parameters
lphMidiIn
Address of an HMIDIIN
handle. This location is filled with a handle identifying the opened
uDeviceID
Identifier of the
dwCallback
Address of a callback
function, a thread identifier, or a handle of a window called with information
about incoming
dwCallbackInstance
User instance data passed to the callback function. This parameter is not used with window callback functions or threads.
dwFlags
Callback flag for opening the
device and, optionally, a status flag that helps regulate rapid data transfers.
It can be the following values:
CALLBACK_FUNCTION
The dwCallback
parameter is a callback procedure address.
CALLBACK_NULL
There is no callback
mechanism. This value is the default setting.
CALLBACK_THREAD
The dwCallback
parameter is a thread identifier.
CALLBACK_WINDOW
The dwCallback
parameter is a window handle.
MIDI_IO_STATUS
When this parameter also specifies CALLBACK_FUNCTION, MIM_MOREDATA messages are sent to
the callback function as well as MIM_DATA messages. Or, if this
parameter also specifies CALLBACK_WINDOW, MM_MIM_MOREDATA messages are sent to
the window as well as MM_MIM_DATA messages. This flag
does not affect event or thread callbacks.
Most applications that use a callback mechanism will specify CALLBACK_FUNCTION
for this parameter.
Return Values
Returns MMSYSERR_NOERROR if
successful or an error otherwise. Possible error values include the
following:
Value |
Description |
|
MMSYSERR_ALLOCATED |
The specified resource is already allocated. |
|
MMSYSERR_BADDEVICEID |
The specified device identifier is out of range. |
|
MMSYSERR_INVALFLAG |
The flags specified by dwFlags are
invalid. |
|
MMSYSERR_INVALPARAM |
The specified pointer or structure is invalid. |
|
MMSYSERR_NOMEM |
The system is unable to allocate or lock memory. |
Remarks
To
determine the number of
If
a window or thread is chosen to receive callback
information, the following messages are sent to the window procedure or thread
to indicate the progress of
If
a function is chosen to receive callback information,
the following messages are sent to the function to indicate the progress of
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
See Also
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions, MIM_MOREDATA, MIM_DATA, MM_MIM_MOREDATA, MM_MIM_DATA, midiInGetNumDevs, MidiInProc, MM_MIM_OPEN, MM_MIM_CLOSE, MM_MIM_LONGDATA, MM_MIM_ERROR, MM_MIM_LONGERROR, MIM_OPEN, MIM_CLOSE, MIM_DATA, MIM_LONGDATA, MIM_ERROR, MIM_LONGERROR, MIM_MOREDATA
The
midiInPrepareHeader function prepares a buffer
for
MMRESULT midiInPrepareHeader(
HMIDIIN hMidiIn,
LPMIDIHDR lpMidiInHdr,
UINT cbMidiInHdr
);
Parameters
hMidiIn
Handle of the
lpMidiInHdr
Address of a MIDIHDR structure that
identifies the buffer to be prepared.
cbMidiInHdr
Size, in bytes, of the MIDIHDR structure.
Return Values
Returns MMSYSERR_NOERROR if
successful or an error otherwise. Possible error values include the
following:
Value |
Description |
|
|
MMSYSERR_INVALHANDLE |
The specified device handle is invalid. |
||
MMSYSERR_INVALPARAM |
The specified address is invalid. |
||
MMSYSERR_NOMEM |
The system is unable to allocate or lock memory. |
||
Remarks
Preparing
a header that has already been prepared has no effect, and the function returns
zero.
After
the header has been prepared, do not modify the buffer. To free the buffer, use
the midiInUnprepareHeader function.
Before
using this function, you must set the lpData, dwBufferLength, and dwFlags
members of the MIDIHDR structure. The dwFlags member must be set to zero.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
See Also
Musical Instrument Digital Interface
(MIDI) Overview, MIDI Functions, MIDIHDR, midiInUnprepareHeader
The
MidiInProc function is the callback
function for handling incoming
void CALLBACK MidiInProc(
HMIDIIN hMidiIn,
UINT wMsg,
DWORD dwInstance,
DWORD dwParam1,
DWORD dwParam2
);
Parameters
hMidiIn
Handle of the
wMsg
dwInstance
Instance data supplied with the midiInOpen function.
dwParam1
Message parameters.
dwParam2
Message parameters.
Return Values
This
function does not return a value.
Remarks
Applications
should not call any system-defined functions from inside a callback
function, except for EnterCriticalSection, LeaveCriticalSection, midiOutLongMsg,
midiOutShortMsg, OutputDebugString,
PostMessage, PostThreadMessage,
SetEvent, timeGetSystemTime,
timeGetTime, timeKillEvent,
and timeSetEvent.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Import Library: User-defined.
See Also
Musical Instrument Digital Interface (MIDI) Overview, MIDI Functions,