PortAudio: com.portaudio.PortAudio Class Reference

PortAudio 2.0

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Static Public Member Functions | Static Public Attributes
com.portaudio.PortAudio Class Reference

## Static Public Member Functions
static native int | getVersion ()
static native String | getVersionText ()
static native void | initialize ()
static native void | terminate ()
static native int | getDeviceCount ()
static DeviceInfo | getDeviceInfo (int index)
static native int | getHostApiCount ()
static HostApiInfo | getHostApiInfo (int index)
static native int | hostApiTypeIdToHostApiIndex (int hostApiType)
static native int | hostApiDeviceIndexToDeviceIndex (int hostApiIndex, int apiDeviceIndex)
static native int | getDefaultInputDevice ()
static native int | getDefaultOutputDevice ()
static native int | getDefaultHostApi ()
static native int | isFormatSupported (StreamParameters inputStreamParameters, StreamParameters outputStreamParameters, int sampleRate)
static BlockingStream | openStream (StreamParameters inputStreamParameters, StreamParameters outputStreamParameters, int sampleRate, int framesPerBuffer, int flags)

## Static Public Attributes
static final int | FLAG_CLIP_OFF = (1 << 0)
static final int | FLAG_DITHER_OFF = (1 << 1)
static final int | FORMAT_FLOAT_32 = (1 << 0)
static final int | FORMAT_INT_32 = (1 << 1)
static final int | FORMAT_INT_24 = (1 << 2)
static final int | FORMAT_INT_16 = (1 << 3)
static final int | FORMAT_INT_8 = (1 << 4)
static final int | FORMAT_UINT_8 = (1 << 5)
static final int | HOST_API_TYPE_DEV = 0
static final int | HOST_API_TYPE_DIRECTSOUND = 1
static final int | HOST_API_TYPE_MME = 2
static final int | HOST_API_TYPE_ASIO = 3
static final int | HOST_API_TYPE_SOUNDMANAGER = 4
static final int | HOST_API_TYPE_COREAUDIO = 5
static final int | HOST_API_TYPE_OSS = 7
static final int | HOST_API_TYPE_ALSA = 8
static final int | HOST_API_TYPE_AL = 9
static final int | HOST_API_TYPE_BEOS = 10
static final int | HOST_API_TYPE_WDMKS = 11
static final int | HOST_API_TYPE_JACK = 12
static final int | HOST_API_TYPE_WASAPI = 13
static final int | HOST_API_TYPE_AUDIOSCIENCE = 14
static final int | HOST_API_TYPE_COUNT = 15

## Detailed Description

Java methods that call PortAudio via JNI. This is a portable audio I/O library that can be used as an alternative to JavaSound.

Please see the PortAudio documentation for a full explanation.

http://portaudio.com/docs/ http://portaudio.com/docs/v19-doxydocs/portaudio_8h.html

This Java binding does not support audio callbacks because an audio callback should never block. Calling into a Java virtual machine might block for garbage collection or synchronization. So only the blocking read/write mode is supported.

See Also
  BlockingStream
  DeviceInfo
  HostApiInfo
  StreamInfo
  StreamParameters

Author
  Phil Burk

Definition at line 69 of file PortAudio.java.

## Member Function Documentation

static native int com.portaudio.PortAudio.getDeviceCount | ( |  | ) |
| static

Returns
  the number of available devices. The number of available devices may be zero.

static DeviceInfo com.portaudio.PortAudio.getDeviceInfo | ( | int | index | ) |
| inlinestatic

Parameters

  index | A valid device index in the range 0 to (getDeviceCount()-1)

Returns
  An DeviceInfo structure.

Exceptions

  RuntimeException | if the device parameter is out of range.

Definition at line 169 of file PortAudio.java.

static native int com.portaudio.PortAudio.getHostApiCount | ( |  | ) |
| static

Returns
  the number of available host APIs.

static HostApiInfo com.portaudio.PortAudio.getHostApiInfo | ( | int | index | ) |
| inlinestatic

Parameters

  index |

Returns
  information about the Host API

Definition at line 188 of file PortAudio.java.

static native int com.portaudio.PortAudio.getVersion | ( |  | ) |
| static

Returns
  the release number of the currently running PortAudio build, eg 1900.

static native String com.portaudio.PortAudio.getVersionText | ( |  | ) |
| static

Returns
  a textual description of the current PortAudio build, eg "PortAudio V19-devel 13 October 2002".

static native int com.portaudio.PortAudio.hostApiDeviceIndexToDeviceIndex | ( | int | hostApiIndex,
|  | int | apiDeviceIndex
| ) |  |
| static

Parameters

  hostApiIndex | A valid host API index ranging from 0 to (getHostApiCount()-1)
  apiDeviceIndex | A valid per-host device index in the range 0 to (getHostApiInfo(hostApi).deviceCount-1)

Returns
  standard PortAudio device index

static native int com.portaudio.PortAudio.hostApiTypeIdToHostApiIndex | ( | int | hostApiType | ) |
| static

Parameters

  hostApiType | A unique host API identifier, for example HOST_API_TYPE_COREAUDIO.

Returns
  a runtime host API index

static native void com.portaudio.PortAudio.initialize | ( |  | ) |
| static

Library initialization function - call this before using PortAudio. This function initializes internal data structures and prepares underlying host APIs for use. With the exception of getVersion(), getVersionText(), and getErrorText(), this function MUST be called before using any other PortAudio API functions.

Referenced by com.portaudio.PlaySine.play().

static native int com.portaudio.PortAudio.isFormatSupported | ( | StreamParameters | inputStreamParameters,
|  | StreamParameters | outputStreamParameters,
|  | int | sampleRate
| ) |  |
| static

Parameters

  inputStreamParameters | input description, may be null
  outputStreamParameters | output description, may be null
  sampleRate | typically 44100 or 48000, or maybe 22050, 16000, 8000, 96000

Returns
  0 if supported or a negative error

static BlockingStream com.portaudio.PortAudio.openStream | ( | StreamParameters | inputStreamParameters,
|  | StreamParameters | outputStreamParameters,
|  | int | sampleRate,
|  | int | framesPerBuffer,
|  | int | flags
| ) |  |
| inlinestatic

Parameters

  inputStreamParameters | input description, may be null
  outputStreamParameters | output description, may be null
  sampleRate | typically 44100 or 48000, or maybe 22050, 16000, 8000, 96000
  framesPerBuffer |
  flags |

Returns

Definition at line 250 of file PortAudio.java.

static native void com.portaudio.PortAudio.terminate | ( |  | ) |
| static

Library termination function - call this when finished using PortAudio. This function deallocates all resources allocated by PortAudio since it was initialized by a call to initialize(). In cases where Pa_Initialise() has been called multiple times, each call must be matched with a corresponding call to terminate(). The final matching call to terminate() will automatically close any PortAudio streams that are still open.

Referenced by com.portaudio.PlaySine.play().

## Field Documentation

final int com.portaudio.PortAudio.FORMAT_FLOAT_32 = (1 << 0)
| static

Sample Formats

Definition at line 75 of file PortAudio.java.

Referenced by com.portaudio.BlockingStream.read(), and com.portaudio.BlockingStream.write().

final int com.portaudio.PortAudio.HOST_API_TYPE_DEV = 0
| static

These HOST_API_TYPES will not change in the future.

Definition at line 83 of file PortAudio.java.

final int com.portaudio.PortAudio.HOST_API_TYPE_SOUNDMANAGER = 4
| static

Apple Sound Manager. Obsolete.

Definition at line 88 of file PortAudio.java.

The documentation for this class was generated from the following file:

- PortAudio.java