|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object micromod.output.PCM16StreamOutputDevice micromod.output.HasAvailableOutputDevice micromod.output.JavaSoundOutputDevice
An OutputDevice for the Java1.3 audio system. The one Java should have had 3 years ago ... Because of the clunky way JavaSound drains it's buffer, this class implements a workaround that alters the behaviour of framesAvailable() to return more fine-grained values. 30 July 2003 (Jon Zeppieri): added getLine(), so we can control volume on the line 18 March 2005 (Jon Zeppieri): inserted a sourceDataLine.flush() into the close() method, to eliminate a delay on the Macintosh
Field Summary | |
protected int |
available
|
protected int |
bufferFrames
|
protected long |
lastMillis
|
protected int |
samplingRate
|
protected javax.sound.sampled.SourceDataLine |
sourceDataLine
|
protected long |
timeMillis
|
Fields inherited from class micromod.output.PCM16StreamOutputDevice |
bytesPerFrame, CONVERT_BUFFER_FRAMES, convertBuffer, converter |
Constructor Summary | |
JavaSoundOutputDevice(AudioFormatConverter converter,
int samplingRate,
int bufferTimeMillis)
|
Method Summary | |
protected int |
bytesAvailable()
|
void |
close()
Close the output device and release any resources. |
int |
framesAvailable()
A frame of PCM audio is one sample. |
javax.sound.sampled.SourceDataLine |
getLine()
|
int |
getSamplingRate()
|
void |
pause()
Pause playback immediately. |
void |
start()
Begin playing audio. |
void |
stop()
Stop playback. |
void |
write(byte[] buffer,
int length)
Write length bytes of audio to the output device This method should return only when all of the audio has been written to the device, except if the device is stopped or paused, in which case the method should return immediately. |
Methods inherited from class micromod.output.PCM16StreamOutputDevice |
initialise, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int samplingRate
protected int bufferFrames
protected int available
protected long timeMillis
protected long lastMillis
protected javax.sound.sampled.SourceDataLine sourceDataLine
Constructor Detail |
public JavaSoundOutputDevice(AudioFormatConverter converter, int samplingRate, int bufferTimeMillis) throws OutputDeviceException
samplingRate
- Try 44100bufferTimeMillis
- The number of milliseconds of audio to buffer.Method Detail |
public javax.sound.sampled.SourceDataLine getLine()
public int framesAvailable()
HasAvailableOutputDevice
framesAvailable
in class HasAvailableOutputDevice
public void write(byte[] buffer, int length)
StreamOutputDevice
public int getSamplingRate()
public void start()
OutputDevice
public void pause()
StreamOutputDevice
public void stop()
OutputDevice
public void close()
OutputDevice
protected int bytesAvailable()
bytesAvailable
in class HasAvailableOutputDevice
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |