console: loop mode specified at sound creation

FMOD uses loop mode to preprocess the sound.
This commit is contained in:
James Gray
2016-07-17 13:41:43 -05:00
parent f71119fa63
commit c1cd7f2ea9
3 changed files with 20 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ import js.html.Audio;
#elseif flash
import flash.media.Sound;
#elseif lime_console
import lime.audio.fmod.FMODMode;
import lime.audio.fmod.FMODSound;
#end
@@ -101,7 +102,8 @@ class AudioBuffer {
#if lime_console
var sound:FMODSound = FMODSound.fromFile (path);
var mode = StringTools.endsWith(path, ".wav") ? FMODMode.LOOP_OFF : FMODMode.LOOP_NORMAL;
var sound:FMODSound = FMODSound.fromFile (path, mode);
if (sound.valid) {

View File

@@ -0,0 +1,16 @@
package lime.audio.fmod;
#if lime_console
import lime.ConsoleIncludePaths;
@:enum abstract FMODMode(Int) {
var LOOP_OFF = 0x00000001;
var LOOP_NORMAL = 0x00000002;
}
#end

View File

@@ -16,7 +16,7 @@ extern class FMODSound {
// fromFile creates a sound from the named file.
@:native("lime::ConsoleFmodSound::fromFile")
public static function fromFile (name:String):FMODSound;
public static function fromFile (name:String, mode:FMODMode):FMODSound;
// play plays the sound and returns the channel it was assigned.