From bc2cdc4cc3316a5fb66f4372e3708b610c8f68b0 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Sun, 8 Mar 2015 21:59:59 +0200 Subject: [PATCH] added midi to wav conversion --- .../meviz/encoder/FormatsRegistry.java | 4 +- .../meviz/encoder/converters/Midi2Wav.java | 42 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/main/java/eu/svjatoslav/meviz/encoder/converters/Midi2Wav.java diff --git a/src/main/java/eu/svjatoslav/meviz/encoder/FormatsRegistry.java b/src/main/java/eu/svjatoslav/meviz/encoder/FormatsRegistry.java index 182d952..d023f02 100755 --- a/src/main/java/eu/svjatoslav/meviz/encoder/FormatsRegistry.java +++ b/src/main/java/eu/svjatoslav/meviz/encoder/FormatsRegistry.java @@ -1,7 +1,7 @@ /* * Meviz - Various tools collection to work with multimedia. * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public License * as published by the Free Software Foundation. @@ -18,6 +18,7 @@ import eu.svjatoslav.meviz.encoder.converters.AvconvVideo; import eu.svjatoslav.meviz.encoder.converters.Convert; import eu.svjatoslav.meviz.encoder.converters.Ffmpeg2theora; import eu.svjatoslav.meviz.encoder.converters.Flac; +import eu.svjatoslav.meviz.encoder.converters.Midi2Wav; import eu.svjatoslav.meviz.encoder.converters.Ogg2Wav; public class FormatsRegistry { @@ -36,6 +37,7 @@ public class FormatsRegistry { registerEncoder(new Ogg2Wav()); registerEncoder(new Flac()); registerEncoder(new AvconvAudio()); + registerEncoder(new Midi2Wav()); } public List getEncoders(final String sourceFormat, diff --git a/src/main/java/eu/svjatoslav/meviz/encoder/converters/Midi2Wav.java b/src/main/java/eu/svjatoslav/meviz/encoder/converters/Midi2Wav.java new file mode 100644 index 0000000..972780f --- /dev/null +++ b/src/main/java/eu/svjatoslav/meviz/encoder/converters/Midi2Wav.java @@ -0,0 +1,42 @@ +/* + * Meviz - Various tools collection to work with multimedia. + * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public License + * as published by the Free Software Foundation. + */ + +package eu.svjatoslav.meviz.encoder.converters; + +import java.io.File; +import java.util.List; + +import eu.svjatoslav.meviz.encoder.EncodingOptions; + +public class Midi2Wav extends AbstractConverter { + + @Override + public String getCommand(final File inputFile, final File targetFile, + final EncodingOptions options) { + + return "timidity \"" + inputFile.getAbsolutePath() + "\" -Ow -o \"" + + targetFile.getAbsolutePath() + "\""; + } + + @Override + public List getSourceFileExtensions() { + return toList("mid"); + } + + @Override + public List getTargetFileExtensions() { + return toList("wav"); + } + + @Override + public boolean isTerminalMandatory() { + return true; + } + +} -- 2.20.1