Class TMidiInput (unit MidiIn) |
Inherits from
TComponent
-------------------------------------------------------------------
constructor Create(AOwner:TComponent);
- Not used in Delphi 3
{ This is the callback procedure in the external DLL.
procedure Close;
-------------------------------------------------------------------
destructor Destroy;
-------------------------------------------------------------------} { Close the device if it's open
function GetMidiEvent: TMyMidiEvent;
Get first message in input queue -------------------------------------------------------------------
procedure MidiInput(var Message: TMessage);
-------------------------------------------------------------------
procedure Open;
TODO: property to select which incoming messages get filtered out -------------------------------------------------------------------
procedure Start;
-------------------------------------------------------------------
procedure Stop;
-------------------------------------------------------------------
procedure AddBuffers;
-------------------------------------------------------------------} { Add sysex buffers, if required, to input device
function GetEventCount: Word;
-------------------------------------------------------------------
function MidiInErrorString( WError: Word ): String;
-------------------------------------------------------------------} { Convert the numeric return code from an MMSYSTEM function to a string
using midiInGetErrorText.
procedure Prepareheaders;
Pointer to control info for DLL -------------------------------------------------------------------} { Get the sysex buffers ready
procedure SetDeviceID(DeviceID: Word);
-------------------------------------------------------------------} { Set the Device ID to select a new MIDI input device
Note: If no MIDI devices are installed, throws an 'Invalid Device ID' exception
procedure SetProductName( NewProductName: String );
-------------------------------------------------------------------} { Set the product name and put the matching input device number in FDeviceID.
procedure SetSysexBufferCount(BufferCount: Word);
-------------------------------------------------------------------} { Set the sysex buffer count, fail if device is already open
procedure SetSysexBufferSize(BufferSize: Word);
-------------------------------------------------------------------} { Set the sysex buffer size, fail if device is already open
procedure SetSysexOnly(bSysexOnly: Boolean);
-------------------------------------------------------------------} { Set the Sysex Only flag to eliminate unwanted short MIDI input messages
procedure UnprepareHeaders;
-------------------------------------------------------------------} { Clean up from PrepareHeaders
property Capacity : Word
property DeviceID : Word
property Error : Word
property ProductName : String
TODO: Property editor with dropdown list of product names
property SysexBufferCount : Word
property SysexBufferSize : Word
property SysexOnly : Boolean
property DriverVersion : Version
property MessageCount : Word
property MID : Word
property MIDIHandle : HMIDIIn
property Numdevs : Word
Product ID
property PID : Word
Manufacturer ID
event OnMidiInput : TNotifyEvent
Events
event OnOverflow : TNotifyEvent
FCapacity : Word;
Product ID } { Queue
FDeviceID : Word;
Window handle used for callback notification
FDriverVersion : Version;
Stuff from MIDIINCAPS
FError : Word;
Current device state
FMID : Word;
FMIDIHandle : HMIDIIn;
MIDI device ID
FNumdevs : Word;
Low-level MIDI input buffer created by Open method
FOnMIDIInput : TNotifyEvent;
Number of input devices on system } { Events
FOnOverflow : TNotifyEvent;
MIDI Input arrived
FPID : Word;
Manufacturer ID
FProductName : string;
FState : MidiInputState;
Handle to input device
FSysexBufferCount : Word;
FSysexBufferSize : Word;
Input buffer overflow } { TODO: Some sort of error handling event for MIM_ERROR } { Sysex
FSysexOnly : Boolean;
Handle : THandle;
MidiHdrs : Tlist;
PBuffer : PCircularBuffer;
Buffer capacity
PCtlInfo : PMidiCtlInfo;
constructor Create(AOwner:TComponent);
Not used in Delphi 3
{ This is the callback procedure in the external DLL.
It's used when midiInOpen is called by the Open method.
There are special requirements and restrictions for this callback
procedure (see midiInOpen in MMSYSTEM.HLP) so it's impractical to
make it an object method }
{$IFDEF WIN32}
function midiHandler(
hMidiIn: HMidiIn;
wMsg: UINT;
dwInstance: DWORD;
dwParam1: DWORD;
dwParam2: DWORD): Boolean; stdcall; external 'DELMID32.DLL';
{$ELSE}
procedure midiHandler(
hMidiIn: HMidiIn;
wMsg: Word;
dwInstance: DWORD;
dwParam1: DWORD;
dwParam2: DWORD); far; external 'DELPHMID';
{$ENDIF}
*) {-------------------------------------------------------------------
procedure Close;
-------------------------------------------------------------------
destructor Destroy;
-------------------------------------------------------------------} { Close the device if it's open
function GetMidiEvent: TMyMidiEvent;
Get first message in input queue
-------------------------------------------------------------------
procedure MidiInput(var Message: TMessage);
-------------------------------------------------------------------
procedure Open;
TODO: property to select which incoming messages get filtered out
-------------------------------------------------------------------
procedure Start;
-------------------------------------------------------------------
procedure Stop;
-------------------------------------------------------------------
procedure AddBuffers;
-------------------------------------------------------------------} { Add sysex buffers, if required, to input device
function GetEventCount: Word;
-------------------------------------------------------------------
function MidiInErrorString( WError: Word ): String;
-------------------------------------------------------------------} { Convert the numeric return code from an MMSYSTEM function to a string
using midiInGetErrorText. TODO: These errors aren't very helpful
(e.g. "an invalid parameter was passed to a system function") so
sort out some proper error strings.
procedure Prepareheaders;
Pointer to control info for DLL
-------------------------------------------------------------------} { Get the sysex buffers ready
procedure SetDeviceID(DeviceID: Word);
-------------------------------------------------------------------} { Set the Device ID to select a new MIDI input device
Note: If no MIDI devices are installed, throws an 'Invalid Device ID' exception
procedure SetProductName( NewProductName: String );
-------------------------------------------------------------------} { Set the product name and put the matching input device number in FDeviceID.
This is handy if you want to save a configured input/output device
by device name instead of device number, because device numbers may
change if users add or remove MIDI devices.
Exception if input device with matching name not found,
or if input device is open
procedure SetSysexBufferCount(BufferCount: Word);
-------------------------------------------------------------------} { Set the sysex buffer count, fail if device is already open
procedure SetSysexBufferSize(BufferSize: Word);
-------------------------------------------------------------------} { Set the sysex buffer size, fail if device is already open
procedure SetSysexOnly(bSysexOnly: Boolean);
-------------------------------------------------------------------} { Set the Sysex Only flag to eliminate unwanted short MIDI input messages
procedure UnprepareHeaders;
-------------------------------------------------------------------} { Clean up from PrepareHeaders
property Capacity : Word
property DeviceID : Word
property Error : Word
property ProductName : String
TODO: Property editor with dropdown list of product names
property SysexBufferCount : Word
property SysexBufferSize : Word
property SysexOnly : Boolean
property DriverVersion : Version
property MessageCount : Word
property MID : Word
property MIDIHandle : HMIDIIn
property Numdevs : Word
Product ID
property PID : Word
Manufacturer ID
event OnMidiInput : TNotifyEvent
Events
event OnOverflow : TNotifyEvent
FCapacity : Word;
Product ID } { Queue
FDeviceID : Word;
Window handle used for callback notification
FDriverVersion : Version;
Stuff from MIDIINCAPS
FError : Word;
Current device state
FMID : Word;
FMIDIHandle : HMIDIIn;
MIDI device ID
FNumdevs : Word;
Low-level MIDI input buffer created by Open method
FOnMIDIInput : TNotifyEvent;
Number of input devices on system } { Events
FOnOverflow : TNotifyEvent;
MIDI Input arrived
FPID : Word;
Manufacturer ID
FProductName : string;
FState : MidiInputState;
Handle to input device
FSysexBufferCount : Word;
FSysexBufferSize : Word;
Input buffer overflow } { TODO: Some sort of error handling event for MIM_ERROR } { Sysex
FSysexOnly : Boolean;
Handle : THandle;
MidiHdrs : Tlist;
PBuffer : PCircularBuffer;
Buffer capacity
PCtlInfo : PMidiCtlInfo;