com.meapsoft
Class AudioWriter
java.lang.Object
com.meapsoft.AudioWriter
- All Implemented Interfaces:
- java.lang.Runnable
- public class AudioWriter
- extends java.lang.Object
- implements java.lang.Runnable
Can write to a file or to an audio stream. For some reason this
appears to be difficult to do in the JavaSound framework. This is
just a wrapper class to unify the interface.
Constructor Summary |
AudioWriter(java.io.File file,
javax.sound.sampled.AudioFormat format,
javax.sound.sampled.AudioFileFormat.Type targetType)
|
AudioWriter(javax.sound.sampled.SourceDataLine sdl)
|
Method Summary |
void |
close()
|
void |
doubles2bytes(double[] audioData,
byte[] audioBytes)
|
void |
doubles2bytes(double[] audioData,
byte[] audioBytes,
int length)
|
javax.sound.sampled.AudioFormat |
getFormat()
|
static void |
limit(double[] data)
|
void |
run()
|
void |
write(byte[] bytes)
|
void |
write(double[] data)
|
void |
write(double[] data,
int length)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AudioWriter
public AudioWriter(javax.sound.sampled.SourceDataLine sdl)
AudioWriter
public AudioWriter(java.io.File file,
javax.sound.sampled.AudioFormat format,
javax.sound.sampled.AudioFileFormat.Type targetType)
throws java.io.IOException
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
write
public void write(double[] data)
throws java.io.IOException
- Throws:
java.io.IOException
write
public void write(double[] data,
int length)
throws java.io.IOException
- Throws:
java.io.IOException
limit
public static void limit(double[] data)
write
public void write(byte[] bytes)
throws java.io.IOException
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Throws:
java.io.IOException
getFormat
public javax.sound.sampled.AudioFormat getFormat()
doubles2bytes
public void doubles2bytes(double[] audioData,
byte[] audioBytes)
doubles2bytes
public void doubles2bytes(double[] audioData,
byte[] audioBytes,
int length)