public final class MicrophoneInputStream extends java.io.InputStream implements AudioConsumer
InputStream. Make sure close()
 gets called in order to free its resources appropriately.| Modifier and Type | Field and Description | 
|---|---|
| ContentType | CONTENT_TYPEThe 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. | 
| java.lang.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. | 
public final ContentType CONTENT_TYPE
public MicrophoneInputStream(boolean opusEncoded)
opusEncoded - the opus encodedpublic int read()
         throws java.io.IOException
read in class java.io.InputStreamjava.io.IOException - Signals that an I/O exception has occurred.public int read(byte[] buffer)
         throws java.io.IOException
read in class java.io.InputStreambuffer - the bufferjava.io.IOException - Signals that an I/O exception has occurred.public int read(byte[] buffer,
                int offset,
                int length)
         throws java.io.IOException
read in class java.io.InputStreambuffer - the bufferoffset - the offsetlength - the lengthjava.io.IOException - Signals that an I/O exception has occurred.public void close()
           throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOException - 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 java.lang.String getContentType()
MicrophoneInputStream.