FlxG.sound.play(getExtension("assets/sounds/test"));
public function getExtensions(s:String):String
{
#if flash
return s + ".mp3";
#else
return s + ".ogg";
#end
}
I think you will probably have more luck with this question in the OpenFL forums.I know that it helps on Android to cache sounds at the start of the app (via FlxG.sound.add()), since you can get lags like that otherwise - I haven't heard about this being an issue on iOS though.Just a little tip, you might want to write a wrapper function to get the correct extension, so you can do:
FlxG.sound.play(getExtension("assets/sounds/test"));
public function getExtensions(s:String):String
{
#if flash
return s + ".mp3";
#else
return s + ".ogg";
#end
}
On Tuesday, April 1, 2014 3:54:43 AM UTC+2, Vasco wrote:
Well, on the OpenFL forums they said that I need to load the sounds prior to playing. It would be great if I could just use FlxG.sound.add(), but there's a compiler conditional that only let's it compile for Android. I tried to change that on the Mac, but when I search I can't find any flixel .hx files (only .cpp), don't they exist for the Mac?
EDIT: Ok, I found the hx files (I don't have much experience with Macs), let me see if I can get this to work...
On Tuesday, April 1, 2014 6:42:18 PM UTC+1, Vasco wrote:
Vasco seems like a sensible pull request if your up for it? Not many of the core developers use macs/iOS and some people implement their own sound pipeline etc.
I solved the problem by changing the 3 compiler conditionals in SoundFrontEnd.hx to #if (android || ios)
On Wednesday, April 2, 2014 12:06:37 AM UTC+1, Vasco wrote:
Well, on the OpenFL forums they said that I need to load the sounds prior to playing. It would be great if I could just use FlxG.sound.add(), but there's a compiler conditional that only let's it compile for Android. I tried to change that on the Mac, but when I search I can't find any flixel .hx files (only .cpp), don't they exist for the Mac?
EDIT: Ok, I found the hx files (I don't have much experience with Macs), let me see if I can get this to work...
On Tuesday, April 1, 2014 6:42:18 PM UTC+1, Vasco wrote:
--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.
Visit this group at http://groups.google.com/group/haxeflixel.
To view this discussion on the web visit https://groups.google.com/d/msgid/haxeflixel/eb6f7947-daa2-4f61-b2b5-6604f321bed9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
package;
import flixel.FlxG;
class Core{ public static function preloadSounds():Void { FlxG.sound.volume = 0;
FlxG.sound.volume = 1; }}