public final class MicrophoneInputStream extends InputStream implements AudioConsumer
InputStream. Make sure close()
gets called in order to free its resources appropriately.| Modifier and Type | Field and Description |
|---|---|
ContentType |
CONTENT_TYPE
The content type.
|
| Constructor and Description |
|---|
MicrophoneInputStream(boolean opusEncoded)
Instantiates a new microphone input stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close.
|
void |
consume(byte[] data)
Consume.
|
void |
consume(byte[] data,
double amplitude,
double volume)
Consume.
|
String |
getContentType()
Get the audio format from the
MicrophoneInputStream. |
int |
read()
Read.
|
int |
read(byte[] buffer)
Read.
|
int |
read(byte[] buffer,
int offset,
int length)
Read.
|
void |
setOnAmplitudeListener(AmplitudeListener listener)
Receive amplitude (and volume) data per sample from the
MicrophoneInputStream. |
available, mark, markSupported, reset, skippublic final ContentType CONTENT_TYPE
public MicrophoneInputStream(boolean opusEncoded)
opusEncoded - the opus encodedpublic int read()
throws IOException
read in class InputStreamIOException - Signals that an I/O exception has occurred.public int read(byte[] buffer)
throws IOException
read in class InputStreambuffer - the bufferIOException - Signals that an I/O exception has occurred.public int read(byte[] buffer,
int offset,
int length)
throws IOException
read in class InputStreambuffer - the bufferoffset - the offsetlength - the lengthIOException - Signals that an I/O exception has occurred.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOException - Signals that an I/O exception has occurred.public void consume(byte[] data,
double amplitude,
double volume)
consume in interface AudioConsumerdata - the dataamplitude - the amplitudevolume - the volumepublic void consume(byte[] data)
consume in interface AudioConsumerdata - the datapublic void setOnAmplitudeListener(AmplitudeListener listener)
MicrophoneInputStream.listener - Notified per sample with amplitude and volume data.public String getContentType()
MicrophoneInputStream.