-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
282 lines (188 loc) · 9.39 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
Delphi MIDI I/O components Version 7.0 28 May 2010
-------------------------- ---------------------------
This release incorporates changes neccessary for use with newer
Delphi releases (developed under Delphi 2010 Professional).
Components should work in D6 and up.
It introduces new features to MidiIn/Out, DeviceID reverted to the
intended Cardinal handling as described by the Win32 SDK (MSDN) and
much more. I've also reformatted some of the code to meet modern
standards, moved the Examples to a new folder and created a new
package for visual use of the components. Components have been
tested to work on WinXP (32bit) so far.
Main intention was to have better MIDI I/O components for my Line6
project. Since the original source code was released as PUBLIC DOMAIN
I've changed the licensing to the MPL/GPL/LGPL to encourage further
development everyone can benefit from. Big THANKS to David Churcher.
His 13 years old components are the base for these improvements!
Thanks to turboPASCAL and FAlter for adding modern Delphi support.
Download & issue tracker can be found at
http://bitbucket.org/h4ndy/midiio-dev
German discussion thread located at
http://www.delphipraxis.net/topic178030,0,asc,0.html
- Manuel Kroeber <manuel.kroeber@googlemail.com>; Germany 2010
Delphi MIDI I/O components Version 6.1 16 Oct 2007
-------------------------- ---------------------------
Version 6.1 (16. Oktober 2007)
Aktive Bereichsprüfung führte zu Exceptions - vermutlich verwendet die
MMSystem einen falschen Typ, denn Integer wäre logischer als Cardinal,
da -1 definitiv erlaubt ist (MIDI-Mapper).
--- English Translation by Manuel Kroeber/2010
Activated range checking is leading to exceptions. Maybe because the
MMSystem seems to use a wrong type, because Integer would be a more
logical choice than Cardinal, because -1 is allowed (MS MIDI Mapper).
v6.1 was done by FAlter, Member of DelphiPraxis.net board.
Delphi MIDI I/O Components Version 6.0 30. Juni 2005
-------------------------- ---------------------------
Hi,
Dies ist NICHT das Originalpackage! Die Dateien wurden von turboPASCAL
aus der DP freundlicherweise verbessert.
Dieses Package hier wurde für Delphi 6 entwickelt.
Mfg
FAlter
--- English Translation by Manuel Kroeber/2010
This ISN'T the original package. The files have been improved by
turboPASCAL, member of DelphiPraxis.net board.
This package has been developed for use with Delphi 6.
Best regards,
FAlter (member of DelphiPraxis.net board)
--- Original ---
Delphi MIDI I/O Components Version 3.0c 14 Mar 2003
-------------------------- -------------------------
These components handle low-level MIDI input and output using the
Windows multimedia MIDI functions. They encapsulate all the nasty
low-level stuff into some intermediate-level components. They support
both short MIDI messages (e.g. note on/off, program change) and long
MIDI messages (e.g. system exclusive, sample dumps).
The components work under Delphi 3. If you need to use Delphi 1 or 2
you should get the previous version 2.0b. They've been tested in Windows
95 and NT 4.
To install the components, install the package MIDICOMP.DPL.
This should give you MIDI input and output components on the Samples tab.
There's no formal documentation, but there are lists of properties,
methods, and events in the headers of MIDIIN.PAS and MIDIOUT.PAS.
There's also a couple of example projects: MIDIMON.DPR is a simple
monitor that demonstrates using components created at design time, and
MULTIMON.DPR demonstrates using multiple input and output components
created at runtime.
These components are in the public domain so feel free to produce
any type of program based on them.
If you need to know more about MIDI see the links at the bottom of
my MIDI page http://go.to/davesmidi.
Changes for Delphi 3:
---------------------
1. The requirement for a separate DLL for the MIDI callback procedure has
been removed. The callback is now in a fixed segment of the main
EXE.
2. Minor tweaks to compile without warnings under Delphi 3.
I haven't really been developing these components very much as the
project I wrote them for never came about, so there are no changes
to functionality at all.
Frequently Asked Questions
--------------------------
I've had a lot of email about these components. Thanks to everyone
who sent kind words, code, and bug reports.
Q: How do you load MIDI files and play them using these components?
A: These components don't do that, and the operating system only
provides support for playing MIDI files from disk. You need to
write your own code to load MIDI files. There are lots of C++
examples around on the net, so get cracking!
-------------
Q: I don't want to do anything fancy, I just want to output some MIDI notes,
how do I do that?
A: These components were mainly built for doing System Exclusive input and
output so if you don't want to use sysex, you don't really need these
components to do that, although they make managing the device handles
slightly easier.
To output notes without the MidiOut component:
----------------------------------------------
1. Open the device using an integer device ID to specify which
device. In the example below devID is an integer from 0 to the no. of
MIDI devices installed-1. You can get the number of installed devices
from midiOutGetNumDevs and the names of the devices using
midiOutGetDevCaps.
You can also use MIDI_MAPPER for the device ID, which directs output to
the MIDI device configured in the Control Panel MIDI applet.
var
devHandle: HMIDIIN;
midiRes: MMRESULT;
begin
{ Callbacks not necessary for output }
devHandle := midiOutOpen( @devHandle, devID, 0, 0, CALLBACK_NULL );
2. Build up a 32-bit MIDI message value using the MIDI codes defined
in the MIDI spec (see above for reference).
For example:
theMsg := DWORD(MidiMessage) Or
(DWORD(MidiData1) shl 8) Or
(DWORD(MidiData2) shl 16);
3. Output the message using midiOutShortMsg with the handle from
midiOutOpen.
midiRes := midiOutShortMsg( devHandle, theMsg );
4. Call midiOutClose() when you've finished.
To output notes using the MidiOutput component:
-----------------------------------------------
1. Drop the component on a form.
2. Set the component's DeviceID or DeviceName properties to set
the output device, either manually or with code.
Use the MidiMapper ID (-1) to output to the Windows MIDI Mapper.
3. Call MidiOutput.Open.
4. Call Midioutput.PutShort(MidiMessage, Data1, Data2).
5. Call MidiOutput.Close when you've finished.
-------------
Q: How do I construct and send system exclusive (Sysex) data?
A: It's easiest to work with the data in strings. You can build
literal strings like this:
sMidi := #$F0#$47#00#$28#$48#00#00#00#$0F#01#00#$0F#03#$F7;
Use Chr() to add variables to the sequence, e.g.
sSysex := #$f0 + Chr(channel) + Chr(address) + ... + #$f7;
A common mistake people make is to try to send ASCII hex data like this:
sMidi := 'F001000313F7'; { Wrong! }
There are two ways of getting a pointer to the string to pass to
TMidiOutput.Putlong:
i) In Delphi 2+, cast the string to a pointer, e.g.
MidiOutput1.PutLong(Pointer(sMidi), Length(sMidi));
ii) In Delphi 1, use @sMidi[1] to skip past the length byte at the
start of the string, e.g.
MidiOutput1.PutLong(@sMidi[1], Length(sMidi));
Do not use any of the zero-terminated string functions Str*() on sysex data
as sysex sequences often contain zeros and will be truncated. The exception
is the StrMove() function which doesn't stop for binary zeros.
-------------
Q: How do I receive MIDI timing data?
A: This is filtered out by default in the callback function in DELPHMCB.PAS.
Enable it by removing the check for MIDI_TIMINGCLOCK in the midiHandler function.
Contacting me
-------------
Contact me by email at dchurcher@cix.co.uk, but please remember that you
got the components for free and I don't get paid for support.
Updated versions of this component may appear on my MIDI software web
page:
http://go.to/davesmidi
Revision history
-----------
v3.0c
-----
Bug fix: TMidiIn would prevent Windows shutdown by not responding
to WM_QUERYENDSESSION message.
v3.0b
-----
Bug fix: With some MIDI drivers sysex data would be added on to the end
of input buffers after the first set of buffers was used up. Thanks to
Pete from Soundcraft for fixing this.
README.TXT updated with a more mobile web page.
v3.0
----
1. Upgraded to Delphi 3
2. Removed requirement for DLL.
v2.0b
-----
1. Added 16-bit DCR files in 16bitres.zip
2. Removed "uses midioutTimerHandler" from delphmid.dpr
v2.0
----
1. Fixed exception on load if the installed MIDI devices were different
from the development machine.
2. Now throws an "Invalid device ID" exception on Create if no MIDI
devices installed on machine.
3. Fixed GPF when SysexBufferCount = 0
David Churcher
June 1997