Commit d34dc249 authored by petter's avatar petter

now with patched WavConcat for more than one WAV



git-svn-id: https://www2.in.tum.de/repos/ttt/trunk@166 0463f305-d864-43cb-8a47-61cf597d4139
parent 459f381b
...@@ -7,7 +7,7 @@ import java.io.IOException; ...@@ -7,7 +7,7 @@ import java.io.IOException;
import java.io.SequenceInputStream; import java.io.SequenceInputStream;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.Vector;
import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioSystem;
...@@ -116,28 +116,31 @@ public class WavConcat { ...@@ -116,28 +116,31 @@ public class WavConcat {
saveDuration(); saveDuration();
for(int i = 2; InFiles.length >= i;i++){ int framelength=0;
Vector<AudioInputStream> vec = new Vector<AudioInputStream>();
try {
for (int i=0;i<InFiles.length;i++){
AudioInputStream clip = AudioSystem.getAudioInputStream(InFiles[i]);
framelength+=clip.getFrameLength();
vec.add(clip);
}
try {
AudioInputStream clip1 = AudioSystem.getAudioInputStream(InFiles[i-2]); AudioInputStream appendedFiles =
AudioInputStream clip2 = AudioSystem.getAudioInputStream(InFiles[i-1]); new AudioInputStream(
new SequenceInputStream(vec.elements()),
vec.firstElement().getFormat(),
AudioInputStream appendedFiles = framelength);
new AudioInputStream(
new SequenceInputStream(clip1, clip2), AudioSystem.write(appendedFiles,
clip1.getFormat(), AudioFileFormat.Type.WAVE,
clip1.getFrameLength() + clip2.getFrameLength()); OutFile);
} catch (Exception e) {
AudioSystem.write(appendedFiles, e.printStackTrace();
AudioFileFormat.Type.WAVE,
OutFile);
InFiles[i-2] = OutFile;
} catch (Exception e) {
e.printStackTrace();
}
} }
return true; return true;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment