public class AudioCaptureClient extends Object
WASAPIStream to simultaneously utilize multiple
IAudioCaptureClient instances (e.g. in the case of acoustic echo
cancellation in which audio is input from both the capture and the render
endpoint devices).| Constructor and Description |
|---|
AudioCaptureClient(WASAPISystem audioSystem,
javax.media.MediaLocator locator,
AudioSystem.DataFlow dataFlow,
int streamFlags,
long hnsBufferDuration,
javax.media.format.AudioFormat outFormat,
javax.media.protocol.BufferTransferHandler transferHandler)
Initializes a new AudioCaptureClient instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Releases the resources acquired by this instance throughout its lifetime
and prepares it to be garbage collected.
|
int |
read(byte[] buffer,
int offset,
int length)
Reads audio data from this instance into a specific byte array.
|
int |
read(IMediaBuffer iMediaBuffer,
int length)
Reads audio data from this instance into a specific
IMediaBuffer.
|
void |
start()
Starts the transfer of media from the IAudioCaptureClient
identified by the MediaLocator with which this instance has
been initialized.
|
void |
stop()
Stops the transfer of media from the IAudioCaptureClient
identified by the MediaLocator with which this instance has
been initialized.
|
public AudioCaptureClient(WASAPISystem audioSystem, javax.media.MediaLocator locator, AudioSystem.DataFlow dataFlow, int streamFlags, long hnsBufferDuration, javax.media.format.AudioFormat outFormat, javax.media.protocol.BufferTransferHandler transferHandler) throws Exception
audioSystem - the WASAPISystem instance which has
contributed locatorlocator - a MediaLocator which identifies the audio
endpoint device to be opened and read by the new instancedataFlow - the AudioSystem.DataFlow of the audio endpoint
device identified by locator. If
AudioSystem.DataFlow.PLAYBACK and streamFlags includes
WASAPI.AUDCLNT_STREAMFLAGS_LOOPBACK, allows opening a render
endpoint device in loopback mode and inputing the data that is being
written on that render endpoint devicestreamFlags - zero or more of the AUDCLNT_STREAMFLAGS_XXX
flags defined by the WASAPI classhnsBufferDuration - the base of the duration in milliseconds of the
buffer that the audio application will share with the audio engine. If
Format.NOT_SPECIFIED, the method uses the default interval
between periodic passes by the audio engine.outFormat - the AudioFormat of the data to be made
available by the new instance. Eventually, the
IAudioCaptureClient to be represented by the new instance may be
initialized with a different AudioFormat in which case the new
instance will automatically transcode the data input from the
IAudioCaptureClient into the specified outFormat.transferHandler - the BufferTransferHandler to be invoked
when the new instance has made data available to be read via
read(byte[], int, int)Exception - if the initialization of the new instance failspublic void close()
public int read(byte[] buffer,
int offset,
int length)
throws IOException
buffer - the byte array into which the audio data read from
this instance is to be writtenoffset - the offset in buffer at which the writing of the
audio data is to startlength - the maximum number of bytes in buffer starting at
offset to be writtenIOException - if the reading from this instance or the writing into
the specified buffer failspublic int read(IMediaBuffer iMediaBuffer, int length) throws IOException
iMediaBuffer - the IMediaBuffer into which the audio data
read from this instance is to be writtenlength - the maximum number of bytes to read from this instance and
write into the specified iMediaBufferIOException - if the reading of audio data from this instance or
the writing into the specified iMediaBuffer failspublic void start()
throws IOException
IOException - if the starting of the transfer of media failspublic void stop()
throws IOException
IOException - if the stopping of the transfer of media failsCopyright © 2022 jitsi.org. All rights reserved.