Skip to Content
It is currently July 14th, 2020, 11:04 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: January 2nd, 2020, 6:17 am 
Offline
New User
New User

Joined: January 2nd, 2020, 5:59 am
Posts: 3
Hi everyone! I am new to this, but I am happy to be part of this community :)

Beneath the code you'll find my issue...

Code:
{Script3: Insert Y every X tracks   }
{This script properly skips counting advertisements in wait. Below the x = 4 and the Y = CREATE A CATEGORY TO PULL FROM }
const WaitCount = 3;
PAL.Loop := True;

var CurCount : Integer = 0;
var Song     : TSongInfo;

while CurCount < WaitCount do
begin
  PAL.WaitForPlayCount(3);
  if (ActivePlayer<> nil) then
  begin
    Song := ActivePlayer.GetSongInfo();
    if Song['songtype'] = 'S' then
     begin
      CurCount := CurCount + 1;
      WriteStr('Normal song detected. Waiting... ');
      WriteLn('('+IntToStr(CurCount)+'/'+IntToStr(WaitCount)+')');
     end
     else
       WriteLn('SongType skipped: '+Song['songtype']);
    Song.Free;
  end
 else WriteLn('Warning: Active player not detected!?');
end;

WriteLn('Inserting Y');
Cat['Jingle'].QueueTop(smLRP, noRules);


This is my PAL script to make sure that there are jingles. Now I've tested this and found that after 3 songs the script goes into Normal song detected. Waiting.

I'd like to think that that happens because I've set the crossfader settings to dB detection (-5dB). Could anyone confirm and if not please let me know what I'm doing wrong ?

gr Jeffrey


Top
 Profile  
Reply with quote  
PostPosted: January 3rd, 2020, 11:20 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8031
Location: Aachen (Germany)
From your description/comments it seems like your script has one definite flaw and one where I'm not 100% sure about the behavior of PAL.Loop:
#1 You always skip 3 tracks for every inner loop, but only increase the counter by one if the track found at that time is type S. The most obvious problem is that it takes at least 9 tracks before your jingle is inserted. But it could also take longer if any of the third tracks is not type S. (i.e.: a combination like SSX,SSJ,SSA would not play 2 jingles [6 type-S tracks], but none because the only tracks checked for their songtype are the ones with type X, J and A. It would take at least 9 more tracks being played before the first jingle would be inserted)


#2 I'm not sure if PAL.Loop will actually reset the VAR initializers. If not, your script will only work once under the conditions outlined above and insert an infinite amount of jingles thereafter (one every 2-3 seconds, depending on how fast the PAL script can progress through the lines).
To be safe, I'd reset the CurCount variable to 0 atfer inserting the Jingle.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: January 5th, 2020, 12:12 pm 
Offline
New User
New User

Joined: January 2nd, 2020, 5:59 am
Posts: 3
Thanks for your reply!, I've deleted the 2 pal scripts that were also in the pal script window. Lets see where this takes us.

gr Jeffrey


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group