Follow

PAL Script - Hourly Time Signal (The Pips) with a Following News Track

This script was written to play the hourly time signal (the pips) at the top of the hour, followed immediately by a news track.

To utilize this script simply download the time signal track at the bottom of this document, add it to SAM Broadcaster in its own 'TimeSignal' playlist or category, ensure your News Tracks are categorized correctly as News (All) and run the script. The PAL Script is also available to download from the bottom of this page.

For instructional purposes, this script includes comments describing the various sections.

// PAL Script to play the BBC Time Signal (pips) at 5 seconds to the hour through AUX1
// and queue up a news track to follow the pips
// You must ensure the Time Signal track is located in a playlist entitled TimeSignal
// and ensure your news track is categorized correctly under News (All)
// This script is provided as-is

PAL.loop := true; // Loop the script to ensure the time signal is played at every hour

var Player1 : TPlayer = DeckA; // Declare an instance of TPlayer and assign it DeckA
var Player2 : TPlayer = Aux1; // Declare an instance of TPlayer and assign it Aux1
var ActiveVol, AuxVol : integer; // Declare containers for the current volume levels
var TimeSignal : TSongInfo; // Create a container for the time signal track
var NewsTrack : TSongInfo; // Create a container for the news track

if DeckA.Status <> psPlaying then
Player1 := DeckB;

TimeSignal := Cat['TimeSignal'].ChooseSong(smLRP, noRules); // Assign the time signal to the TimeSignal container
NewsTrack := Cat['News (All)'].ChooseSong(smLRP, noRules); // Assign the News Track to the NewsTrack container

ActiveVol := ActivePlayer.Volume; // Record the current Active Player Volume
AuxVol := Player2.GetVolume; // Record the current Active Player Volume

PAL.WaitForTime('XX:59:55'); // wait for 5 seconds before the hour

PAL.LockExecution; // Speed up the Script processing

if TimeSignal <> nil then begin // Check to ensure the time signal track is ready
Player2.QueueSong(TimeSignal);

Player1.Eject; // Eject the current track
Player2.Volume := 300; // Raise the volume of the Aux Player (with extra gain)
Player2.play;
Player1.QueueSong(NewsTrack); // Queue the News Track in the idle player
PAL.WaitForTime('+00:00:06'); // Wait for 5 seconds to pass before playing the news track

end;

Player2.Volume := AuxVol; // Restore the Player Volume to the previous level
Player1.Play; // Play the News Track

PAL.UnlockExecution; // Return PAL Script processing to normal speed
TimeSignal.Free; // Release the memory
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments