Methods Summary |
---|
private static native void | AudioRecordDelete(long audioRecord)
|
private static native long | AudioRecordNew(int sampleRate, int fifoDepth)
|
private static native int | AudioRecordRead(long audioRecord, byte[] b, int offset, int length)
|
private static native int | AudioRecordStart(long audioRecord)
|
private static native void | AudioRecordStop(long audioRecord)
|
public void | close()Closes this stream.
if (mAudioRecord != 0) {
try {
AudioRecordStop(mAudioRecord);
} finally {
try {
AudioRecordDelete(mAudioRecord);
} finally {
mAudioRecord = 0;
}
}
}
|
protected void | finalize()
if (mAudioRecord != 0) {
close();
throw new IOException("someone forgot to close MicrophoneInputStream");
}
|
public int | read()
if (mAudioRecord == 0) throw new IllegalStateException("not open");
int rtn = AudioRecordRead(mAudioRecord, mOneByte, 0, 1);
return rtn == 1 ? ((int)mOneByte[0] & 0xff) : -1;
|
public int | read(byte[] b)
if (mAudioRecord == 0) throw new IllegalStateException("not open");
return AudioRecordRead(mAudioRecord, b, 0, b.length);
|
public int | read(byte[] b, int offset, int length)
if (mAudioRecord == 0) throw new IllegalStateException("not open");
// TODO: should we force all reads to be a multiple of the sample size?
return AudioRecordRead(mAudioRecord, b, offset, length);
|