|
@@ -249,7 +249,19 @@ class ConvertWAV2MP3 extends Convert {
|
|
|
}
|
|
|
|
|
|
override function convert() {
|
|
|
- command("lame", ["--resample", "44100", "--silent", "-h", srcPath, dstPath]);
|
|
|
+ var args = ["--silent"];
|
|
|
+ var sampleRate = 44100;
|
|
|
+ if(hasParam("samplerate")) {
|
|
|
+ sampleRate = getParam("samplerate");
|
|
|
+ }
|
|
|
+ if(hasParam("bitrate")) {
|
|
|
+ args = args.concat(["-b", Std.string(getParam("bitrate"))]);
|
|
|
+ } else {
|
|
|
+ args.push("-h");
|
|
|
+ }
|
|
|
+ args = args.concat(["--resample", Std.string(sampleRate)]);
|
|
|
+ args = args.concat([srcPath, dstPath]);
|
|
|
+ command("lame", args);
|
|
|
}
|
|
|
|
|
|
static var _ = Convert.register(new ConvertWAV2MP3());
|
|
@@ -262,16 +274,26 @@ class ConvertWAV2OGG extends Convert {
|
|
|
|
|
|
override function convert() {
|
|
|
var cmd = "oggenc";
|
|
|
- var args = ["--resample", "44100", "-Q", srcPath, "-o", dstPath];
|
|
|
if (Sys.systemName() == "Windows")
|
|
|
cmd = "oggenc2";
|
|
|
+ var args = ["--quiet"];
|
|
|
+ var sampleRate = 44100;
|
|
|
+ if(hasParam("samplerate")) {
|
|
|
+ sampleRate = getParam("samplerate");
|
|
|
+ }
|
|
|
if (hasParam("mono")) {
|
|
|
var f = sys.io.File.read(srcPath);
|
|
|
var wav = new format.wav.Reader(f).read();
|
|
|
f.close();
|
|
|
- if (wav.header.channels >= 2)
|
|
|
+ if (wav.header.channels >= 2) {
|
|
|
args.push("--downmix");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(hasParam("bitrate")) {
|
|
|
+ args = args.concat(["-b", Std.string(getParam("bitrate"))]);
|
|
|
}
|
|
|
+ args = args.concat(["--resample", Std.string(sampleRate)]);
|
|
|
+ args = args.concat([srcPath, "-o", dstPath]);
|
|
|
command(cmd, args);
|
|
|
}
|
|
|
|