Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2001
    Location
    Portugal
    Posts
    9

    Background music: Global Settings or Audio Settings ?

    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 ?

  2. #2
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    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
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  3. #3
    Join Date
    Dec 2001
    Location
    Portugal
    Posts
    9
    Thanks, TJ_Tigger,

    No more "background music doubts" here

    Eric

  4. #4
    Join Date
    Aug 2004
    Posts
    47

    background music

    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.

  5. #5
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Put this in your skip intro button

    Audio.Stop(CHANNEL_BACKGROUND)

    Quote Originally Posted by willfreer
    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.

  6. #6
    Join Date
    Aug 2004
    Posts
    47

    Audio

    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

  7. #7
    Join Date
    Apr 2004
    Posts
    15

    yes, but .... (is for TJ TIGGER)

    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

  8. #8
    Join Date
    Apr 2004
    Posts
    15

    oooohhh yeah! Another problem!


    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.
    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!

  9. #9
    Join Date
    Apr 2004
    Posts
    15
    yeye!
    fixed the problem!

    bye

  10. #10
    Join Date
    Nov 2002
    Location
    Arizona
    Posts
    6

    How do I start it again then?

    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.

  11. #11
    Join Date
    Nov 2002
    Location
    Arizona
    Posts
    6

    Temp Work around

    Quote Originally Posted by garyhartaz
    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).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts