UpdateMusic

From OxeyeWiki

(Difference between revisions)
Jump to: navigation, search
(Created page with '{{AudioMethod | audio.updateMusic(musicFilename , volume) | Updates a music already playing started by audio.playMusic. | {{MethodParam|musicFilename|A string|The name of the...')
(Example)
 
Line 12: Line 12:
=== Example ===
=== Example ===
<pre>
<pre>
 +
  --simply change volume:
 +
  audio.playMusic("boss.ogg", 1)
 +
  audio.updateMusic("boss.ogg", 0.25)
 +
 +
 +
 +
  -- or more complicated, for example...
   -- start of game
   -- start of game
   audio.playMusic("intro.ogg")
   audio.playMusic("intro.ogg")

Latest revision as of 13:51, 18 January 2010

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