Hello all!
I’m trying to load my audio into a table for later user. I’m using Director so I’m declaring my audio in my main.lua as a global for later use. I’m having issues where it sets the volume ACROSS THE BOARD instead of individually:
audioTable = {}
local theFiles = {"SFX/echo\_affirm.wav","SFX/echo\_affirm1.wav","SFX/techy\_affirm.wav","SFX/techy\_affirm1.wav","SFX/chatter1.wav","SFX/chatter2.wav","SFX/chatter3.wav","SFX/chatter4.wav","SFX/chatter5.wav" }
for i=1,#theFiles do
audioTable[i] = audio.loadSound(theFiles[i])
end
battleMusic = audio.loadStream( "SFX/ShadowsApproach.mp3" )
battleMusicChannel = audio.play( battleMusic, { channel=1, loops=-1 } )
audio.setVolume( 0.00, { battleMusicChannel } ) -- set the volume on channel 1
altMusic1 = audio.loadStream( "SFX/TheJourney\_noDrums.mp3" )
altMusic1Channel = audio.play( altMusic1, { channel=2, loops=-1 } )
audio.setVolume( 0.00, { altMusic1Channel } ) -- set the volume on channel 1
altMusic2 = audio.loadStream( "SFX/Wishful\_noDrums.mp3" )
altMusic2Channel = audio.play( altMusic2, { channel=3, loops=-1 } )
audio.setVolume( 0.00, { altMusic2Channel } ) -- set the volume on channel 1
and then in one of my later screens I’m doing:
local tempValue = mRand(5,9)
local tempChannel = audio.play(audioTable[tempValue])
audio.setVolume( 1.00, { tempChannel } ) -- set the volume on channel 1
tutorialCount = tutorialCount + 1
audio.fade({ channel=battleMusicChannel, time=1000, volume=0.0 } )
audio.fade({ channel=altMusic2Channel, time=5000, volume=0.35 } )
But all I end up getting is EVERYTHING, ALL OF MY SOUNDS played back at full volume, none of the fading took place, etc. Works fine with just my music files (the loadStreams) but not my wav’s (the loadSounds).
How are others handling multiple sound effects? You can’t tell me that EVRYONE is naming EVERY last sound effect individually…are you?! Just trying to be efficient here.
Hope someone can point me in the right direction!
-Mario
[import]uid: 11636 topic_id: 26590 reply_id: 326590[/import]