Class TMidiOutput (unit MidiOut)

Inherits from

TComponent

-------------------------------------------------------------------

Constructors


constructor Create(AOwner:TComponent);

Not used in Delphi 3 { This is the callback procedure in the external DLL.


Functions

function Close: Boolean;

-------------------------------------------------------------------

destructor Destroy;

-------------------------------------------------------------------

function Open: Boolean;

Methods

-------------------------------------------------------------------


procedure PutLong(TheSysex: Pointer; msgLength: Word);

-------------------------------------------------------------------

procedure PutMidiEvent( theEvent: TMyMidiEvent);

-------------------------------------------------------------------

procedure PutShort(MidiMessage: Byte; Data1: Byte; Data2: Byte);

-------------------------------------------------------------------

procedure SetVolume( Left: Word; Right:Word );

-------------------------------------------------------------------

function midioutErrorString( WError: Word ): String;

-------------------------------------------------------------------} { Convert the numeric return code from an MMSYSTEM function to a string using midioutGetErrorText.

procedure MidiOutput(var Message: TMessage);

Sysex output finished

-------------------------------------------------------------------


procedure SetDeviceID(DeviceID: Integer);

-------------------------------------------------------------------} { Set the output device ID and change the other properties to match

procedure SetProductName( NewProductName: String );

-------------------------------------------------------------------} { Set the product name property and put the matching output device number in FDeviceID.

procedure SetTechnology( NewTechnology : OutPortTech );

-------------------------------------------------------------------} { Set the output technology property and put the matching output device number in FDeviceID.

Properties

property DeviceID : Integer


property ProductName : String

TODO: Property editor with dropdown list of product names

property ChannelMask : Word

Number of notes (internal synth)

property DriverVersion : Version


property Error : Word

patch caching etc.

property MIDIHandle : Hmidiout

Properties

property Notes : Word

Number of voices (internal synth)

property Numdevs : Word


property Support : DWORD

device responds to (internal synth)

property Technology : OutPortTech

Driver version from midioutGetDevCaps

property Voices : Word

Type of MIDI output device

Events

event Onmidioutput : TNotifyEvent

TODO: midiOutGetVolume? Or two properties for Left and Right volume? Is it worth it?? midiOutMessage?? Does anyone use this? } { Events

Variables

FChannelMask : Word;

Number of notes (internal synth)

FDeviceID : Integer;

Window handle used for callback notification

FDriverVersion : Version;

Last MMSYSTEM error } { Stuff from midioutCAPS

FError : Word;

Output queue for PutTimedEvent, set by Open

FMIDIHandle : Hmidiout;

MIDI device ID

FNotes : Word;

Number of voices (internal synth)

FNumdevs : Word;

Technology supported (volume control, patch caching etc.

FOnMIDIOutput : TNotifyEvent;

Number of MIDI output devices on system

FProductName : string;

Driver version from midioutGetDevCaps

FState : midioutputState;

Handle to output device

FSupport : DWORD;

Bit set for each MIDI channels that the device responds to (internal synth)

FTechnology : OutPortTech;

product name

FVoices : Word;

Type of MIDI output device

Handle : THandle;


PBuffer : PCircularBuffer;

Pointer to control info for DLL

PCtlInfo : PMidiCtlInfo;

Current device state


Constructors


constructor Create(AOwner:TComponent);

Not used in Delphi 3 { This is the callback procedure in the external DLL. It's used when midioutOpen is called by the Open method. There are special requirements and restrictions for this callback procedure (see midioutOpen 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} function midiHandler( hMidiIn: HMidiIn; wMsg: Word; dwInstance: DWORD; dwParam1: DWORD; dwParam2: DWORD): Boolean; far; external 'DELPHMID.DLL'; {$ENDIF} *) {-------------------------------------------------------------------


Functions


function Close: Boolean;

-------------------------------------------------------------------


destructor Destroy;

-------------------------------------------------------------------


function Open: Boolean;

Methods

-------------------------------------------------------------------


procedure PutLong(TheSysex: Pointer; msgLength: Word);

-------------------------------------------------------------------


procedure PutMidiEvent( theEvent: TMyMidiEvent);

-------------------------------------------------------------------


procedure PutShort(MidiMessage: Byte; Data1: Byte; Data2: Byte);

-------------------------------------------------------------------


procedure SetVolume( Left: Word; Right:Word );

-------------------------------------------------------------------


function midioutErrorString( WError: Word ): String;

-------------------------------------------------------------------} { Convert the numeric return code from an MMSYSTEM function to a string using midioutGetErrorText. TODO: These errors aren't very helpful (e.g. "an invalid parameter was passed to a system function") so some proper error strings would be nice.


procedure MidiOutput(var Message: TMessage);

Sysex output finished

-------------------------------------------------------------------


procedure SetDeviceID(DeviceID: Integer);

-------------------------------------------------------------------} { Set the output device ID and change the other properties to match


procedure SetProductName( NewProductName: String );

-------------------------------------------------------------------} { Set the product name property and put the matching output device number in FDeviceID. This is handy if you want to save a configured output/output device by device name instead of device number, because device numbers may change if users install or remove MIDI devices. Exception if output device with matching name not found, or if output device is open


procedure SetTechnology( NewTechnology : OutPortTech );

-------------------------------------------------------------------} { Set the output technology property and put the matching output device number in FDeviceID. This is handy, for example, if you want to be able to switch between a sound card and a MIDI port


Properties


property DeviceID : Integer


property ProductName : String

TODO: Property editor with dropdown list of product names


property ChannelMask : Word

Number of notes (internal synth)


property DriverVersion : Version


property Error : Word

patch caching etc.


property MIDIHandle : Hmidiout

Properties


property Notes : Word

Number of voices (internal synth)


property Numdevs : Word


property Support : DWORD

device responds to (internal synth)


property Technology : OutPortTech

Driver version from midioutGetDevCaps


property Voices : Word

Type of MIDI output device


Events


event Onmidioutput : TNotifyEvent

TODO: midiOutGetVolume? Or two properties for Left and Right volume? Is it worth it?? midiOutMessage?? Does anyone use this? } { Events


Variables


FChannelMask : Word;

Number of notes (internal synth)


FDeviceID : Integer;

Window handle used for callback notification


FDriverVersion : Version;

Last MMSYSTEM error } { Stuff from midioutCAPS


FError : Word;

Output queue for PutTimedEvent, set by Open


FMIDIHandle : Hmidiout;

MIDI device ID


FNotes : Word;

Number of voices (internal synth)


FNumdevs : Word;

Technology supported (volume control, patch caching etc.


FOnMIDIOutput : TNotifyEvent;

Number of MIDI output devices on system


FProductName : string;

Driver version from midioutGetDevCaps


FState : midioutputState;

Handle to output device


FSupport : DWORD;

Bit set for each MIDI channels that the device responds to (internal synth)


FTechnology : OutPortTech;

product name


FVoices : Word;

Type of MIDI output device


Handle : THandle;


PBuffer : PCircularBuffer;

Pointer to control info for DLL


PCtlInfo : PMidiCtlInfo;

Current device state