Airence player script

Is this possible with a script?
I want my players A/B the state of the player in the start button.
So player a of b playing red.
Next start player green.
And second start player yellow.
If the answer is yes that’s possible please a little help because if never built a script.

I assume that its not possible?

To my knowledge, only the LEDs of the cart buttons can be controlled remotely, not the start/stop buttons of the channels.

This is a limitation of the Airence protocol (airence.dll), not mAirList.

The wiki says

  • 28: ON button, USB 1

  • 29: CUE button, USB 1

  • 30: Fader start, USB 2

  • 31: ON button, USB 2

  • 32: CUE button, USB 2

  • 33: Fader start, USB 3

  • 34: ON button, USB 3

  • 35: CUE button, USB 3

  • 36: Fader start, USB 4

  • 37: ON button, USB 4

  • 38: CUE button, USB 4

I thought with buttons 28 31 34 37 you could use them in a script.
The numbers are from the airence wiki.

Yes, this is for remote control commands (see “Switches”).

In Section “Scripting” you will find this:

The available button IDs are:

  • “A” buttons: 0 (Button 1A) to 7 (Button 8A)

  • “B” buttons: 8 (Button 1B) to 15 (Button 8B)

  • Buttons in the lower part: 16 to 23

  • 255 (hex $FF): All buttons at the same time

Then just give it a try and do

AirenceRemote(0).SetLED(28, acRed);

But I think it will not work. The numbers are used when the Airence reports press/release of the buttons to the computer. But you cannot use them to control the LEDs. Only for the cart buttons.

But as I don’t own an Airence, I cannot test it, so I might be mistaken. Just try it.

3 Likes

Tried it and you where Wright it didn’t change color.

Second attempt
Below the cartwall are control buttons and the have the 3 colors.

In the playlist you have playing and next thats wat I would like to make in a script on button 17 (player a) and 18 (player b)
If possible also a start player with the buttons but if that gives problems with the buttons above the faders from the players then only status trough button light.
But where do I start.
I lookt in the scrpt wiki but the logic makes no sense to me.
What I would like to make.

The player thats next playing in playlist is green.
Playing player is red an turns orange when played. As soon when it comes in next state green.

After 4 days of searching on this forum I got the most states working.
except the Next state I found a post where Torben explains that psNext is a virtual state but how I distinguish the next player.

if Playlist(0).PlayerGet(0).GetIsNext then ...

And how do I make a difference between player A / B

Player A = AirenceRemote(0).SetLEDBlink(17, acGreen );

Player B =AirenceRemote(0).SetLEDBlink(18, acGreen );

This is what I got so far

procedure OnLoad;                                            
begin
  AirenceRemote(0).SetLED(17, acNone);
  AirenceRemote(0).SetLED(18, acNone);

end;

procedure OnUnload;                                           
begin
  AirenceRemote(0).SetLED(17, acNone);
  AirenceRemote(0).SetLED(18, acNone);

end;



// Called when (playlist) player is started
procedure OnPlayerStart(PlaylistIndex: integer; PlayerIndex: integer; Item: IPlaylistItem);
begin
if (PlaylistIndex= 0) and (PlayerIndex= 0) then begin
AirenceRemote(0).SetLED(17, acRed);
end;
if (PlaylistIndex= 0) and (PlayerIndex= 1) then begin
AirenceRemote(0).SetLED(18, acRed);
end;
end;



// Called when (playlist) player is stopped
procedure OnPlayerStop(PlaylistIndex: integer; PlayerIndex: integer; Duration: TTimeValue; Item: IPlaylistItem);
begin
if (PlaylistIndex= 0) and (PlayerIndex= 0) then begin
AirenceRemote(0).SetLEDBlink(17, acGreen, acYellow, absFast); 
end;
if (PlaylistIndex= 0) and (PlayerIndex= 1) then begin
AirenceRemote(0).SetLEDBlink(18, acGreen, acYellow, absFast); 
end;
end;   



