Question

I am working with application in delphi. I need to use MIDIYOKE to send output from my application to another application. The second application is Virtual piano keyboard.

enter image description here

I installed all the packages and got MIDI components in the delphi.

I tried using MidiOutputPort1 and MidiInput1 components. I tried playing one MIDI.The code is as follows:

procedure TForm3.Button1Click(Sender: TObject);
var
outputPort : TMidiOutputPort;
begin
 outputPort := TMidiOutputPort.Create (Nil);
   try
    outputPort.PortId := -1;
    outputPort.Active := True;
    outputPort.PatchChange(0, 127, 0); // Gunshot
    outputPort.NoteOn (1, 20, 127);    // Play note at full volume


    Sleep (1000);
    outputPort.NoteOff (0, 60, 0);
finally
outputPort.Free
end
end;

I wanted to estalish connection between my application and Virtual piano keyboard.How to use MidiOutputPort1 and MidiInput1 for the connection between the two.

Was it helpful?

Solution

If both applications support MIDI sync you can use MIDI syncing. In that case MIDIYOKE is the master and Vpk is the slave. Syncing is handled by the following commands:

mc_MIDI_Timing_Clock           = $F8;
mc_MIDI_Start                  = $FA;
mc_MIDI_Continue               = $FB;
mc_MIDI_Stop                   = $FC;

I used it in the far past, so my knowledge is a bit rusty. What I can gather from my code is that it works as follows: Set the slave in the slave/sync receive/whatever it's called mode. Next send $FA to the channel of your choice. Some (not all) slaves require you to listen to specific channels.

At each clock tick send $F8 first. Next send the messages, preceded by the $FB message (both data bytes zero). When you're ready send $FC.

OTHER TIPS

I think you should put the port number of one of your yoke ports in the portid property.

To know which id to use, you'll have to enumerate the available ports, because the id's can change if you add hardware, or if you change your midi yoke configuration.

Therefore, to remember which ports were chosen by the user, you need to store the device name, and hope that the user doesn't rename its devices :)

Let me know if this helps you enough to be able to continue your work; otherwise i'll dig up some old code that does what you're attempting to do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top