|
@@ -23,6 +23,8 @@ private class LocalEntry extends FileEntry {
|
|
this.file = file;
|
|
this.file = file;
|
|
if( fs.createXBX && extension == "fbx" )
|
|
if( fs.createXBX && extension == "fbx" )
|
|
convertToXBX();
|
|
convertToXBX();
|
|
|
|
+ if( fs.createMP3 && extension == "wav" )
|
|
|
|
+ convertToMP3();
|
|
}
|
|
}
|
|
|
|
|
|
static var INVALID_CHARS = ~/[^A-Za-z0-9_]/g;
|
|
static var INVALID_CHARS = ~/[^A-Za-z0-9_]/g;
|
|
@@ -56,6 +58,32 @@ private class LocalEntry extends FileEntry {
|
|
#end
|
|
#end
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function convertToMP3() {
|
|
|
|
+ var target = fs.tmpDir + "R_" + INVALID_CHARS.replace(relPath,"_") + ".mp3";
|
|
|
|
+ #if air3
|
|
|
|
+ var target = new flash.filesystem.File(target);
|
|
|
|
+ if( !target.exists || target.modificationDate.getTime() < file.modificationDate.getTime() ) {
|
|
|
|
+ var p = new flash.desktop.NativeProcess();
|
|
|
|
+ var i = new flash.desktop.NativeProcessStartupInfo();
|
|
|
|
+ i.arguments = flash.Vector.ofArray(["-h",file.nativePath,target.nativePath]);
|
|
|
|
+ var f = new flash.filesystem.File("d:/projects/shiroTools/tools/lame.exe");
|
|
|
|
+ i.executable = f;
|
|
|
|
+ i.workingDirectory = f.parent;
|
|
|
|
+ p.addEventListener("exit", function(e:Dynamic) {
|
|
|
|
+ var code : Int = Reflect.field(e, "exitCode");
|
|
|
|
+ if( code == 0 )
|
|
|
|
+ file = target;
|
|
|
|
+ });
|
|
|
|
+ p.addEventListener(flash.events.IOErrorEvent.IO_ERROR, function(e) {
|
|
|
|
+ trace(e);
|
|
|
|
+ });
|
|
|
|
+ p.start(i);
|
|
|
|
+ trace("Started");
|
|
|
|
+ } else
|
|
|
|
+ file = target;
|
|
|
|
+ #end
|
|
|
|
+ }
|
|
|
|
+
|
|
override function getSign() : Int {
|
|
override function getSign() : Int {
|
|
#if air3
|
|
#if air3
|
|
var old = fread == null ? -1 : fread.position;
|
|
var old = fread == null ? -1 : fread.position;
|
|
@@ -278,6 +306,7 @@ class LocalFileSystem implements FileSystem {
|
|
var root : FileEntry;
|
|
var root : FileEntry;
|
|
public var baseDir(default,null) : String;
|
|
public var baseDir(default,null) : String;
|
|
public var createXBX : Bool;
|
|
public var createXBX : Bool;
|
|
|
|
+ public var createMP3 : Bool;
|
|
public var tmpDir : String;
|
|
public var tmpDir : String;
|
|
|
|
|
|
public function new( dir : String ) {
|
|
public function new( dir : String ) {
|