{****************************************** PAL Script to play liners between 2 tracks ******************************************} PAL.Loop := True; // Loop the PAL Script // Declare three TPlayer Containers var Player1 : TPlayer; // Declare an instance of TPlayer for the Active Player var Player2 : TPlayer = DeckB; // Declare an instance of TPlayer for the Idle Player var Player3 : TPlayer = Aux1; // Declare an instance of TPlayer for the Aux1 Player // Declare three TSongInfo Containers var P1Track, P2Track, P3Track : TSongInfo; // Variable Declarations var LinerLenStr : string; // Holds the Duration of the Liner Track as a string value var LinerLen : integer; // Holds the Duration of the Liner Track var Delay : string; // Holds the delay between the Liner starting and the follow up track starting var Position : string; // Used to determine the position of the Decimal Point in the Liner Duration // Declare Configurable Variables var NormalVol : integer = 255; // Set the normal volume level here var LoudVol : integer = 300; // Set the high volume level here var StartPoint : integer = 5000; // Set the start time x seconds from the end of the Active Track var TrackCount : integer = 5; // Set the number of tracks to play before repeating PAL.WaitForPlayCount(TrackCount); // Set the number of tracks to play before playing the Liner PAL.LockExecution; // Speed up the Script processing Player1 := ActivePlayer; // Assign the Active Player to Player1 If Player1 = DeckB Then Player2 := DeckA; // Assign the Idle Player to Player 2 // Wait for 'StartPoint' seconds before the end of the track before proceeding PAL.WaitForTime(Float(Now) + ((Player1.Duration - Player1.CurTime - StartPoint) / 86400000)); // Load the Liner P3Track := CAT['Station IDs (All)'].ChooseSong(smLRP,NoRules); // Load a Liner from the Station ID category to play between tracks Player3.QueueSong(P3Track); // Queue the Liner in the Aux1 Player LinerLen := Player3.Duration; // Assigns LinerLen the duration of the Liner track LinerLen := (((LinerLen / 1000) + 1) / 2); // Calculate the pause between starting the follow up track as half the duration of the Liner plus 1 - Adjust to suite needs LinerLenStr := FloatToStr(LinerLen);// Convert the Liner Duration to a String Position := CharAt(LinerLenStr, 2); if Position = '.' then // Checks the position of the Decimal Point begin LinerLenStr :='0'+LinerLenStr; // Adds a leading zero if necessary end; Delay := '+00:00:'+LinerLenStr; // Concatenates the track delay time Delete(Delay,10,5); // Removes the decimal point and fractional part P2Track := Queue.NextInQueue; // Queue the next track in the Idle Player if P2Track = nil then // Loads 3 tracks to an empty queue if necessary begin cat['tracks'].QueueTop(smLRP,EnforceRules); cat['tracks'].QueueBottom(smLRP,EnforceRules); cat['tracks'].QueueBottom(smLRP,EnforceRules); P2Track := Queue.NextInQueue; end; Player2.QueueSong(P2Track); // Queue the next track in the Idle Player Player1.FadeToPause; // Fade out the currently playing track Player3.Volume := LoudVol; // Set the AUX1 volume to the Loud setting Player3.Play; // Play the Liner PAL.WaitForTime(Delay); // Wait for the Delay Player2.FadeToPlay; // Fade in the idle player P1Track := Queue.NextInQueue; // Assign the next track to Player1 Player1.QueueSong(P1Track); // Queue the next track in Player1 Player1.Volume := NormalVol; // Ensure the Player Volume is set PAL.UnLockExecution; // Return PAL Script processing to normal speed // Housekeeping Player1.Free; Player2.Free; Player3.Free; P1Track.Free; P2Track.Free; P3Track.Free;