PDA

View Full Version : Problems with Audio


MariaClaudia
08-18-2005, 06:19 PM
Hi friends:
Let me see..... this is my problem.
In the INTRO page I just put this code in the action OnPreload

Audio.Load(CHANNEL_BACKGROUND, "AutoPlay\\Audio\\raul di blasio - Chiquitita.ogg", true, true);

It's works fine!.... but, in another page, I need to "turn stand by" the music, so I use this code in the OnShow action

Audio.Pause(CHANNEL_BACKGROUND);

and the music stop!...... ok, fine, but...... I try to "restart" the music usign this code

Audio.TogglePlay(CHANNEL_BACKGROUND);

I put this code in a button in the action OnClick but it dosn't work. How can I use the "restart" option? I try to restart, not to start again the music.

Sorry my grammar. Thanks a lot!!!!!

Maria Claudia
begginer and persistent AMS designer

Corey
08-18-2005, 06:23 PM
Hi. This should work on your button... :yes

Audio.Play(CHANNEL_BACKGROUND);
Don't forget that when paused is engaged it's still in "play" state, so the toggle will not see that as "stopped" it will see that as "playing but paused". That's why toggle doesn't work to restart a paused song. The song will not restart to the beginning if you "pause then play", it will only do that if you "stop then play". Hope that helps. :)

MariaClaudia
08-18-2005, 06:44 PM
Hi Corey:
I try it but it dosn't work. I forgot to tell something: The intro page load the ogg file, but one page put PAUSE this ogg file..... then count 10 seconds and jumpt to another page. This page, the last one, have the button that I try to setup to return the intro page and restart the ogg file.

Any suggestions?

Sorry my grammar please

MC

Corey
08-18-2005, 07:01 PM
Hi, simply use a flag variable. So on page one in the "OnShow" event add this code:

if loaded~="true" then
Audio.Load(CHANNEL_BACKGROUND, "yourfilename.ogg", true, false);
loaded = "true";
else
Audio.Play(CHANNEL_BACKGROUND);
end
That will cause it to load the audio from your file on the first page visit, and then simply restart it on all subsequent visits. :)

MariaClaudia
08-18-2005, 10:10 PM
I understand it, but, I do not like to restart the ogg file every time I jump to page one. I load the ogg file in background channel for this reason. The case is that when I load the page DEMO, this page must be "silent". But when I jump from this page (the DEMO page) to another page, the off file continue playing or restart. But not when I jump any page with the code you show me.

I hope I make clear, but my grammar is not good I know.

Sorry if I be "dificult"...... I apreciate your help.

Thanks a lot!!!!!

Corey
08-18-2005, 10:14 PM
Hi:

It will continue if you -> PAUSE then PLAY
It will restart if you -> STOP then PLAY

Your choice. :)

Intrigued
08-18-2005, 10:58 PM
Rethinking my life... Har! (removed my post)

MariaClaudia
08-18-2005, 10:58 PM
it's works!!!!!!
thanks a lot Corey!!!!!!!!!!

muak!!!!

Intrigued
08-18-2005, 11:01 PM
Okayyy... then this is not the exact same situation. But, I know it's close.

(Now, where is that post, probable off the forum by now...)

:huh

Corey
08-18-2005, 11:04 PM
Cool, glad it's working. :)

Intrigued, I don't know the status of that one but a workaround is using a flag variable FWIW. :yes

Intrigued
08-18-2005, 11:11 PM
Well, the post has gone off the end of what is saved here in the forums... so I can't reproduce it, sorry. But, I know there was an outstanding issue with something to do with the need for a Global style setting for the Audio Action(s).

Oh well... at least there was sucess in this thread!

:D