View Full Version : Background music: Global Settings or Audio Settings ?
Eric P
03-24-2004, 07:23 AM
Hi, forum
I've been wondering about the best way to play background music during a project.
I've read somewhere, in a thread or in the manual, to include the following code in the Global Settings option:
audio_count = 1;
--loads desired audio files into a table
audio = {
"Autoplay\\Audio\\audio1.ogg",
"Autoplay\\Audio\\audio2.ogg",
"Autoplay\\Audio\\audio3.ogg"
};
-- Enter global functions here...
.... and then use the following code in the beginning of the project :
Audio.Load(CHANNEL_BACKGROUND, audio[audio_count], true, false);
-- Insert the following code into the On Audio event of your page:
if e_State == "Finish" then
audio_count = audio_count + 1;
--ensures a valid file will be loaded
if audio_count < Table.Count(audio)+1 then
Audio.Load(CHANNEL_BACKGROUND, audio[audio_count], true, false);
end
end
This indeed works, although, for some reason, it only plays the first music.
But we also have the Audio Setting available, where we can just define a list of different music files as background music.
Any suggestions ?
TJ_Tigger
03-24-2004, 08:06 AM
If all you want is background music for your whole project then use the Project -> Audio Settings... to list your songs. You can place the songs you want in the audio box there and select if you want to play them sequentially or randomly.
You can always load additional songs into the background channel if you want to play something new. Or there are other audio channels available for you to load music/narration into.
In the code you provided above the following needs to be in the On Audio to make the songs advance.
-- Insert the following code into the On Audio event of your page:
if e_State == "Finish" then
audio_count = audio_count + 1;
--ensures a valid file will be loaded
if audio_count < Table.Count(audio)+1 then
Audio.Load(CHANNEL_BACKGROUND, audio[audio_count], true, false);
end
end
HTH
Tigg
Eric P
03-24-2004, 09:49 AM
Thanks, TJ_Tigger,
No more "background music doubts" here ;)
Eric
willfreer
08-26-2004, 02:40 PM
How do I stop background music when someone clicks on a Skip Intro button, which goes to the main menu?
(My music is on Project/Audio/background on the start up)
and I have transition on my pages.
Put this in your skip intro button
Audio.Stop(CHANNEL_BACKGROUND)
How do I stop background music when someone clicks on a Skip Intro button, which goes to the main menu?
(My music is on Project/Audio/background on the start up)
and I have transition on my pages.
willfreer
09-01-2004, 08:54 AM
Thanks Worm,
That stopped the music. (and I included a jump to main menu on the skip button). But the page jumps to the main menu then back into the intro pages (flipping back and forth) and runs about the same time 10 seconds of the intro music.
Thanks
Will
Rella
09-03-2004, 03:42 PM
the code that you provided is:
-- Insert the following code into the On Audio event of your page:
if e_State == "Finish" then
audio_count = audio_count + 1;
--ensures a valid file will be loaded
if audio_count < Table.Count(audio)+1 then
Audio.Load(CHANNEL_BACKGROUND, audio[audio_count], true, false);
end
end
ok, is on the guide of my AMS 5.0.0.4 .... ok ! ;)
But the strange problem is that:
if e_State == "Finish" then
When in the same page in 'on show' you put the code :
Audio.Load(CHANNEL_BACKGROUND, audio[audio_count], true, false);
and the file .wav start playing, the e_State IS 'play' ... so in the section 'on audio' the code retrieve e_state as 'play'
and doesn't work.
well how we fix the problem??
bye
Rella
09-03-2004, 09:22 PM
:huh
well, re-hi... ;)
i've fixed the problem:
this code DOESN'T WORK in BACKGROUND SOUND
in all other channells it works good and i've edited it for restart play from track 1 if autoplay finish play the list.
:huh that thing of background music .... ahhhhh ****!
the problem is that if i jump to another page (deleting the 'load audio' on show) all goes well, but if i return in the initial page... eh... you know, it REPLAY the actual 'audio_count' ....
well i've to work on it now... :
bye! :yes
Rella
09-06-2004, 12:03 PM
yeye! :D
fixed the problem! :p
bye
garyhartaz
09-08-2004, 11:23 AM
I created a button that I would like to use to start and stop the background audio. What would the code look like for the button to accomodate this?
Thanks for the help.
garyhartaz
09-08-2004, 12:30 PM
I created a button that I would like to use to start and stop the background audio. What would the code look like for the button to accomodate this?
Thanks for the help.
For the moment I went ahead and used the Toggle function but I'd like it to work global (i.e. detect the state from another panel).
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.