// Called when (playlist) player changes its state
procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer; OldState: TPlayerState; NewState: TPlayerState; Item: IPlaylistItem);

begin 
if (PlayerIndex = 0) and (NewState = psPaused) then begin
AirenceRemote(0).SetLEDBlink(17, acRed, acYellow, absFast);
end;
if (PlayerIndex = 1) and (NewState = psPaused) then begin 
AirenceRemote(0).SetLEDBlink(18, acRed, acYellow, absFast);
end;
if (PlayerIndex = 0) and (NewState = psLoaded) then begin
AirenceRemote(0).SetLED(17, acGreen );
end;
if (PlayerIndex = 1) and (NewState = psLoaded) then begin
AirenceRemote(0).SetLED(18, acGreen );
end;

end;

Where and how do I place the code from Torbem for next state?

Have a go at this one;

function abs(r: integer): integer;
begin
  if r < 0 then
    Result := r * -1
  else
    Result := r;
end;

procedure CheckPlayer;
var
  i, k: integer;
begin
  for i := 0 to 1 do
  begin
    k := abs(i - 1);
    if CurrentPlaylist.GetPlayer(i).GetIsNext then
    begin
      AirenceRemote(0).SetLED(17 + i, acGreen);
      if CurrentPlaybackControl.GetPlayer(k).GetState  <> psPlaying then
        AirenceRemote(0).SetLED(17 + k, acYellow)
      else
        AirenceRemote(0).SetLED(17 + k, acRed);
    end;
  end;
end;

procedure OnLoad;
var
  i: integer;
begin
  for i := 0 to 1 do
    AirenceRemote(0).SetLED(17 + i, acNone);
  CheckPlayer;
end;

procedure OnLoad;
var
  i: integer;
begin
  for i := 0 to 1 do
    AirenceRemote(0).SetLED(17 + i, acNone);
end;

procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer; 
  OldState: TPlayerState; NewState: TPlayerState; Item: IPlaylistItem);
begin
  CheckPlayer;
  if NewState = psPlaying then
    AirenceRemote(0).SetLED(17 + PlayerIndex, acRed)
  else if NewState = psEmpty then
    AirenceRemote(0).SetLED(17 + PlayerIndex, acNone);  
end;


begin
end.

(Untested so far as no Airence available.)

1 Like

Thanks :grinning: will test it this evening and give you feedback .

1 Like

Forgot about the blinking pause state. Replace procedure OnPlayerStateChange by this:

procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer; 
  OldState: TPlayerState; NewState: TPlayerState; Item: IPlaylistItem);
begin
  CheckPlayer;
  case NewState of
    psPlaying: AirenceRemote(0).SetLED(17 + PlayerIndex, acRed);
    psPaused:  AirenceRemote(0).SetLEDBlink(17 + PlayerIndex, acRed, acYellow, absFast);
    psEmpty:   AirenceRemote(0).SetLED(17 + PlayerIndex, acNone);  
  end;
end;

 

For the remote start functionality put the repective command into the Switches setup:

20160831-162035

(Equally untested.)

1 Like

Yes!!!

It works , ok not instantly there was 2 times procedure OnLoad; I removed the second one and it started.
So many thanks

1 Like

Leave the second one in and rename it procedure OnUnload. Sorry.

For not having a Airence and come up with tis script and make a tiny mistake off 2 letters there is absolutely no need to say sorry :pray:

1 Like

one small thing I have 3 cartplayers


The come at button 19 20 and 21 The cart players have 1 player and 1 playlist when I add them and when the are in playing state also button 17 (player A main playlist light up)
I try the hole afternoon to make it work , my guess is divine playlist 0 tm 4 but no luck on this site.

So how do I make psPlaying only on playlist0 (main playlist)

Replace CurrentPlaylist by Playlist(0) and – and this is a guess – CurrentPlaybackControl by PlaybackControl(0).

1 Like