Cart play/stop - midi output V5.1 script

What is the right way to send a midi signal when your cart’s are playing?
I tried the OnCartPlayer1 but nothing happens.

So is the procedure changed in v5.1?

It is tend to turn leds on/off on my midicontroller per cart (i use 8 of them)

Regards,

ferry

Use this procedure here:

// Called when the state of a player on the current cartwall page changes
// (or the user switches to another page).
procedure OnCartwallPlayerStateChange(PlayerIndex: integer;
  OldState: TPlayerState; NewState: TPlayerState;
  Item: IAudioCartwallItem; PlaylistItem: IPlaylistItem;
  OnAirMode: TCartwallOnAirMode);
begin
end;

“NewState” will be one of the following:

    psEmpty
    psLoading
    psLoaded
    psPlaying
    psFading
    psEOF
    psError
    psPaused
    psStopped

So you can check NewState in PlayerIndex, and then send the appropriate MIDI command. Example:

if (PlayerIndex = 1) then begin
  if NewState = psLoading then
    MidiOut(...)
  else if NewState = psLoaded then 
    MidiOut(...)
  else // etc.
end
else if (PlayerIndex = 2) then begin
  // same as above
end;

Note that this always refers to the curren tab. So if you have multiple tabs opened in the cartwall, and switch between then, you will see many OnCartwallPlayerStateChange calls, with the states of the new active tab.

Thanks!

I am Going to play with this.

Hello,
I’ve already tryed this but it’s not working…

I got this information: [Error] (94:4): Identifier expected

[code]//On Air Light

procedure OnOnAir;
begin
IOWarriorRemote(0).SetPort(31, true);
end;

procedure OnOffAir;
begin
IOWarriorRemote(0).SetPort(31, false);
end;

//EOF Warning Light

procedure OnPlayerStop(PlaylistIndex: integer; PlayerIndex: integer; Duration: TTimeValue; Item: IPlaylistItem);
begin
IOWarriorRemote(0).SetPort(30, false);
end;

procedure OnPlayerEOFWarning(PlaylistIndex: integer; PlayerIndex: integer);
begin
IOWarriorRemote(0).SetPort(30, true);
end;

//MIC On Light - Audio Switch

procedure OnLoad;
begin
MidiOutOpen(1);
end;

procedure OnUnload;
begin
MidiOutClose(1);
end;

procedure OnMidiMessage(Device: integer; Status, Data1, Data2: byte);
begin
if (Status = $B0) and (Data1 = $07) and (Data2 >= $01) then
IOWarriorRemote(0).SetPort(26, true);

if (Status = $B0) and (Data1 = $07) and (Data2 = $00) then
IOWarriorRemote(0).SetPort(26, false);

if (Status = $B0) and (Data1 = $07) and (Data2 >= $01) then
IOWarriorRemote(0).SetPort(25, true);

if (Status = $B0) and (Data1 = $07) and (Data2 = $00) then
IOWarriorRemote(0).SetPort(25, false);

end;

//Automation Light - Asist Light

procedure OnAutomationOn(PlaylistIndex: integer);
begin
IOWarriorRemote(0).SetPort(29, true);
IOWarriorRemote(0).SetPort(28, false);
end;

procedure OnAutomationOff(PlaylistIndex: integer);
begin
IOWarriorRemote(0).SetPort(29, false);
IOWarriorRemote(0).SetPort(28, true);
end;

//Cart Player On Light

// Called when the state of a player on the current cartwall page changes
// (or the user switches to another page).
procedure OnCartwallPlayerStateChange(PlayerIndex: integer;
OldState: TPlayerState; NewState: TPlayerState;
Item: IAudioCartwallItem; PlaylistItem: IPlaylistItem;
OnAirMode: TCartwallOnAirMode);
begin
if (PlayerIndex = 1) then begin
if NewState = psPlaying then
IOWarriorRemote(0).SetPort(19, true);
else if NewState = psStopped then
IOWarriorRemote(0).SetPort(19, false);
end;

begin
end.[/code]

94 is the last
begin
end.

It would be nice if anyone try’s to help me.

Thanks :wink:

Try to remove the semicolon after “IOWarriorRemote(0).SetPort(19, true)”. There must be no semicolon before “else”.

Thanks,
i tryed but it seems to be not the Problem:

[Error] (14:4): Identifier expected

[code]procedure OnCartwallPlayerStateChange(PlayerIndex: integer;
OldState: TPlayerState; NewState: TPlayerState;
Item: IAudioCartwallItem; PlaylistItem: IPlaylistItem;
OnAirMode: TCartwallOnAirMode);
begin
if (PlayerIndex = 1) then begin
if NewState = psPlaying then
IOWarriorRemote(0).SetPort(19, true)
else if NewState = psStopped then
IOWarriorRemote(0).SetPort(19, false)
end;

begin
end.[/code]

do you have any other ideas?

There is another “end;” missing, the one that matches “if (PlayerIndex = 1) then begin”.

Indent all lines properly, then it should be clear.