pgSoundLoader()

Help for using specific functions

pgSoundLoader()

Postby Kataleena » Tue Mar 25, 2014 6:48 pm

Hi,

I am loading multiple invisible audio files(mp3) using pgSoundloader on a page that will be played depending on what a user does. These audio files only relate to this page, do I need to unload all the audio using pgSoundControl before leaving the page?

Thanks Kate
Kataleena
 
Posts: 49
Joined: Sun Feb 23, 2014 10:05 pm

Re: pgSoundLoader()

Postby Clifton » Tue Mar 25, 2014 8:46 pm

Unloading upon page navigation is automatic unless you set stopOnPageNav = false
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: pgSoundLoader()

Postby Kataleena » Tue Mar 25, 2014 10:46 pm

Unloading upon page navigation is automatic unless you set stopOnPageNav = false

Ok, thanks just wanted to make sure.
Kataleena
 
Posts: 49
Joined: Sun Feb 23, 2014 10:05 pm

Re: pgSoundLoader()

Postby Clifton » Wed Mar 26, 2014 10:40 am

It is good to be aware that just like objects in ToolBook, audio files have a name attribute which is set when pgSoundLoader() is run. If an invisible audio is playing with name = "My Audio" and another one is started with the same name attribute, then only the current audio will be tracked under the name "My Audio". In this scenario, it is possible that when you move to the next page only the most recent audio file with the name "My Audio" will actually be stopped and the previous one will continue playing unless it stops naturally by coming to the end of its timeline.

So the logic is this:
  1. If two audio files must play at the same time, then each one must be given a distinct name attribute. Then both will be stopped on page navigation.
  2. If multiple audio files are going to be played reusing the same name attribute, then the previous one must be unloaded BEFORE loading the next one begins playing. The exception is if in your Actions logic the next audio can only play if the previous one has finished by reaching the end of its timeline.
A nice advantage of pgSoundLoader() is that is can handle mult-channel audio playback. But this ability can cause some confusion if you fail to manage what is going on when each audio is loaded and begins playing.

Just a little audio FYI.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: pgSoundLoader()

Postby Kataleena » Wed Mar 26, 2014 6:50 pm

Thanks for the additional information, I think I have better understanding now.

Another question:

Currently I use an IF Statement below
if mediaPosition of group "DropSound" = 0 and Qaudio = 1
Do something
End if

Would using pgSoundControl() and the Get [action] position and using the Return value(DropSound) then the below if statement work or is there a correct or better method?
if DropSound = 0 and Qaudio = 1
Do something
End if

Thanks
Kate
Kataleena
 
Posts: 49
Joined: Sun Feb 23, 2014 10:05 pm

Re: pgSoundLoader()

Postby Clifton » Wed Mar 26, 2014 11:39 pm

pgSoundControl() is able to GET the current position of the play head. If an audio has not begun to play the return will be a null value and not necessarily 0. In the Actions editor you can throw error messages if the action is written to expect a number and the value compared cannot be converted to a number. A null or a character string tends to create these situations.

Maybe this is what you need?
Execute Script pgSoundControl(); return value in DropSound
if not (not DropSound) = false and Qaudio = 1
     Do something because the audio is either at position 0 or has not loaded or begun playing.
     The expression not (not DropSound) converts the variable to a boolean true/false expression
     which evaluates nicely in in the Actions Editor.

End if

Just remember that the play head position for an audio is either a value greater than 0 in milliseconds or null for a sound that has not begun playing because it has not been loaded. A paused audio will still report a position greater than 0 in milliseconds.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am


Return to Function Help

Who is online

Users browsing this forum: No registered users and 4 guests

cron