Note that this Wiki is a work in progress, items may not be updated or may disappear entirely as the pages are updated.

How do I use PAL to play songs at a certain time?

From SpacialAudio

Jump to: navigation, search

This is an example script for people that run pre-recorded shows (such as The Canvas Prog Hour, or Heavycore). This example loads the top of the queue at 7:58pm on Wednesday.

PAL.Loop := True;
var mytime : DateTime = now;
var I : Integer;
var start_time, end_time : DateTime;
start_time := date + EncodeTime(19,58,00,0);
end_time := date + EncodeTime(19,58,30,0);
if DayOfWeek(Now) = Wednessday then
begin
      if( mytime >= start_time) and (mytime <= end_time) Then
            begin
                WriteLn('Canvas Prog Hour!');
       Queue.AddFile('E:\canvas\cphpart4.mp3',ipTop);
       cat['Station IDs (All)'].QueueTop(smRandom,NoRules);
       Queue.AddFile('E:\canvas\cphpart3.mp3',ipTop);
       cat['Station IDs (All)'].QueueTop(smRandom,NoRules);
       Queue.AddFile('E:\canvas\cphpart2.mp3',ipTop);
       cat['Station IDs (All)'].QueueTop(smRandom,NoRules);
       Queue.AddFile('E:\canvas\cphpart1.mp3',ipTop);
       cat['Station IDs (All)'].QueueTop(smRandom,NoRules);
       PAL.WaitForTime(T['+00:01:00']);
            end;
end;


Note that you can also use this:

start_time := T['19:58:00'];

Instead of this:

start_time := date + EncodeTime(19,58,00,0);
Personal tools