|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectaudio.AbstractCODEC
public abstract class AbstractCODEC
Base class for CODECs that can convert to and from PCM. The class wraps underlying AudioInterfacePCM that can find and talk to PCM hardware. Derived classes should only implement encoding/decoding part from/to PCM (methods AbstractCODEC.convertFromPCM() and AbstractCODEC.convertToPCM()).
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface audio.AudioInterface |
|---|
AudioInterface.Packetizer |
| Field Summary | |
|---|---|
protected AudioInterfacePCM |
audio
Instance of the audio interface that provides access to PCM (signed 16-bit linear) samples. |
protected byte[] |
inputPcmBuf
Input PCM buffer (converted to CODEC) read from audio interface |
protected byte[] |
outputPcmBuf
Output PCM buffer (converted from CODEC) written to audio interface |
| Constructor Summary | |
|---|---|
AbstractCODEC()
|
|
| Method Summary | |
|---|---|
void |
cleanUp()
Cleans up resources used by the interface. |
abstract void |
convertFromPCM(byte[] in,
byte[] out)
Encodes data to PCM, i.e. converts samples from PCM to CODEC format. |
abstract void |
convertToPCM(byte[] in,
byte[] out)
Decodes data from PCM, i.e. converts samples from CODEC to PCM format. |
AudioInterface |
getByFormat(java.lang.Integer format)
Creates new instance of the interface by choosing specified CODEC format |
abstract int |
getVoicePduSubclass()
Gets the VoicePDU subclass attribute of the AbstractAudio object |
long |
readWithTimestamp(byte[] buf)
Reads from the microphone, using the buffer provided, but only filling getSampSize() bytes. |
void |
setAudioSender(AudioInterface.Packetizer as)
Sets the audioSender attribute of the AbstractAudio object |
void |
startPlay()
Starts the player |
long |
startRecording()
Starts the recorder (returning the time) |
void |
startRinging()
Starts ringing signal |
void |
stopPlay()
Stops the player |
void |
stopRecording()
Stops the recorder - but don't throw it away. |
void |
stopRinging()
Stops ringing signal |
void |
writeBuffered(byte[] buf,
long timestamp)
Plays the sample given (AudioInterface.getSampleSize() bytes) assuming that it's timestamp is long |
void |
writeDirectly(byte[] f)
Writes directly to source line without buffering |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface audio.AudioInterface |
|---|
getSampleSize |
| Field Detail |
|---|
protected AudioInterfacePCM audio
protected byte[] outputPcmBuf
protected byte[] inputPcmBuf
| Constructor Detail |
|---|
public AbstractCODEC()
| Method Detail |
|---|
public abstract void convertFromPCM(byte[] in,
byte[] out)
public abstract void convertToPCM(byte[] in,
byte[] out)
public abstract int getVoicePduSubclass()
getVoicePduSubclass in interface AudioInterfacepublic void stopRecording()
stopRecording in interface AudioInterfacepublic long startRecording()
startRecording in interface AudioInterfacepublic void startPlay()
startPlay in interface AudioInterfacepublic void stopPlay()
stopPlay in interface AudioInterfacepublic void startRinging()
startRinging in interface AudioInterfacepublic void stopRinging()
stopRinging in interface AudioInterface
public void writeBuffered(byte[] buf,
long timestamp)
throws java.io.IOException
writeBuffered in interface AudioInterfacejava.io.IOException
public long readWithTimestamp(byte[] buf)
throws java.io.IOException
readWithTimestamp in interface AudioInterfacejava.io.IOExceptionpublic void writeDirectly(byte[] f)
writeDirectly in interface AudioInterfacepublic void setAudioSender(AudioInterface.Packetizer as)
setAudioSender in interface AudioInterfacepublic void cleanUp()
cleanUp in interface AudioInterfacepublic AudioInterface getByFormat(java.lang.Integer format)
getByFormat in interface AudioInterface
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||