|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.impl.neomedia.portaudio.PortAudio
public final class PortAudio
Provides the interface to the native PortAudio library.
| Nested Class Summary | |
|---|---|
static class |
PortAudio.PaHostApiTypeId
Unchanging unique identifiers for each supported host API. |
| Field Summary | |
|---|---|
static int |
DEFAULT_MILLIS_PER_BUFFER
The number of milliseconds to be read from or written to a native PortAudio stream in a single transfer of data. |
static double |
DEFAULT_SAMPLE_RATE
The default value for the sample rate of the input and the output PortAudio streams with which they are to be opened if no other specific sample rate is specified to the PortAudio DataSource or PortAudioRenderer that they represent. |
static long |
FRAMES_PER_BUFFER_UNSPECIFIED
Can be passed as the framesPerBuffer parameter to Pa_OpenStream() or Pa_OpenDefaultStream() to indicate that the stream callback will accept buffers of any size. |
static double |
LATENCY_HIGH
Used when creating new stream parameters for suggested latency to use high input/output value. |
static double |
LATENCY_LOW
Used when creating new stream parameters for suggested latency to use low input/default value. |
static double |
LATENCY_UNSPECIFIED
Used when creating new stream parameters for suggested latency to use default value. |
static int |
paNoDevice
PortAudio "no device" constant. |
static long |
SAMPLE_FORMAT_FLOAT32
A type used to specify one or more sample formats. |
static long |
SAMPLE_FORMAT_INT16
A type used to specify one or more sample formats. |
static long |
SAMPLE_FORMAT_INT24
A type used to specify one or more sample formats. |
static long |
SAMPLE_FORMAT_INT32
A type used to specify one or more sample formats. |
static long |
SAMPLE_FORMAT_INT8
A type used to specify one or more sample formats. |
static long |
SAMPLE_FORMAT_UINT8
A type used to specify one or more sample formats. |
static long |
STREAM_FLAGS_CLIP_OFF
Disables default clipping of out of range samples. |
static long |
STREAM_FLAGS_DITHER_OFF
Disables default dithering. |
static long |
STREAM_FLAGS_NEVER_DROP_INPUT
Flag requests that where possible a full duplex stream will not discard overflowed input samples without calling the stream callback. |
static long |
STREAM_FLAGS_NO_FLAG
Flags used to control the behavior of a stream. |
static long |
STREAM_FLAGS_PLATFORM_SPECIFIC_FLAGS
A mask specifying the platform specific bits. |
static long |
STREAM_FLAGS_PRIME_OUTPUT_BUFFERS_USING_STREAM_CALLBACK
Call the stream callback to fill initial output buffers, rather than the default behavior of priming the buffers with zeros (silence). |
| Method Summary | |
|---|---|
static void |
deviceChanged()
Implements a (legacy) callback which gets called by the native PortAudio counterpart to notify the Java counterpart that the list of PortAudio devices has changed. |
static void |
devicesChangedCallback()
Implements a callback which gets called by the native PortAudio counterpart to notify the Java counterpart that the list of PortAudio devices has changed. |
static long |
getPaSampleFormat(int sampleSizeInBits)
Gets the native PaSampleFormat with a specific size in bits. |
static double |
getSuggestedLatency()
Gets the suggested latency to be used when opening PortAudio streams. |
static void |
Pa_AbortStream(long stream)
Terminates audio processing immediately without waiting for pending buffers to complete. |
static void |
Pa_CloseStream(long stream)
Closes an audio stream. |
static int |
Pa_GetDefaultInputDevice()
Retrieve the index of the default input device. |
static int |
Pa_GetDefaultOutputDevice()
Retrieve the index of the default output device. |
static int |
Pa_GetDeviceCount()
Retrieve the number of available devices. |
static long |
Pa_GetDeviceInfo(int deviceIndex)
Retrieve a pointer to a PaDeviceInfo structure containing information about the specified device. |
static long |
Pa_GetHostApiInfo(int hostApiIndex)
Retrieve a pointer to a structure containing information about a specific host Api. |
static int |
Pa_GetSampleSize(long format)
Retrieve the size of a given sample format in bytes. |
static long |
Pa_GetStreamReadAvailable(long stream)
Retrieve the number of frames that can be read from the stream without waiting. |
static long |
Pa_GetStreamWriteAvailable(long stream)
Retrieve the number of frames that can be written to the stream without waiting. |
static boolean |
Pa_IsFormatSupported(long inputParameters,
long outputParameters,
double sampleRate)
Determine whether it would be possible to open a stream with the specified parameters. |
static long |
Pa_OpenStream(long inputParameters,
long outputParameters,
double sampleRate,
long framesPerBuffer,
long streamFlags,
PortAudioStreamCallback streamCallback)
Opens a stream for either input, output or both. |
static void |
Pa_ReadStream(long stream,
byte[] buffer,
long frames)
Read samples from an input stream. |
static void |
Pa_StartStream(long stream)
Commences audio processing. |
static void |
Pa_StopStream(long stream)
Terminates audio processing. |
static void |
Pa_UpdateAvailableDeviceList()
|
static void |
Pa_WriteStream(long stream,
byte[] buffer,
int offset,
long frames,
int numberOfWrites)
Writes samples to an output stream. |
static void |
Pa_WriteStream(long stream,
byte[] buffer,
long frames)
Write samples to an output stream. |
static double |
PaDeviceInfo_getDefaultHighInputLatency(long deviceInfo)
Returns defaultHighInputLatency for the device. |
static double |
PaDeviceInfo_getDefaultHighOutputLatency(long deviceInfo)
Returns defaultHighOutputLatency for the device. |
static double |
PaDeviceInfo_getDefaultLowInputLatency(long deviceInfo)
Returns defaultLowInputLatency for the device. |
static double |
PaDeviceInfo_getDefaultLowOutputLatency(long deviceInfo)
Returns defaultLowOutputLatency for the device. |
static double |
PaDeviceInfo_getDefaultSampleRate(long deviceInfo)
The default samplerate for the deviec. |
static int |
PaDeviceInfo_getHostApi(long deviceInfo)
The host api of the device. |
static int |
PaDeviceInfo_getMaxInputChannels(long deviceInfo)
Maximum input channels for the device. |
static int |
PaDeviceInfo_getMaxOutputChannels(long deviceInfo)
Maximum output channels for the device. |
static String |
PaDeviceInfo_getName(long deviceInfo)
Gets the human-readable name of the PaDeviceInfo specified by a pointer to it. |
static int |
PaHostApiInfo_getDefaultInputDevice(long hostApiInfo)
The default input device for this host API. |
static int |
PaHostApiInfo_getDefaultOutputDevice(long hostApiInfo)
The default output device for this host API. |
static int |
PaHostApiInfo_getDeviceCount(long hostApiInfo)
The number of devices belonging to this host API. |
static String |
PaHostApiInfo_getName(long hostApiInfo)
Deprecated. Presumes that the name of PaHostApiInfo is encoded in modified UTF-8 |
static int |
PaHostApiInfo_getType(long hostApiInfo)
The well known unique identifier of this host API. |
static void |
PaStreamParameters_free(long streamParameters)
Free StreamParameters resources specified by a pointer to it. |
static long |
PaStreamParameters_new(int deviceIndex,
int channelCount,
long sampleFormat,
double suggestedLatency)
Creates parameters used for opening streams. |
static void |
setDenoise(long stream,
boolean denoise)
Sets the indicator which determines whether a specific (input) PortAudio stream is to have denoise performed on the audio data it provides. |
static void |
setDevicesChangedCallback(Runnable devicesChangedCallback)
|
static void |
setEchoFilterLengthInMillis(long stream,
long echoFilterLengthInMillis)
Sets the number of milliseconds of echo to be canceled in the audio data provided by a specific (input) PortAudio stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_MILLIS_PER_BUFFER
public static final double DEFAULT_SAMPLE_RATE
public static final long FRAMES_PER_BUFFER_UNSPECIFIED
public static final double LATENCY_HIGH
public static final double LATENCY_LOW
public static final double LATENCY_UNSPECIFIED
public static final int paNoDevice
public static final long SAMPLE_FORMAT_FLOAT32
public static final long SAMPLE_FORMAT_INT8
public static final long SAMPLE_FORMAT_INT16
public static final long SAMPLE_FORMAT_INT24
public static final long SAMPLE_FORMAT_INT32
public static final long SAMPLE_FORMAT_UINT8
public static final long STREAM_FLAGS_CLIP_OFF
public static final long STREAM_FLAGS_DITHER_OFF
public static final long STREAM_FLAGS_NEVER_DROP_INPUT
public static final long STREAM_FLAGS_NO_FLAG
public static final long STREAM_FLAGS_PLATFORM_SPECIFIC_FLAGS
public static final long STREAM_FLAGS_PRIME_OUTPUT_BUFFERS_USING_STREAM_CALLBACK
| Method Detail |
|---|
public static long getPaSampleFormat(int sampleSizeInBits)
sampleSizeInBits - the size in bits of the native
PaSampleFormat to get
public static double getSuggestedLatency()
public static void Pa_AbortStream(long stream)
throws PortAudioException
stream - the steam pointer.
PortAudioException
public static void Pa_CloseStream(long stream)
throws PortAudioException
stream - the steam pointer.
PortAudioExceptionpublic static int Pa_GetDefaultInputDevice()
public static int Pa_GetDefaultOutputDevice()
public static int Pa_GetDeviceCount()
throws PortAudioException
PortAudioExceptionpublic static long Pa_GetDeviceInfo(int deviceIndex)
deviceIndex - the device index
public static long Pa_GetHostApiInfo(int hostApiIndex)
hostApiIndex - host api index.
public static int Pa_GetSampleSize(long format)
format - the format.
public static long Pa_GetStreamReadAvailable(long stream)
stream - pointer to the stream.
public static long Pa_GetStreamWriteAvailable(long stream)
stream - pointer to the stream.
public static boolean Pa_IsFormatSupported(long inputParameters,
long outputParameters,
double sampleRate)
inputParameters - A structure that describes the
input parameters used to open a stream.outputParameters - A structure that describes the output
parameters used to open a stream.sampleRate - The required sampleRate.
public static long Pa_OpenStream(long inputParameters,
long outputParameters,
double sampleRate,
long framesPerBuffer,
long streamFlags,
PortAudioStreamCallback streamCallback)
throws PortAudioException
inputParameters - the input params or 0 if absent.outputParameters - the ouput params or 0 if absent.sampleRate - The desired sampleRate.framesPerBuffer - The number of frames passed to the stream
callback function, or the preferred block granularity for
a blocking read/write streamstreamFlags - Flags which modify the
behaviour of the streaming process.streamCallback - A pointer to a client supplied function that is
responsible for processing and filling input and output buffers.
If this parameter is NULL the stream will be opened in
'blocking read/write' mode.
PortAudioException
public static void Pa_ReadStream(long stream,
byte[] buffer,
long frames)
throws PortAudioException
stream - pointer to the stream.buffer - a buffer of sample frames.frames - The number of frames to be read into buffer.
PortAudioException
public static void Pa_StartStream(long stream)
throws PortAudioException
stream - pointer to the stream
PortAudioException
public static void Pa_StopStream(long stream)
throws PortAudioException
stream - pointer to the stream
PortAudioExceptionpublic static void Pa_UpdateAvailableDeviceList()
public static void Pa_WriteStream(long stream,
byte[] buffer,
long frames)
throws PortAudioException
stream - pointer to the streambuffer - A buffer of sample frames.frames - The number of frames to be written from buffer.
PortAudioException
public static void Pa_WriteStream(long stream,
byte[] buffer,
int offset,
long frames,
int numberOfWrites)
throws PortAudioException
Provides better efficiency than achieved through multiple consecutive
calls to Pa_WriteStream(long, byte[], long) with one and the
same buffer because the JNI access to the bytes of the buffer which is
likely to copy the whole buffer is only performed once.
stream - the pointer to the PortAudio stream to write the samples tobuffer - the buffer containing the samples to be writtenoffset - the byte offset in buffer at which the samples to
be written startframes - the number of frames from buffer starting at
offset are to be written with a single writenumberOfWrites - the number of writes each writing frames
number of frames to be performed
PortAudioException - if anything goes wrong while writingpublic static String PaDeviceInfo_getName(long deviceInfo)
deviceInfo - the pointer to the PaDeviceInfo to get the
human-readable name of
public static double PaDeviceInfo_getDefaultHighInputLatency(long deviceInfo)
deviceInfo - device info pointer.
public static double PaDeviceInfo_getDefaultHighOutputLatency(long deviceInfo)
deviceInfo - device info pointer.
public static double PaDeviceInfo_getDefaultLowInputLatency(long deviceInfo)
deviceInfo - device info pointer.
public static double PaDeviceInfo_getDefaultLowOutputLatency(long deviceInfo)
deviceInfo - device info pointer.
public static double PaDeviceInfo_getDefaultSampleRate(long deviceInfo)
deviceInfo - device info pointer.
public static int PaDeviceInfo_getHostApi(long deviceInfo)
deviceInfo - device info pointer.
public static int PaDeviceInfo_getMaxInputChannels(long deviceInfo)
deviceInfo - device info pointer.
public static int PaDeviceInfo_getMaxOutputChannels(long deviceInfo)
deviceInfo - device info pointer.
public static int PaHostApiInfo_getDefaultInputDevice(long hostApiInfo)
hostApiInfo - pointer to host api info structure.
public static int PaHostApiInfo_getDefaultOutputDevice(long hostApiInfo)
hostApiInfo - pointer to host api info structure.
public static int PaHostApiInfo_getDeviceCount(long hostApiInfo)
hostApiInfo - pointer to host api info structure.
@Deprecated public static String PaHostApiInfo_getName(long hostApiInfo)
hostApiInfo - the pointer to the PaHostApiInfo to get the
human-readable name of
public static int PaHostApiInfo_getType(long hostApiInfo)
hostApiInfo - pointer to host api info structure.
public static void PaStreamParameters_free(long streamParameters)
streamParameters - the pointer to the PaStreamParameters
to free
public static long PaStreamParameters_new(int deviceIndex,
int channelCount,
long sampleFormat,
double suggestedLatency)
deviceIndex - the device.channelCount - the channels to be used.sampleFormat - the sample format.suggestedLatency - the suggested latency in milliseconds:
LATENCY_UNSPECIFIED -
use default(default high input/output latency)
LATENCY_HIGH - use default high input/output latency
LATENCY_LOW - use default low input/output latency
... - any other value in milliseconds (e.g. 0.1 is acceptable)
public static void setDenoise(long stream,
boolean denoise)
stream - the (input) PortAudio stream for which denoise is to be
enabled or disableddenoise - true if denoise is to be performed on the audio
data provided by stream; otherwise, false
public static void setEchoFilterLengthInMillis(long stream,
long echoFilterLengthInMillis)
stream - the (input) PortAudio stream for which the number of
milliseconds of echo to be canceled is to be setechoFilterLengthInMillis - the number of milliseconds of echo to be
canceled in the audio data provided by streampublic static void deviceChanged()
public static void devicesChangedCallback()
public static void setDevicesChangedCallback(Runnable devicesChangedCallback)
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||