Delphi-PRAXiS
Seite 5 von 8   « Erste     345 67     Letzte »    

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Software-Projekte der Mitglieder (https://www.delphipraxis.net/26-software-projekte-der-mitglieder/)
-   -   MIDI Klavier (https://www.delphipraxis.net/48669-midi-klavier.html)

virtualtom 8. Mär 2006 20:44

Re: MIDI Klavier
 
Zitat:

Zitat von dersaartan
(...)
So, jetzt mal zu meinem Problem: ich arbeite mit Delphi 7 und habe die Midikomponente installiert, Midi In und Out werden auch angezeigt. Nur wenn ich die Klavier Projektdatei kompilieren will sagt der Compiler mir folgendes:

Hier das selbe mit D7 unter XP SR2. Aussedem kommt hier ein Fehler-Fensterchen, wenn ich die MIDI-IN(!)-Komponente auf ein Form ziehen will: Invalid Device ID. Hat jemand eine Idee dazu? Ich würde nämlich gerne SysEx-Daten zu meinem Synth schicken und welche aus diesem empfangen können...

TIA!

FAlter 12. Mär 2006 17:09

Re: MIDI Klavier
 
Hi,

Ich habe es nochmal rausgekramt und folgende ReadMe gefunden:

Zitat:

Delphi MIDI I/O Components Version 3.0 9 June 1997
-------------------------- ---------------------------

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://www.davec.op.nu


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. Here are answers to the
questions that cropped up most often:

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&3, 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://www.davec.op.nu



Revision history
-----------

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
Könnte eventuell helfen, notfalls nehmt Kontakt mit ursprünglichem Autor auf.

Mfg
FAlter

virtualtom 12. Mär 2006 18:22

Re: MIDI Klavier
 
Zitat:

Zitat von virtualtom
Zitat:

Zitat von dersaartan
(...)
So, jetzt mal zu meinem Problem: ich arbeite mit Delphi 7 und habe die Midikomponente installiert, Midi In und Out werden auch angezeigt. Nur wenn ich die Klavier Projektdatei kompilieren will sagt der Compiler mir folgendes:

Hier das selbe mit D7 unter XP SR2. Aussedem kommt hier ein Fehler-Fensterchen, wenn ich die MIDI-IN(!)-Komponente auf ein Form ziehen will: Invalid Device ID. Hat jemand eine Idee dazu? Ich würde nämlich gerne SysEx-Daten zu meinem Synth schicken und welche aus diesem empfangen können...

TIA!

Das mit dem MIDI-IN hat sich erledigt. Wenn man keinen Input hat, aknn das auch nicht gehen. :oops: Der Einbau einer Soundkarte mit Gameport/MIDI bringt schlagartig Besserung.

Zum Compilerfehler fällt mir allerdings (noch) nix ein...

FAlter 14. Mär 2006 13:30

Re: MIDI Klavier
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hi,

dazu hatte ich mich aber bereits geäußert. Habe kein D7, um es nachzuprüfen, außerdem wurde das Kla4 für/mit D3 geschrieben.

Der Inline-Assembler von D7 scheint Delphi-Referenz durchsuchenbswap nicht zu kennen (Assembleranweisung zum Vertauschen der Bytereihenfolge). Das müsste man sonst eben per Hand lösen.

Mfg
FAlter

MarcoWarm 14. Mär 2006 14:37

Re: MIDI Klavier
 
Vorschlag für das Demoprogramm:

bitte nur auf die Tasten reagieren, wenn das Fenster den Fokus hat.
ich hätte gern eine zweimanualige Version, mit getrennten Instrumenten für oberes (Q-*) und unteres (<-_) Manual. Für alle, die zweihändig spielen. Die Werke von Bach etc. muss man ja auch spielen können.:dancer:

FAlter 3. Okt 2006 10:56

Re: MIDI Klavier
 
Hi,

ich habe mein Delphi 3 deinstalliert, weil ich Speicherplatz brauchte, und ein paar alte Projekte wieder rausgekramt, um sie mit D6 oder D2005 zu verwenden. Dabei habe ich auch das MIDI-Klavier gefunden.

Zitat:

Zitat von MarcoWarm
bitte nur auf die Tasten reagieren, wenn das Fenster den Fokus hat.

Das wäre zu einfach. Außerdem ist es ja lustig, wie ein Text, den man eintippt, klingt (find ich). (Prüf einfach im OnIdle, ob dein Fenster den Fokus hat, Source liegt ja bei.) Lass dich aber nicht erwischen, du hast keine Unterschrift unter diesem Text hier...

Zitat:

ich hätte gern eine zweimanualige Version, mit getrennten Instrumenten für oberes (Q-*) und unteres (<-_) Manual. Für alle, die zweihändig spielen. Die Werke von Bach etc. muss man ja auch spielen können.:dancer:
Meist du so wie auf dem Bild auf meiner HP unter http://faltersoft.fa.funpic.de/soft/...ftware=klavier ??

Da gibt es nur ein Problem: Wenn du mehrere Tasten drückst, naja, probiers selbst, außerdem bedrängen sich beide Hände gegenseitig.

Mfg
FAlter

inherited 3. Okt 2006 11:46

Re: MIDI Klavier
 
Nunja, richtig spielbar ist es leider nicht(zumindest nicht mit links/mit akkorden) aber ganz nett für fingersatzübungen^^
Und die verzögerungen sind doch recht gross...

HariboHunter 16. Okt 2006 08:47

Re: MIDI Klavier
 
Liste der Anhänge anzeigen (Anzahl: 1)
Eh! Warum ist die erweiterung .mid verboten?
Ich wollte gerade meine Kunst posten.
Ich bin total talentfrei :stupid: .

naja ist ne .mid datei .. hab die endung auf .jpg geändert.

inherited 16. Okt 2006 13:05

Re: MIDI Klavier
 
Liste der Anhänge anzeigen (Anzahl: 1)
Da muss ich doch glatt gegen halten :mrgreen:
(Für Elise)

HariboHunter 17. Okt 2006 06:49

Re: MIDI Klavier
 
Wahnsinn, da haben wir ja einen echten Künstler unter uns.
:thumb: gut gemacht. :dance:

könnte zum Trend werden :stupid:


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:45 Uhr.
Seite 5 von 8   « Erste     345 67     Letzte »    

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz