UpdateMusic

From OxeyeWiki

Jump to: navigation, search

audio.updateMusic(musicFilename , volume)

Updates a music already playing started by audio.playMusic.

Parameter Expected Type Description
musicFilename A string The name of the music file, relative to the source folder. The name is case sensitive on Mac OS X.
volume A number Volume of the played music file, maximum is 1.
Returns

Returns true is the sound was updated, false if the sound is no longer playing or could not be found.

Daisymoon Audio Lib

Example

   --simply change volume:
   audio.playMusic("boss.ogg", 1)
   audio.updateMusic("boss.ogg", 0.25)



   -- or more complicated, for example...
   -- start of game
   audio.playMusic("intro.ogg")

   -- during loop:
   if not audio.updateMusic("intro.ogg", 0.5) then
     if not audio.updateMusic("level.ogg", 1) then
       audio.playMusic("level.ogg")
     end
   end
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox