How do you guys do audio handling ? I meen i tried but it's bloody confusing and it gives me a bunch of errors,
I want to do simple car audio/sound handler i know i need to call it from init but how to swap sound like i have a different short loops of audio for engine idle, accel, reverse
I tried audio_obj_name.stop() before calling other sound i tried swaping a audio_obj_name.name but noting seems to work
I'm just stuck...
You may need to allow your browser to play sound automatically.
(There are settings in the address bar in Firefox).
@loginus thanks for response but i think you misunderstood my question.
I can play sounds but stoping and switching from sound to sound it's a different story the problem is for example car is idle and engine_idle loop is playing when i accelerate, car sound shuld switch to engine_accel but it doesn't untill instance of engine_idle is finished that's better case scenario in worse case audio is playing over audio and it's just mess.
@Loginus that is awesome I really like that project but I need something with bit more control and I came up with this:
audionameold = ''
audio.play = function(name,volume,pitch,pan,loop)
if volume then volume else 1 end
if pitch then pitch else 1 end
if pan then pan else 0 end
if loop then loop else 0 end
if audionameold == name then
sound = audio.playSound(name,volume,pitch,pan,loop)
audionameold = name
So if anyone needs the function that can be called from update and played only once here it is.
Note: if not on loop you will need new sound before beeing able to play same sound again
I know about Warrning there is no way of fixing that att least to my knowledge right now