Class Pa
- java.lang.Object
-
- org.jitsi.impl.neomedia.portaudio.Pa
-
public final class Pa extends Object
Provides the interface to the native PortAudio library.- Author:
- Lyubomir Marinov, Damian Minkov, Sebastien Vincent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPa.HostApiTypeIdEnumerates the unchanging unique identifiers of each of the supported host APIs.
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MILLIS_PER_BUFFERThe number of milliseconds to be read from or written to a native PortAudio stream in a single transfer of data.static doubleDEFAULT_SAMPLE_RATEThe 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 longFRAMES_PER_BUFFER_UNSPECIFIEDCan 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 doubleLATENCY_HIGHUsed when creating new stream parameters for suggested latency to use high input/output value.static doubleLATENCY_LOWUsed when creating new stream parameters for suggested latency to use low input/default value.static doubleLATENCY_UNSPECIFIEDUsed when creating new stream parameters for suggested latency to use default value.static intMMSYSERR_NODRIVERThe constant defined by Windows Multimedia and utilized by PortAudio's wmme host API to signal that no device driver is present.static intpaNoDeviceThe constant defined by the native PortAudio library to signal that no device is specified.static intpaNoErrorThe PaErrorCode value defined by the native PortAudio library to signal that no error is detected/reported.static intpaTimedOutThe PaErrorCode value defined by the native PortAudio library to signal that a timeout has occurred.static intpaUnanticipatedHostErrorThe PaErrorCode value defined by the native PortAudio library to signal that an unanticipated error has been detected by a host API.static longSAMPLE_FORMAT_FLOAT32A type used to specify one or more sample formats.static longSAMPLE_FORMAT_INT16A type used to specify one or more sample formats.static longSAMPLE_FORMAT_INT24A type used to specify one or more sample formats.static longSAMPLE_FORMAT_INT32A type used to specify one or more sample formats.static longSAMPLE_FORMAT_INT8A type used to specify one or more sample formats.static longSAMPLE_FORMAT_UINT8A type used to specify one or more sample formats.static longSTREAM_FLAGS_CLIP_OFFDisables default clipping of out of range samples.static longSTREAM_FLAGS_DITHER_OFFDisables default dithering.static longSTREAM_FLAGS_NEVER_DROP_INPUTFlag requests that where possible a full duplex stream will not discard overflowed input samples without calling the stream callback.static longSTREAM_FLAGS_NO_FLAGFlags used to control the behavior of a stream.static longSTREAM_FLAGS_PLATFORM_SPECIFIC_FLAGSA mask specifying the platform specific bits.static longSTREAM_FLAGS_PRIME_OUTPUT_BUFFERS_USING_STREAM_CALLBACKCall the stream callback to fill initial output buffers, rather than the default behavior of priming the buffers with zeros (silence).
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidAbortStream(long stream)Terminates audio processing immediately without waiting for pending buffers to complete.static voidCloseStream(long stream)Closes an audio stream.static doubleDeviceInfo_getDefaultHighInputLatency(long deviceInfo)Returns defaultHighInputLatency for the device.static doubleDeviceInfo_getDefaultHighOutputLatency(long deviceInfo)Returns defaultHighOutputLatency for the device.static doubleDeviceInfo_getDefaultLowInputLatency(long deviceInfo)Returns defaultLowInputLatency for the device.static doubleDeviceInfo_getDefaultLowOutputLatency(long deviceInfo)Returns defaultLowOutputLatency for the device.static doubleDeviceInfo_getDefaultSampleRate(long deviceInfo)The default sample rate for the device.static StringDeviceInfo_getDeviceUID(long deviceInfo)Device UID for the device (persistent across boots).static byte[]DeviceInfo_getDeviceUIDBytes(long deviceInfo)Device UID for the device (persistent across boots).static intDeviceInfo_getHostApi(long deviceInfo)The host api of the device.static intDeviceInfo_getMaxInputChannels(long deviceInfo)Maximum input channels for the device.static intDeviceInfo_getMaxOutputChannels(long deviceInfo)Maximum output channels for the device.static StringDeviceInfo_getName(long deviceInfo)Gets the human-readable name of the PaDeviceInfo specified by a pointer to it.static StringDeviceInfo_getTransportType(long deviceInfo)Transport type for the device: BuiltIn, USB, BLuetooth, etc.static byte[]DeviceInfo_getTransportTypeBytes(long deviceInfo)Transport type for the device: BuiltIn, USB, BLuetooth, etc.static voiddevicesChangedCallback()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 intGetDefaultInputDevice()Retrieve the index of the default input device.static intGetDefaultOutputDevice()Retrieve the index of the default output device.static intGetDeviceCount()Retrieve the number of available devices.static intgetDeviceIndex(String deviceID, int minInputChannels, int minOutputChannels)Returns the PortAudio index of the device identified by a specific deviceID orpaNoDeviceif no such device exists.static longGetDeviceInfo(int deviceIndex)Retrieve a pointer to a PaDeviceInfo structure containing information about the specified device.static longGetHostApiInfo(int hostApiIndex)Retrieve a pointer to a structure containing information about a specific host Api.static longgetPaSampleFormat(int sampleSizeInBits)Gets the native PaSampleFormat with a specific size in bits.static intGetSampleSize(long format)Retrieve the size of a given sample format in bytes.static longGetStreamReadAvailable(long stream)Retrieve the number of frames that can be read from the stream without waiting.static longGetStreamWriteAvailable(long stream)Retrieve the number of frames that can be written to the stream without waiting.static doublegetSuggestedLatency()Gets the suggested latency to be used when opening PortAudio streams.static intHostApiInfo_getDefaultInputDevice(long hostApiInfo)The default input device for this host API.static intHostApiInfo_getDefaultOutputDevice(long hostApiInfo)The default output device for this host API.static intHostApiInfo_getDeviceCount(long hostApiInfo)The number of devices belonging to this host API.static intHostApiInfo_getType(long hostApiInfo)The well known unique identifier of this host API.static booleanIsFormatSupported(long inputParameters, long outputParameters, double sampleRate)Determine whether it would be possible to open a stream with the specified parameters.static longOpenStream(long inputParameters, long outputParameters, double sampleRate, long framesPerBuffer, long streamFlags, PortAudioStreamCallback streamCallback)Opens a stream for either input, output or both.static voidReadStream(long stream, byte[] buffer, long frames)Read samples from an input stream.static voidsetDenoise(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 voidsetDevicesChangedCallback(Runnable devicesChangedCallback)static voidsetEchoFilterLengthInMillis(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.static voidStartStream(long stream)Commences audio processing.static voidStopStream(long stream)Terminates audio processing.static voidStreamParameters_free(long streamParameters)Free StreamParameters resources specified by a pointer to it.static longStreamParameters_new(int deviceIndex, int channelCount, long sampleFormat, double suggestedLatency)Creates parameters used for opening streams.static voidUpdateAvailableDeviceList()static voidWriteStream(long stream, byte[] buffer, int offset, long frames, int numberOfWrites)Writes samples to an output stream.static voidWriteStream(long stream, byte[] buffer, long frames)Write samples to an output stream.
-
-
-
Field Detail
-
DEFAULT_MILLIS_PER_BUFFER
public static final 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.- See Also:
- Constant Field Values
-
DEFAULT_SAMPLE_RATE
public static final 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.- See Also:
- Constant Field Values
-
FRAMES_PER_BUFFER_UNSPECIFIED
public static final 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.- See Also:
- Constant Field Values
-
LATENCY_HIGH
public static final double LATENCY_HIGH
Used when creating new stream parameters for suggested latency to use high input/output value.- See Also:
- Constant Field Values
-
LATENCY_LOW
public static final double LATENCY_LOW
Used when creating new stream parameters for suggested latency to use low input/default value.- See Also:
- Constant Field Values
-
LATENCY_UNSPECIFIED
public static final double LATENCY_UNSPECIFIED
Used when creating new stream parameters for suggested latency to use default value.- See Also:
- Constant Field Values
-
MMSYSERR_NODRIVER
public static final int MMSYSERR_NODRIVER
The constant defined by Windows Multimedia and utilized by PortAudio's wmme host API to signal that no device driver is present.- See Also:
- Constant Field Values
-
paNoDevice
public static final int paNoDevice
The constant defined by the native PortAudio library to signal that no device is specified.- See Also:
- Constant Field Values
-
paNoError
public static final int paNoError
The PaErrorCode value defined by the native PortAudio library to signal that no error is detected/reported.- See Also:
- Constant Field Values
-
paTimedOut
public static final int paTimedOut
The PaErrorCode value defined by the native PortAudio library to signal that a timeout has occurred.- See Also:
- Constant Field Values
-
paUnanticipatedHostError
public static final int paUnanticipatedHostError
The PaErrorCode value defined by the native PortAudio library to signal that an unanticipated error has been detected by a host API.- See Also:
- Constant Field Values
-
SAMPLE_FORMAT_FLOAT32
public static final long SAMPLE_FORMAT_FLOAT32
A type used to specify one or more sample formats. The standard format paFloat32.- See Also:
- Constant Field Values
-
SAMPLE_FORMAT_INT16
public static final long SAMPLE_FORMAT_INT16
A type used to specify one or more sample formats. The standard format paInt16.- See Also:
- Constant Field Values
-
SAMPLE_FORMAT_INT24
public static final long SAMPLE_FORMAT_INT24
A type used to specify one or more sample formats. The standard format paInt24.- See Also:
- Constant Field Values
-
SAMPLE_FORMAT_INT32
public static final long SAMPLE_FORMAT_INT32
A type used to specify one or more sample formats. The standard format paInt32.- See Also:
- Constant Field Values
-
SAMPLE_FORMAT_INT8
public static final long SAMPLE_FORMAT_INT8
A type used to specify one or more sample formats. The standard format paInt8.- See Also:
- Constant Field Values
-
SAMPLE_FORMAT_UINT8
public static final long SAMPLE_FORMAT_UINT8
A type used to specify one or more sample formats. The standard format paUInt8.- See Also:
- Constant Field Values
-
STREAM_FLAGS_CLIP_OFF
public static final long STREAM_FLAGS_CLIP_OFF
Disables default clipping of out of range samples.- See Also:
- Constant Field Values
-
STREAM_FLAGS_DITHER_OFF
public static final long STREAM_FLAGS_DITHER_OFF
Disables default dithering.- See Also:
- Constant Field Values
-
STREAM_FLAGS_NEVER_DROP_INPUT
public static final 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. This flag is only valid for full duplex callback streams and only when used in combination with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using this flag incorrectly results in a paInvalidFlag error being returned from Pa_OpenStream and Pa_OpenDefaultStream.- See Also:
- Constant Field Values
-
STREAM_FLAGS_NO_FLAG
public static final long STREAM_FLAGS_NO_FLAG
Flags used to control the behavior of a stream. They are passed as parameters to Pa_OpenStream or Pa_OpenDefaultStream.- See Also:
- Constant Field Values
-
STREAM_FLAGS_PLATFORM_SPECIFIC_FLAGS
public static final long STREAM_FLAGS_PLATFORM_SPECIFIC_FLAGS
A mask specifying the platform specific bits.- See Also:
- Constant Field Values
-
STREAM_FLAGS_PRIME_OUTPUT_BUFFERS_USING_STREAM_CALLBACK
public static final 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). This flag has no effect for input-only and blocking read/write streams.- See Also:
- Constant Field Values
-
-
Method Detail
-
AbortStream
public static void AbortStream(long stream) throws PortAudioExceptionTerminates audio processing immediately without waiting for pending buffers to complete.- Parameters:
stream- the steam pointer.- Throws:
PortAudioException
-
CloseStream
public static void CloseStream(long stream) throws PortAudioExceptionCloses an audio stream. If the audio stream is active it discards any pending buffers as if Pa_AbortStream() had been called.- Parameters:
stream- the steam pointer.- Throws:
PortAudioException
-
DeviceInfo_getDefaultHighInputLatency
public static double DeviceInfo_getDefaultHighInputLatency(long deviceInfo)
Returns defaultHighInputLatency for the device.- Parameters:
deviceInfo- device info pointer.- Returns:
- defaultHighInputLatency for the device.
-
DeviceInfo_getDefaultHighOutputLatency
public static double DeviceInfo_getDefaultHighOutputLatency(long deviceInfo)
Returns defaultHighOutputLatency for the device.- Parameters:
deviceInfo- device info pointer.- Returns:
- defaultHighOutputLatency for the device.
-
DeviceInfo_getDefaultLowInputLatency
public static double DeviceInfo_getDefaultLowInputLatency(long deviceInfo)
Returns defaultLowInputLatency for the device.- Parameters:
deviceInfo- device info pointer.- Returns:
- defaultLowInputLatency for the device.
-
DeviceInfo_getDefaultLowOutputLatency
public static double DeviceInfo_getDefaultLowOutputLatency(long deviceInfo)
Returns defaultLowOutputLatency for the device.- Parameters:
deviceInfo- device info pointer.- Returns:
- defaultLowOutputLatency for the device.
-
DeviceInfo_getDefaultSampleRate
public static double DeviceInfo_getDefaultSampleRate(long deviceInfo)
The default sample rate for the device.- Parameters:
deviceInfo- device info pointer.- Returns:
- the default sample rate for the device.
-
DeviceInfo_getDeviceUID
public static String DeviceInfo_getDeviceUID(long deviceInfo)
Device UID for the device (persistent across boots).- Parameters:
deviceInfo- device info pointer.- Returns:
- The device UID.
-
DeviceInfo_getDeviceUIDBytes
public static byte[] DeviceInfo_getDeviceUIDBytes(long deviceInfo)
Device UID for the device (persistent across boots).- Parameters:
deviceInfo- device info pointer.- Returns:
- The device UID.
-
DeviceInfo_getHostApi
public static int DeviceInfo_getHostApi(long deviceInfo)
The host api of the device.- Parameters:
deviceInfo- device info pointer.- Returns:
- The host api of the device.
-
DeviceInfo_getMaxInputChannels
public static int DeviceInfo_getMaxInputChannels(long deviceInfo)
Maximum input channels for the device.- Parameters:
deviceInfo- device info pointer.- Returns:
- Maximum input channels for the device.
-
DeviceInfo_getMaxOutputChannels
public static int DeviceInfo_getMaxOutputChannels(long deviceInfo)
Maximum output channels for the device.- Parameters:
deviceInfo- device info pointer.- Returns:
- Maximum output channels for the device.
-
DeviceInfo_getName
public static String DeviceInfo_getName(long deviceInfo)
Gets the human-readable name of the PaDeviceInfo specified by a pointer to it.- Parameters:
deviceInfo- the pointer to the PaDeviceInfo to get the human-readable name of- Returns:
- the human-readable name of the PaDeviceInfo pointed to by deviceInfo
-
DeviceInfo_getTransportType
public static String DeviceInfo_getTransportType(long deviceInfo)
Transport type for the device: BuiltIn, USB, BLuetooth, etc.- Parameters:
deviceInfo- device info pointer.- Returns:
- The transport type identifier.
-
DeviceInfo_getTransportTypeBytes
public static byte[] DeviceInfo_getTransportTypeBytes(long deviceInfo)
Transport type for the device: BuiltIn, USB, BLuetooth, etc.- Parameters:
deviceInfo- device info pointer.- Returns:
- The transport type identifier.
-
devicesChangedCallback
public 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.
-
GetDefaultInputDevice
public static int GetDefaultInputDevice()
Retrieve the index of the default input device.- Returns:
- The default input device index for the default host API, or paNoDevice if no default input device is available or an error was encountered.
-
GetDefaultOutputDevice
public static int GetDefaultOutputDevice()
Retrieve the index of the default output device.- Returns:
- The default input device index for the default host API, or paNoDevice if no default input device is available or an error was encountered.
-
GetDeviceCount
public static int GetDeviceCount() throws PortAudioExceptionRetrieve the number of available devices. The number of available devices may be zero.- Returns:
- the number of devices.
- Throws:
PortAudioException
-
getDeviceIndex
public static int getDeviceIndex(String deviceID, int minInputChannels, int minOutputChannels)
Returns the PortAudio index of the device identified by a specific deviceID orpaNoDeviceif no such device exists. The deviceID is either a deviceUID or a (PortAudio device) name depending, for example, on operating system/API availability. Since at least names may not be unique, the PortAudio device to return the index of may be identified more specifically by the minimal numbers of channels to be required from the device for input and output.- Parameters:
deviceID- a String identifying the PortAudio device to retrieve the index of. It is either a deviceUID or a (PortAudio device) name.minInputChannels-minOutputChannels-- Returns:
- the PortAudio index of the device identified by the specified deviceID or Pa.paNoDevice if no such device exists
-
GetDeviceInfo
public static long GetDeviceInfo(int deviceIndex)
Retrieve a pointer to a PaDeviceInfo structure containing information about the specified device.- Parameters:
deviceIndex- the device index- Returns:
- pointer to device info structure.
-
GetHostApiInfo
public static long GetHostApiInfo(int hostApiIndex)
Retrieve a pointer to a structure containing information about a specific host Api.- Parameters:
hostApiIndex- host api index.- Returns:
- A pointer to an immutable PaHostApiInfo structure describing a specific host API.
-
getPaSampleFormat
public static long getPaSampleFormat(int sampleSizeInBits)
Gets the native PaSampleFormat with a specific size in bits.- Parameters:
sampleSizeInBits- the size in bits of the native PaSampleFormat to get- Returns:
- the native PaSampleFormat with the specified size in bits
-
GetSampleSize
public static int GetSampleSize(long format)
Retrieve the size of a given sample format in bytes.- Parameters:
format- the format.- Returns:
- The size in bytes of a single sample in the specified format, or paSampleFormatNotSupported if the format is not supported.
-
GetStreamReadAvailable
public static long GetStreamReadAvailable(long stream)
Retrieve the number of frames that can be read from the stream without waiting.- Parameters:
stream- pointer to the stream.- Returns:
- returns a non-negative value representing the maximum number of frames that can be read from the stream without blocking or busy waiting or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered.
-
GetStreamWriteAvailable
public static long GetStreamWriteAvailable(long stream)
Retrieve the number of frames that can be written to the stream without waiting.- Parameters:
stream- pointer to the stream.- Returns:
- returns a non-negative value representing the maximum number of frames that can be written to the stream without blocking or busy waiting or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered.
-
getSuggestedLatency
public static double getSuggestedLatency()
Gets the suggested latency to be used when opening PortAudio streams.- Returns:
- the suggested latency to be used when opening PortAudio streams
-
HostApiInfo_getDefaultInputDevice
public static int HostApiInfo_getDefaultInputDevice(long hostApiInfo)
The default input device for this host API.- Parameters:
hostApiInfo- pointer to host API info structure.- Returns:
- The default input device for this host API.
-
HostApiInfo_getDefaultOutputDevice
public static int HostApiInfo_getDefaultOutputDevice(long hostApiInfo)
The default output device for this host API.- Parameters:
hostApiInfo- pointer to host API info structure.- Returns:
- The default output device for this host API.
-
HostApiInfo_getDeviceCount
public static int HostApiInfo_getDeviceCount(long hostApiInfo)
The number of devices belonging to this host API.- Parameters:
hostApiInfo- pointer to host API info structure.- Returns:
- The number of devices belonging to this host API.
-
HostApiInfo_getType
public static int HostApiInfo_getType(long hostApiInfo)
The well known unique identifier of this host API.- Parameters:
hostApiInfo- pointer to host API info structure.- Returns:
- The well known unique identifier of this host API. Enumerator: paInDevelopment paDirectSound paMME paASIO paSoundManager paCoreAudio paOSS paALSA paAL paBeOS paWDMKS paJACK paWASAPI paAudioScienceHPI
-
IsFormatSupported
public static boolean IsFormatSupported(long inputParameters, long outputParameters, double sampleRate)Determine whether it would be possible to open a stream with the specified parameters.- Parameters:
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.- Returns:
- returns 0 if the format is supported, and an error code indicating why the format is not supported otherwise. The constant paFormatIsSupported is provided to compare with the return value for success.
-
OpenStream
public static long OpenStream(long inputParameters, long outputParameters, double sampleRate, long framesPerBuffer, long streamFlags, PortAudioStreamCallback streamCallback) throws PortAudioExceptionOpens a stream for either input, output or both.- Parameters:
inputParameters- the input parameters or 0 if absent.outputParameters- the output parameters 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 behavior of the streaming process.streamCallback- A pointer to a client supplied function that is responsible for processing and filling input and output buffers. If null, the stream will be opened in 'blocking read/write' mode.- Returns:
- pointer to the opened stream.
- Throws:
PortAudioException
-
ReadStream
public static void ReadStream(long stream, byte[] buffer, long frames) throws PortAudioExceptionRead samples from an input stream. The function doesn't return until the entire buffer has been filled - this may involve waiting for the operating system to supply the data.- Parameters:
stream- pointer to the stream.buffer- a buffer of sample frames.frames- The number of frames to be read into buffer.- Throws:
PortAudioException
-
setDenoise
public 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.- Parameters:
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
-
setDevicesChangedCallback
public static void setDevicesChangedCallback(Runnable devicesChangedCallback)
-
setEchoFilterLengthInMillis
public 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.- Parameters:
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 stream
-
StartStream
public static void StartStream(long stream) throws PortAudioExceptionCommences audio processing.- Parameters:
stream- pointer to the stream- Throws:
PortAudioException
-
StopStream
public static void StopStream(long stream) throws PortAudioExceptionTerminates audio processing. It waits until all pending audio buffers have been played before it returns.- Parameters:
stream- pointer to the stream- Throws:
PortAudioException
-
StreamParameters_free
public static void StreamParameters_free(long streamParameters)
Free StreamParameters resources specified by a pointer to it.- Parameters:
streamParameters- the pointer to the PaStreamParameters to free
-
StreamParameters_new
public static long StreamParameters_new(int deviceIndex, int channelCount, long sampleFormat, double suggestedLatency)Creates parameters used for opening streams.- Parameters:
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)- Returns:
- pointer to the params used for Pa_OpenStream.
-
UpdateAvailableDeviceList
public static void UpdateAvailableDeviceList()
-
WriteStream
public static void WriteStream(long stream, byte[] buffer, int offset, long frames, int numberOfWrites) throws PortAudioExceptionWrites samples to an output stream. Does not return until the specified samples have been consumed - this may involve waiting for the operating system to consume the data.Provides better efficiency than achieved through multiple consecutive calls to
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.- Parameters:
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- Throws:
PortAudioException- if anything goes wrong while writing
-
WriteStream
public static void WriteStream(long stream, byte[] buffer, long frames) throws PortAudioExceptionWrite samples to an output stream. This function doesn't return until the entire buffer has been consumed - this may involve waiting for the operating system to consume the data.- Parameters:
stream- pointer to the streambuffer- A buffer of sample frames.frames- The number of frames to be written from buffer.- Throws:
PortAudioException
-
-