Fixing sound errors on html5
This commit is contained in:
@@ -36,13 +36,6 @@ class Main {
|
||||
|
||||
// Init the shaders and view
|
||||
init();
|
||||
|
||||
lib.audio.create_sound('sound1', 'assets/music_credit.ogg');
|
||||
lib.audio.create_sound('sound2', 'assets/shoot.wav');
|
||||
|
||||
lib.audio.sounds.get('sound1').volume = 1;
|
||||
lib.audio.sounds.get('sound1').play();
|
||||
lib.audio.sounds.get('sound2').play();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -36,12 +36,19 @@ class Sound {
|
||||
|
||||
public function play(?_loops:Int = 0, ?_start:Float = 0.0) {
|
||||
sound = null;
|
||||
sound = nme_sound_channel_create(handle, _start, _loops, _transform);
|
||||
|
||||
#if lime_native
|
||||
sound = nme_sound_channel_create(handle, _start, _loops, _transform);
|
||||
#end //lime_native
|
||||
}
|
||||
|
||||
public function stop() {
|
||||
if(sound != null) {
|
||||
nme_sound_channel_stop(sound);
|
||||
|
||||
#if lime_native
|
||||
nme_sound_channel_stop(sound);
|
||||
#end //lime_native
|
||||
|
||||
sound = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user