|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--mediaframe.mpeg1.audio.player.EightBitAudioDevice
The EightBitAudioDevice class implements an audio
device by using the sun.audio.AudioPlayer class.
| Field Summary | |
private short[] |
byteBuf
The temporary buffer for storing the audio samples. |
private mediaframe.mpeg1.audio.decoder.Decoder |
decoder
The decoder that provides audio data to this audio device. |
private boolean |
open
True if this audio device is opened, false otherwise. |
private static int |
outputCapacity
The size of the circle buffer in the pipe. |
private BigPipedInputStream |
pis
The input stream in the pipe. |
private BigPipedOutputStream |
pos
The output stream in the pipe. |
| Constructor Summary | |
EightBitAudioDevice()
|
|
| Method Summary | |
void |
close()
Closes this audio device. |
void |
endOfFile()
Is called if the end of file has been reached. |
void |
flush()
Waits for any buffered audio samples to be played by the audio device. |
protected short[] |
getShortArray(int length)
Gets the temporary buffer that able to store up to length audio samples. |
boolean |
isEightBitEightKhzMuLaw()
Returns true because the EightBitAudioDevice audio device is a
crappy eight-bit eight khz ulaw decoder (browser). |
void |
open(mediaframe.mpeg1.audio.decoder.Decoder decoder)
Opens this audio device. |
void |
pause()
Pause the Player. |
void |
play()
Start player playing. |
void |
run()
Starts the sun.audio.AudioPlayer in the "Eight Bit Audio Device" thread.
|
void |
setMute(boolean mute)
Sets the mute state of the audio playback. |
void |
setVolume(float volume)
Sets the volume (in the range 0..1) of the audio playback. |
void |
stop()
Stop player playing. |
(package private) int |
toShortArray(short[] samples,
int offset,
int len,
short[] b,
boolean stereoToMono)
Copies up to len audio samples from the samples array
starting at the offset offset into the b array.
|
void |
write(short[] samples,
int offset,
int len)
Writes audio data to this audio device. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final int outputCapacity
private short[] byteBuf
private BigPipedInputStream pis
private BigPipedOutputStream pos
private boolean open
private mediaframe.mpeg1.audio.decoder.Decoder decoder
| Constructor Detail |
public EightBitAudioDevice()
| Method Detail |
public void open(mediaframe.mpeg1.audio.decoder.Decoder decoder)
throws mediaframe.mpeg1.audio.decoder.JavaLayerException
open in interface AudioDevicedecoder - the decoder that will provide audio data
to this audio device.
mediaframe.mpeg1.audio.decoder.JavaLayerException - if the audio device could not be opened.public boolean isEightBitEightKhzMuLaw()
EightBitAudioDevice audio device is a
crappy eight-bit eight khz ulaw decoder (browser).
isEightBitEightKhzMuLaw in interface AudioDevicepublic void run()
sun.audio.AudioPlayer in the "Eight Bit Audio Device" thread.
This method is called by the JRE after this audio device is opened and the
"Eight Bit Audio Device" thread is started.
run in interface java.lang.Runnablepublic void close()
close in interface AudioDevice
public void write(short[] samples,
int offset,
int len)
throws mediaframe.mpeg1.audio.decoder.JavaLayerException
write in interface AudioDevicesamples - the samples to write to the audio device.offset - the offset into the array of the first sample to write.len - the number of samples from the array to write.
mediaframe.mpeg1.audio.decoder.JavaLayerException - if the audio data could not be
written to the audio device.protected short[] getShortArray(int length)
length audio samples.
length - min size of the temporary buffer.
int toShortArray(short[] samples,
int offset,
int len,
short[] b,
boolean stereoToMono)
len audio samples from the samples array
starting at the offset offset into the b array.
Mix stereo samples into the mono sample if the audio decoder provides stereo data.
samples - the audio data.offset - the start offset in the data.len - the number of samples to copy.b - the destination array of audio data into which the data is copied.stereoToMono - true if the audio decoder provides stereo data
b array.public void flush()
flush in interface AudioDevicepublic void play()
play in interface AudioDevicepublic void pause()
pause in interface AudioDevicepublic void stop()
stop in interface AudioDevicepublic void setVolume(float volume)
setVolume in interface AudioDevicevolume - the volume to set.public void setMute(boolean mute)
setMute in interface AudioDevicemute - the mute state (true if the mute on and the player doesn't play the audio).public void endOfFile()
endOfFile in interface AudioDevice
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||