Simple Script for newbie

Hello everyone!

I’m totally ignoring how to use script, but I’m curious about it and maybe could someone help me to understand how it works ;D

I found on the forum a basic script from Torben to start with :

[code]procedure OnLoad;
begin
// MidiOutListDevices;
MidiOutOpen(01);
end;

procedure OnMidiMessage(Device: integer; Status, Data1, Data2: byte);
begin
if (Status = $01) and (Data1 = $01) and (Data2 > $01) then
MidiOut(01, $01, $02, $05);
end;

begin
end.[/code]

It has been modified to fit my values, and the script is loaded as background script.

Device1= my focusrite audio/midi soundcard
Device2= USB controller (Midi faders)

Device 2 is correctly set up in the midi commands of mAirlist and works perfectly with it :slight_smile: (fader start / stop…)

But when I open Midi-Ox to monitor Midi messages received by device 1 from mAirlist… guess what…nothing happens!
(I guess I’m missing something obvious but I can’t find it right now! :-[

Trying with another script found on the forum:

[code]procedure OnLoad;
begin
MidiOutOpen(1);
end;

procedure OnPlayerStart(PlaylistIndex: integer; PlayerIndex: integer; Item: IPlaylistItem);
begin
if PlayerIndex = 0 then
MidiOut ( 01, 144, 74, 127 ) ;
end;

procedure OnPlayerStop(PlaylistIndex: integer; PlayerIndex: integer; Duration: TTimeValue; Item: IPlaylistItem);
begin
if PlayerIndex = 0 then
MidiOut ( 01, 144, 74, 00 ) ;
end;

begin
end.[/code]

but does not work either
By the way what does the “if Player Index=0” mean?

Thanks you guys for your help!

Alex