Control I/O Warrior Outputs?

Hi Guys.

Is it possible to control the outputs on a I/O Warrior from mAirList, either through the config or with a script?

I’ve got a custom built START/STOP unit connected to mAirList, and the buttons have Multi Colour LEDs in them.
My plan is to have the LEDs in the buttons to change colour / flash depending on the status of the players they relate to.

So for example, have the LED green when a track is loaded in the player, change to red when the track is playing, and then start flashing when the EOF countdown starts.

Does this sound like something that can be done?

Thanks in Advance!

Joe T.

Very simple script to set a port “on”, useful for testing the syntax:

begin
  IOWarriorRemote(0).SetPort(32, true);
end.

For automatic update according to the player state, you have to write a notification script like this:

// Called when (playlist) player changes its state
procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer; OldState: TPlayerState; NewState: TPlayerState);
begin
  if (PlayerIndex = 0) and (NewState = psPlaying) then // Player 1 is now "playing"
    IOWarriorRemote(0).SetPort(31, true);
  if (PlayerIndex = 0) and (NewState = psStopped) then // Player 1 is now "stopped"
    IOWarriorRemote(0).SetPort(32, true);
  // etc.
end;

begin
end.

Thanks for your reply Torben!

That looks like it will do the trick! One quick question though, Is there a way to tell if a player has a track loaded or not, and also if the EOF timer for that player has started? I had a look in the English manual but couldn’t find a list of available commands for use in the scripts!

So I’ve been having a play with the script, and I can’t seem to get it to do what i’m after. I could be approaching this from the wrong angle so I thought I’d post here to see if anyone has any ideas.

[code]// Called when (playlist) player changes its state
procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer; OldState:

TPlayerState; NewState: TPlayerState);
begin
if (PlayerIndex = 0) and (NewState = psLoaded) then // Player 1 is now “loaded”
IOWarriorRemote(0).SetPort(4, true);
IOWarriorRemote(0).SetPort(22, false);
IOWarriorRemote(0).SetPort(2, false);
if (PlayerIndex = 0) and (NewState = psPlaying) then // Player 1 is now “playing”
IOWarriorRemote(0).SetPort(4, false);
IOWarriorRemote(0).SetPort(22, false);
IOWarriorRemote(0).SetPort(2, true);
if (PlayerIndex = 0) and (NewState = psStopped) then // Player 1 is now “stopped”
IOWarriorRemote(0).SetPort(4, false);
IOWarriorRemote(0).SetPort(22, false);
IOWarriorRemote(0).SetPort(2, false);
// etc.
end;

begin
end.[/code]

The Stopped and Loaded parts work fine, but the playing part doesn’t. The LED lights up for a split second and then goes out again.

The button has 3 LEDs in it, 4 is Amber, 22 is Blue and 2 is Red.

You have to wrap the SetPort blocks into “begin…end” statements. If you don’t, only the first SetPort command in the block is linked to the if-condition, and the other commands are always executed.

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

TPlayerState; NewState: TPlayerState);
begin
  if (PlayerIndex = 0) and (NewState = psLoaded) then begin // Player 1 is now "loaded"
    IOWarriorRemote(0).SetPort(4, true);
    IOWarriorRemote(0).SetPort(22, false);
    IOWarriorRemote(0).SetPort(2, false);
  end;
  if (PlayerIndex = 0) and (NewState = psPlaying) then begin // Player 1 is now "playing"
    IOWarriorRemote(0).SetPort(4, false);
    IOWarriorRemote(0).SetPort(22, false);
    IOWarriorRemote(0).SetPort(2, true);
  end;
  if (PlayerIndex = 0) and (NewState = psStopped) then begin // Player 1 is now "stopped"
    IOWarriorRemote(0).SetPort(4, false);
    IOWarriorRemote(0).SetPort(22, false);
    IOWarriorRemote(0).SetPort(2, false);
  end;
  // etc.
end;

begin
end.

Pascal is not Python :wink:

Ahh that makes sense now! My bad.

Thanks Torben! :slight_smile: