Skip to Content
It is currently July 16th, 2019, 11:25 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: To PAL experts...
PostPosted: June 6th, 2019, 10:36 am 
Offline
Senior User
Senior User

Joined: May 19th, 2009, 1:58 am
Posts: 121
Location: New York City
I have two scripts:

1 Supposed to delete to jingles in a row.... and for some reason it deletes jingles that are not in a row, but simply next to be played. Strange. Here is the script:

-----------------------------------------
Code:
//
// This script will look at the next song in the Queue
//   AND if current song is Liner (songtype = "j","J")
//       and If next song is also a Lineer of SONGTYPE of J or j
//    it will remove it from top of Queue
//
//  Version 1.01 - by CountryWesternDJ (http://www.lahotcountry.com) - February 2, 2012
//   Don't be a dick and remove the credit
//

//  Loop PAL script and wait for 1 song to play before executing.

var theSong, thisSong, thatSong : TSongInfo;

PAL.Loop := True;
PAL.WaitForPlayCount(1);

PAL.LockExecution;

thisSong := ActivePlayer.GetSongInfo;

if ( (thisSong['songtype'] = 'J') or (thisSong['songtype'] = 'j') )
   then
     begin
      theSong := Queue.NextInQueue;
      While ( (theSong['songtype'] = 'J') or (theSong['songtype'] = 'j') ) do     
       begin         
         theSong.Free;
         theSong := Queue.NextInQueue;     
       end;
       Queue.AddFile(theSong['filename'],ipTop);
       theSong.Free;
       If ((DeckA.status = psQueued) or (DeckB.status = psQueued)) then
        begin
         thatSong := QueuedPlayer.GetSongInfo;
         If ( (thatSong['songtype'] = 'J') or (thatSong['songtype'] = 'j') )
          then
            QueuedPlayer.Eject;
        thatSong.Free;
       end;
     end;
     
PAL.UnlockExecution;


--------------------------------------------------------------
--------------------------------------------------------------

2 This PS supposed to make 'I','P','J','A','N' louder over regular songs and files marked differently than indicated before. This script works (so it seems) then you see that something that was supposed to be louder WAS NOT or something that was not loud IS LOUD... Is there a mistake in the script or it is just SAM?

-------------------------------------------------------------

Code:
var Done : Boolean = False;
var Song : TSongInfo;

While not Done do
begin
 if QueuedPlayer <> nil then
  begin
    Done := True;
    Song := QueuedPlayer.GetSongInfo;
    if (Song<>nil) then
     case song['songtype'] of
      'S' : QueuedPlayer.Volume := 255;
      'I','P','J','A','N' : QueuedPlayer.Volume := 285;
      else QueuedPlayer.Volume := 255;
     end; //case
  end;
end;

PAL.Loop := True;
PAL.WaitForPlayCount(1);

----------------------------------------------------------------------------------

Would very much appreciate your input.
Thanks.

SAM 2019-1

_________________
SAM 2018-7

mySQL 5.1
Win 7
Custom made computer
16 gig Ram AMD PC
Edirol UA 25EX Audio card
PRESONUS STUDIO LIVE Console


Last edited by Mastacheata on June 6th, 2019, 5:22 pm, edited 1 time in total.
Please use [CODE] tags next time


Top
 Profile  
Reply with quote  
 Post subject: Re: To PAL experts...
PostPosted: June 6th, 2019, 5:32 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7860
Location: Aachen (Germany)
Code:
if ( (thisSong['songtype'] = 'J') or (thisSong['songtype'] = 'j') )

Only run this script if the track currently playing is either capital or lower-case J type. (No idea why cwdj thought that was neccessary)

Code:
theSong := Queue.NextInQueue;

Remove the first track from the queue and store it's info in theSong variable.

Code:
While ( (theSong['songtype'] = 'J') or (theSong['songtype'] = 'j') ) do

If that track is a Jingle

Code:
         theSong.Free;
         theSong := Queue.NextInQueue;     

throw away the variable and remove the new first track from the queue (you removed at least one, so this is the second)

Code:
While ( (theSong['songtype'] = 'J') or (theSong['songtype'] = 'j') ) do

repeat that until the first item in the queue is not a Jingle

If the 2nd to nth entry in th queue wasn't a jingle:
Code:
       Queue.AddFile(theSong['filename'],ipTop);
       theSong.Free;

put the last track you picked (and that obviously wasn't a jingle) back into the queue top spot and then forget about it.

Code:
       If ((DeckA.status = psQueued) or (DeckB.status = psQueued)) then
        begin
         thatSong := QueuedPlayer.GetSongInfo;
         If ( (thatSong['songtype'] = 'J') or (thatSong['songtype'] = 'j') )
          then
            QueuedPlayer.Eject;
        thatSong.Free;
       end;

If either DeckA or DeckB has a track loaded, but isn't playing and that loaed but not playing track is a jingle, remove it.

Code:
PAL.Loop := True;
PAL.WaitForPlayCount(1);

Repeat that every time a track has finished playing.

Code:
PAL.LockExecution;
...
PAL.UnlockExecution;

Perform all aforementioned tasks like a single action as fast as possible. (Usually SAM would only run 1 instruction per second)

---------------------

The second script checks the QueuedPlayer (Player with a track loaded, but nothing playing) if the track there is of type S or one of the other types.
If it's type S it sets the volume of that player to 255, else to 285.

I guess the problem here is if SAM doesn't load the track into the next player, but keeps one player empty, the script won't work because it doesn't check the queue like the first script.

So if you have a track with one of the types queued on Deck B and one playing on Deck A with type S, Deck B will be set to the higher volume.
If the next track from the queue isn't loaded onto a player yet when the songchange happens or when you're doing X-Fades and both players are active, the script will not reset the volume to the lower value. Instead Deck B will now keep playing at 285 until you have a track queued there at the right time and that is type S.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

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


Top
 Profile  
Reply with quote  
 Post subject: Re: To PAL experts...
PostPosted: June 7th, 2019, 7:18 am 
Offline
Senior User
Senior User

Joined: May 19th, 2009, 1:58 am
Posts: 121
Location: New York City
Thank you very much for your input...

So, I guess, I now need to delete something from something... to make it work correctly?

I hope it still works after I do... scripts, (other than in voice acting), computer programming and I - not a good combination.

It is impossible to teach someone do something like this if a person cannot absorb that type of a thing.

I would be very grateful, and would even compensate you, if you could just made a correction. I am sure it is faster than writing what you wrote in your previous post. Please do not get me wrong.

Best...

_________________
SAM 2018-7

mySQL 5.1
Win 7
Custom made computer
16 gig Ram AMD PC
Edirol UA 25EX Audio card
PRESONUS STUDIO LIVE Console


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: Bing [Bot] 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:  
Powered by phpBB® Forum Software © phpBB Group