Julius 4.2
データ構造 | マクロ定義 | 型定義 | 列挙型 | 関数
msvc/portaudio/portaudio.h

The PortAudio API. [詳細]

ソースコードを見る。

データ構造

struct  PaHostApiInfo
 A structure containing information about a particular host API. [詳細]
struct  PaHostErrorInfo
 Structure used to return information about a host error condition. [詳細]
struct  PaDeviceInfo
 A structure providing information and capabilities of PortAudio devices. [詳細]
struct  PaStreamParameters
 Parameters for one direction (input or output) of a stream. [詳細]
struct  PaStreamCallbackTimeInfo
 Timing information for the buffers passed to the stream callback. [詳細]
struct  PaStreamInfo
 A structure containing unchanging information about an open stream. [詳細]

マクロ定義

#define paNoDevice   ((PaDeviceIndex)-1)
 A special PaDeviceIndex value indicating that no device is available, or should be used.
#define paUseHostApiSpecificDeviceSpecification   ((PaDeviceIndex)-2)
 A special PaDeviceIndex value indicating that the device(s) to be used are specified in the host api specific stream info structure.
#define paFloat32   ((PaSampleFormat) 0x00000001)
#define paInt32   ((PaSampleFormat) 0x00000002)
#define paInt24   ((PaSampleFormat) 0x00000004)
 Packed 24 bit format.
#define paInt16   ((PaSampleFormat) 0x00000008)
#define paInt8   ((PaSampleFormat) 0x00000010)
#define paUInt8   ((PaSampleFormat) 0x00000020)
#define paCustomFormat   ((PaSampleFormat) 0x00010000)
#define paNonInterleaved   ((PaSampleFormat) 0x80000000)
#define paFormatIsSupported   (0)
 Return code for Pa_IsFormatSupported indicating success.
#define paFramesPerBufferUnspecified   (0)
 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.
#define paNoFlag   ((PaStreamFlags) 0)
#define paClipOff   ((PaStreamFlags) 0x00000001)
 Disable default clipping of out of range samples.
#define paDitherOff   ((PaStreamFlags) 0x00000002)
 Disable default dithering.
#define paNeverDropInput   ((PaStreamFlags) 0x00000004)
 Flag requests that where possible a full duplex stream will not discard overflowed input samples without calling the stream callback.
#define paPrimeOutputBuffersUsingStreamCallback   ((PaStreamFlags) 0x00000008)
 Call the stream callback to fill initial output buffers, rather than the default behavior of priming the buffers with zeros (silence).
#define paPlatformSpecificFlags   ((PaStreamFlags)0xFFFF0000)
 A mask specifying the platform specific bits.
#define paInputUnderflow   ((PaStreamCallbackFlags) 0x00000001)
 In a stream opened with paFramesPerBufferUnspecified, indicates that input data is all silence (zeros) because no real data is available.
#define paInputOverflow   ((PaStreamCallbackFlags) 0x00000002)
 In a stream opened with paFramesPerBufferUnspecified, indicates that data prior to the first sample of the input buffer was discarded due to an overflow, possibly because the stream callback is using too much CPU time.
#define paOutputUnderflow   ((PaStreamCallbackFlags) 0x00000004)
 Indicates that output data (or a gap) was inserted, possibly because the stream callback is using too much CPU time.
#define paOutputOverflow   ((PaStreamCallbackFlags) 0x00000008)
 Indicates that output data will be discarded because no room is available.
#define paPrimingOutput   ((PaStreamCallbackFlags) 0x00000010)
 Some of all of the output data will be used to prime the stream, input data may be zero.

型定義

typedef int PaError
 Error codes returned by PortAudio functions.
typedef int PaDeviceIndex
 The type used to refer to audio devices.
typedef int PaHostApiIndex
 The type used to enumerate to host APIs at runtime.
typedef double PaTime
 The type used to represent monotonic time in seconds that can be used for syncronisation.
typedef unsigned long PaSampleFormat
 A type used to specify one or more sample formats.
typedef void PaStream
 A single PaStream can provide multiple channels of real-time streaming audio input and output to a client application.
typedef unsigned long PaStreamFlags
 Flags used to control the behavior of a stream.
typedef unsigned long PaStreamCallbackFlags
 Flag bit constants for the statusFlags to PaStreamCallback.
typedef int PaStreamCallback (const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
 Functions of type PaStreamCallback are implemented by PortAudio clients.
typedef void PaStreamFinishedCallback (void *userData)
 Functions of type PaStreamFinishedCallback are implemented by PortAudio clients.

列挙型

enum  PaErrorCode {
  paNoError = 0, paNotInitialized = -10000, paUnanticipatedHostError, paInvalidChannelCount,
  paInvalidSampleRate, paInvalidDevice, paInvalidFlag, paSampleFormatNotSupported,
  paBadIODeviceCombination, paInsufficientMemory, paBufferTooBig, paBufferTooSmall,
  paNullCallback, paBadStreamPtr, paTimedOut, paInternalError,
  paDeviceUnavailable, paIncompatibleHostApiSpecificStreamInfo, paStreamIsStopped, paStreamIsNotStopped,
  paInputOverflowed, paOutputUnderflowed, paHostApiNotFound, paInvalidHostApi,
  paCanNotReadFromACallbackStream, paCanNotWriteToACallbackStream, paCanNotReadFromAnOutputOnlyStream, paCanNotWriteToAnInputOnlyStream,
  paIncompatibleStreamHostApi, paBadBufferPtr
}
enum  PaHostApiTypeId {
  paInDevelopment = 0, paDirectSound = 1, paMME = 2, paASIO = 3,
  paSoundManager = 4, paCoreAudio = 5, paOSS = 7, paALSA = 8,
  paAL = 9, paBeOS = 10, paWDMKS = 11, paJACK = 12,
  paWASAPI = 13, paAudioScienceHPI = 14
}
 Unchanging unique identifiers for each supported host API. [詳細]
enum  PaStreamCallbackResult { paContinue = 0, paComplete = 1, paAbort = 2 }
 Allowable return values for the PaStreamCallback. [詳細]

関数

int Pa_GetVersion (void)
 Retrieve the release number of the currently running PortAudio build, eg 1900.
const char * Pa_GetVersionText (void)
 Retrieve a textual description of the current PortAudio build, eg "PortAudio V19-devel 13 October 2002".
const char * Pa_GetErrorText (PaError errorCode)
 Translate the supplied PortAudio error code into a human readable message.
PaError Pa_Initialize (void)
 Library initialization function - call this before using PortAudio.
PaError Pa_Terminate (void)
 Library termination function - call this when finished using PortAudio.
PaHostApiIndex Pa_GetHostApiCount (void)
 Retrieve the number of available host APIs.
PaHostApiIndex Pa_GetDefaultHostApi (void)
 Retrieve the index of the default host API.
const PaHostApiInfoPa_GetHostApiInfo (PaHostApiIndex hostApi)
 Retrieve a pointer to a structure containing information about a specific host Api.
PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex (PaHostApiTypeId type)
 Convert a static host API unique identifier, into a runtime host API index.
PaDeviceIndex Pa_HostApiDeviceIndexToDeviceIndex (PaHostApiIndex hostApi, int hostApiDeviceIndex)
 Convert a host-API-specific device index to standard PortAudio device index.
const PaHostErrorInfoPa_GetLastHostErrorInfo (void)
 Return information about the last host error encountered.
PaDeviceIndex Pa_GetDeviceCount (void)
 Retrieve the number of available devices.
PaDeviceIndex Pa_GetDefaultInputDevice (void)
 Retrieve the index of the default input device.
PaDeviceIndex Pa_GetDefaultOutputDevice (void)
 Retrieve the index of the default output device.
const PaDeviceInfoPa_GetDeviceInfo (PaDeviceIndex device)
 Retrieve a pointer to a PaDeviceInfo structure containing information about the specified device.
PaError Pa_IsFormatSupported (const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate)
 Determine whether it would be possible to open a stream with the specified parameters.
PaError Pa_OpenStream (PaStream **stream, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate, unsigned long framesPerBuffer, PaStreamFlags streamFlags, PaStreamCallback *streamCallback, void *userData)
 Opens a stream for either input, output or both.
PaError Pa_OpenDefaultStream (PaStream **stream, int numInputChannels, int numOutputChannels, PaSampleFormat sampleFormat, double sampleRate, unsigned long framesPerBuffer, PaStreamCallback *streamCallback, void *userData)
 A simplified version of Pa_OpenStream() that opens the default input and/or output devices.
PaError Pa_CloseStream (PaStream *stream)
 Closes an audio stream.
PaError Pa_SetStreamFinishedCallback (PaStream *stream, PaStreamFinishedCallback *streamFinishedCallback)
 Register a stream finished callback function which will be called when the stream becomes inactive.
PaError Pa_StartStream (PaStream *stream)
 Commences audio processing.
PaError Pa_StopStream (PaStream *stream)
 Terminates audio processing.
PaError Pa_AbortStream (PaStream *stream)
 Terminates audio processing immediately without waiting for pending buffers to complete.
PaError Pa_IsStreamStopped (PaStream *stream)
 Determine whether the stream is stopped.
PaError Pa_IsStreamActive (PaStream *stream)
 Determine whether the stream is active.
const PaStreamInfoPa_GetStreamInfo (PaStream *stream)
 Retrieve a pointer to a PaStreamInfo structure containing information about the specified stream.
PaTime Pa_GetStreamTime (PaStream *stream)
 Determine the current time for the stream according to the same clock used to generate buffer timestamps.
double Pa_GetStreamCpuLoad (PaStream *stream)
 Retrieve CPU usage information for the specified stream.
PaError Pa_ReadStream (PaStream *stream, void *buffer, unsigned long frames)
 Read samples from an input stream.
PaError Pa_WriteStream (PaStream *stream, const void *buffer, unsigned long frames)
 Write samples to an output stream.
signed long Pa_GetStreamReadAvailable (PaStream *stream)
 Retrieve the number of frames that can be read from the stream without waiting.
signed long Pa_GetStreamWriteAvailable (PaStream *stream)
 Retrieve the number of frames that can be written to the stream without waiting.
PaError Pa_GetSampleSize (PaSampleFormat format)
 Retrieve the size of a given sample format in bytes.
void Pa_Sleep (long msec)
 Put the caller to sleep for at least 'msec' milliseconds.

説明

The PortAudio API.

portaudio.h で定義されています。


マクロ定義

#define paNoDevice   ((PaDeviceIndex)-1)

A special PaDeviceIndex value indicating that no device is available, or should be used.

参照:
PaDeviceIndex

portaudio.h168 行で定義されています。

参照元 adin_mic_open().

#define paUseHostApiSpecificDeviceSpecification   ((PaDeviceIndex)-2)

A special PaDeviceIndex value indicating that the device(s) to be used are specified in the host api specific stream info structure.

参照:
PaDeviceIndex

portaudio.h176 行で定義されています。

#define paFloat32   ((PaSampleFormat) 0x00000001)
参照:
PaSampleFormat

portaudio.h431 行で定義されています。

#define paInt32   ((PaSampleFormat) 0x00000002)
参照:
PaSampleFormat

portaudio.h432 行で定義されています。

#define paInt24   ((PaSampleFormat) 0x00000004)

Packed 24 bit format.

参照:
PaSampleFormat

portaudio.h433 行で定義されています。

#define paInt16   ((PaSampleFormat) 0x00000008)
参照:
PaSampleFormat

portaudio.h434 行で定義されています。

参照元 adin_mic_open().

#define paInt8   ((PaSampleFormat) 0x00000010)
参照:
PaSampleFormat

portaudio.h435 行で定義されています。

#define paUInt8   ((PaSampleFormat) 0x00000020)
参照:
PaSampleFormat

portaudio.h436 行で定義されています。

#define paCustomFormat   ((PaSampleFormat) 0x00010000)
参照:
PaSampleFormat

portaudio.h437 行で定義されています。

#define paFormatIsSupported   (0)

Return code for Pa_IsFormatSupported indicating success.

portaudio.h529 行で定義されています。

#define paNoFlag   ((PaStreamFlags) 0)
参照:
PaStreamFlags

portaudio.h600 行で定義されています。

参照元 adin_mic_open().

#define paClipOff   ((PaStreamFlags) 0x00000001)

Disable default clipping of out of range samples.

参照:
PaStreamFlags

portaudio.h605 行で定義されています。

#define paDitherOff   ((PaStreamFlags) 0x00000002)

Disable default dithering.

参照:
PaStreamFlags

portaudio.h610 行で定義されています。

#define paNeverDropInput   ((PaStreamFlags) 0x00000004)

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.

参照:
PaStreamFlags, paFramesPerBufferUnspecified

portaudio.h621 行で定義されています。

#define paPrimeOutputBuffersUsingStreamCallback   ((PaStreamFlags) 0x00000008)

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.

参照:
PaStreamFlags

portaudio.h629 行で定義されています。

#define paPlatformSpecificFlags   ((PaStreamFlags)0xFFFF0000)

A mask specifying the platform specific bits.

参照:
PaStreamFlags

portaudio.h634 行で定義されています。

#define paInputUnderflow   ((PaStreamCallbackFlags) 0x00000001)

In a stream opened with paFramesPerBufferUnspecified, indicates that input data is all silence (zeros) because no real data is available.

In a stream opened without paFramesPerBufferUnspecified, it indicates that one or more zero samples have been inserted into the input buffer to compensate for an input underflow.

参照:
PaStreamCallbackFlags

portaudio.h661 行で定義されています。

#define paInputOverflow   ((PaStreamCallbackFlags) 0x00000002)

In a stream opened with paFramesPerBufferUnspecified, indicates that data prior to the first sample of the input buffer was discarded due to an overflow, possibly because the stream callback is using too much CPU time.

Otherwise indicates that data prior to one or more samples in the input buffer was discarded.

参照:
PaStreamCallbackFlags

portaudio.h670 行で定義されています。

#define paOutputUnderflow   ((PaStreamCallbackFlags) 0x00000004)

Indicates that output data (or a gap) was inserted, possibly because the stream callback is using too much CPU time.

参照:
PaStreamCallbackFlags

portaudio.h676 行で定義されています。

#define paOutputOverflow   ((PaStreamCallbackFlags) 0x00000008)

Indicates that output data will be discarded because no room is available.

参照:
PaStreamCallbackFlags

portaudio.h681 行で定義されています。

#define paPrimingOutput   ((PaStreamCallbackFlags) 0x00000010)

Some of all of the output data will be used to prime the stream, input data may be zero.

参照:
PaStreamCallbackFlags

portaudio.h687 行で定義されています。


型定義

typedef int PaError

Error codes returned by PortAudio functions.

Note that with the exception of paNoError, all PaErrorCodes are negative.

portaudio.h69 行で定義されています。

typedef int PaDeviceIndex

The type used to refer to audio devices.

Values of this type usually range from 0 to (Pa_GetDeviceCount()-1), and may also take on the PaNoDevice and paUseHostApiSpecificDeviceSpecification values.

参照:
Pa_GetDeviceCount, paNoDevice, paUseHostApiSpecificDeviceSpecification

portaudio.h160 行で定義されています。

typedef int PaHostApiIndex

The type used to enumerate to host APIs at runtime.

Values of this type range from 0 to (Pa_GetHostApiCount()-1).

参照:
Pa_GetHostApiCount

portaudio.h186 行で定義されています。

typedef double PaTime

The type used to represent monotonic time in seconds that can be used for syncronisation.

The type is used for the outTime argument to the PaStreamCallback and as the result of Pa_GetStreamTime().

参照:
PaStreamCallback, Pa_GetStreamTime

portaudio.h406 行で定義されています。

typedef unsigned long PaSampleFormat

A type used to specify one or more sample formats.

Each value indicates a possible format for sound data passed to and from the stream callback, Pa_ReadStream and Pa_WriteStream.

The standard formats paFloat32, paInt16, paInt32, paInt24, paInt8 and aUInt8 are usually implemented by all implementations.

The floating point representation (paFloat32) uses +1.0 and -1.0 as the maximum and minimum respectively.

paUInt8 is an unsigned 8 bit format where 128 is considered "ground"

The paNonInterleaved flag indicates that a multichannel buffer is passed as a set of non-interleaved pointers.

参照:
Pa_OpenStream, Pa_OpenDefaultStream, PaDeviceInfo
paFloat32, paInt16, paInt32, paInt24, paInt8
paUInt8, paCustomFormat, paNonInterleaved

portaudio.h428 行で定義されています。

typedef void PaStream

A single PaStream can provide multiple channels of real-time streaming audio input and output to a client application.

A stream provides access to audio hardware represented by one or more PaDevices. Depending on the underlying Host API, it may be possible to open multiple streams using the same device, however this behavior is implementation defined. Portable applications should assume that a PaDevice may be simultaneously used by at most one PaStream.

Pointers to PaStream objects are passed between PortAudio functions that operate on streams.

参照:
Pa_OpenStream, Pa_OpenDefaultStream, Pa_OpenDefaultStream, Pa_CloseStream, Pa_StartStream, Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive, Pa_GetStreamTime, Pa_GetStreamCpuLoad

portaudio.h579 行で定義されています。

typedef unsigned long PaStreamFlags

Flags used to control the behavior of a stream.

They are passed as parameters to Pa_OpenStream or Pa_OpenDefaultStream. Multiple flags may be ORed together.

参照:
Pa_OpenStream, Pa_OpenDefaultStream
paNoFlag, paClipOff, paDitherOff, paNeverDropInput, paPrimeOutputBuffersUsingStreamCallback, paPlatformSpecificFlags

portaudio.h597 行で定義されています。

typedef unsigned long PaStreamCallbackFlags

Flag bit constants for the statusFlags to PaStreamCallback.

参照:
paInputUnderflow, paInputOverflow, paOutputUnderflow, paOutputOverflow, paPrimingOutput

portaudio.h652 行で定義されています。

typedef int PaStreamCallback(const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)

Functions of type PaStreamCallback are implemented by PortAudio clients.

They consume, process or generate audio in response to requests from an active PortAudio stream.

引数:
inputand
outputare arrays of interleaved samples, the format, packing and number of channels used by the buffers are determined by parameters to Pa_OpenStream().
frameCountThe number of sample frames to be processed by the stream callback.
timeInfoThe time in seconds when the first sample of the input buffer was received at the audio input, the time in seconds when the first sample of the output buffer will begin being played at the audio output, and the time in seconds when the stream callback was called. See also Pa_GetStreamTime()
statusFlagsFlags indicating whether input and/or output buffers have been inserted or will be dropped to overcome underflow or overflow conditions.
userDataThe value of a user supplied pointer passed to Pa_OpenStream() intended for storing synthesis data etc.
戻り値:
The stream callback should return one of the values in the PaStreamCallbackResult enumeration. To ensure that the callback continues to be called, it should return paContinue (0). Either paComplete or paAbort can be returned to finish stream processing, after either of these values is returned the callback will not be called again. If paAbort is returned the stream will finish as soon as possible. If paComplete is returned, the stream will continue until all buffers generated by the callback have been played. This may be useful in applications such as soundfile players where a specific duration of output is required. However, it is not necessary to utilise this mechanism as Pa_StopStream(), Pa_AbortStream() or Pa_CloseStream() can also be used to stop the stream. The callback must always fill the entire output buffer irrespective of its return value.
参照:
Pa_OpenStream, Pa_OpenDefaultStream
覚え書き:
With the exception of Pa_GetStreamCpuLoad() it is not permissable to call PortAudio API functions from within the stream callback.

portaudio.h745 行で定義されています。

typedef void PaStreamFinishedCallback(void *userData)

Functions of type PaStreamFinishedCallback are implemented by PortAudio clients.

They can be registered with a stream using the Pa_SetStreamFinishedCallback function. Once registered they are called when the stream becomes inactive (ie once a call to Pa_StopStream() will not block). A stream will become inactive after the stream callback returns non-zero, or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio output, if the stream callback returns paComplete, or Pa_StopStream is called, the stream finished callback will not be called until all generated sample data has been played.

引数:
userDataThe userData parameter supplied to Pa_OpenStream()
参照:
Pa_SetStreamFinishedCallback

portaudio.h877 行で定義されています。


列挙型

列挙型の値:
paCanNotReadFromACallbackStream 
TODO:
review error code name
paCanNotWriteToACallbackStream 
TODO:
review error code name
paCanNotReadFromAnOutputOnlyStream 
TODO:
review error code name
paCanNotWriteToAnInputOnlyStream 
TODO:
review error code name

portaudio.h70 行で定義されています。

Unchanging unique identifiers for each supported host API.

This type is used in the PaHostApiInfo structure. The values are guaranteed to be unique and to never change, thus allowing code to be written that conditionally uses host API specific extensions.

New type ids will be allocated when support for a host API reaches "public alpha" status, prior to that developers should use the paInDevelopment type id.

参照:
PaHostApiInfo

portaudio.h223 行で定義されています。

Allowable return values for the PaStreamCallback.

参照:
PaStreamCallback

portaudio.h693 行で定義されています。


関数

PaError Pa_Initialize ( void  )

Library initialization function - call this before using PortAudio.

This function initialises internal data structures and prepares underlying host APIs for use. With the exception of Pa_GetVersion(), Pa_GetVersionText(), and Pa_GetErrorText(), this function MUST be called before using any other PortAudio API functions.

If Pa_Initialize() is called multiple times, each successful call must be matched with a corresponding call to Pa_Terminate(). Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not required to be fully nested.

Note that if Pa_Initialize() returns an error code, Pa_Terminate() should NOT be called.

戻り値:
paNoError if successful, otherwise an error code indicating the cause of failure.
参照:
Pa_Terminate

参照元 adin_mic_open().

PaError Pa_Terminate ( void  )

Library termination function - call this when finished using PortAudio.

This function deallocates all resources allocated by PortAudio since it was initializied by a call to Pa_Initialize(). In cases where Pa_Initialise() has been called multiple times, each call must be matched with a corresponding call to Pa_Terminate(). The final matching call to Pa_Terminate() will automatically close any PortAudio streams that are still open.

Pa_Terminate() MUST be called before exiting a program which uses PortAudio. Failure to do so may result in serious resource leaks, such as audio devices not being available until the next reboot.

戻り値:
paNoError if successful, otherwise an error code indicating the cause of failure.
参照:
Pa_Initialize

参照元 adin_mic_end().

PaHostApiIndex Pa_GetHostApiCount ( void  )

Retrieve the number of available host APIs.

Even if a host API is available it may have no devices available.

戻り値:
A non-negative value indicating the number of available host APIs or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered.
参照:
PaHostApiIndex
PaHostApiIndex Pa_GetDefaultHostApi ( void  )

Retrieve the index of the default host API.

The default host API will be the lowest common denominator host API on the current platform and is unlikely to provide the best performance.

戻り値:
A non-negative value ranging from 0 to (Pa_GetHostApiCount()-1) indicating the default host API index or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered.
const PaHostApiInfo* Pa_GetHostApiInfo ( PaHostApiIndex  hostApi)

Retrieve a pointer to a structure containing information about a specific host Api.

引数:
hostApiA valid host API index ranging from 0 to (Pa_GetHostApiCount()-1)
戻り値:
A pointer to an immutable PaHostApiInfo structure describing a specific host API. If the hostApi parameter is out of range or an error is encountered, the function returns NULL.

The returned structure is owned by the PortAudio implementation and must not be manipulated or freed. The pointer is only guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate().

参照元 adin_mic_open().

PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex ( PaHostApiTypeId  type)

Convert a static host API unique identifier, into a runtime host API index.

引数:
typeA unique host API identifier belonging to the PaHostApiTypeId enumeration.
戻り値:
A valid PaHostApiIndex ranging from 0 to (Pa_GetHostApiCount()-1) or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered.

The paHostApiNotFound error code indicates that the host API specified by the type parameter is not available.

参照:
PaHostApiTypeId
PaDeviceIndex Pa_HostApiDeviceIndexToDeviceIndex ( PaHostApiIndex  hostApi,
int  hostApiDeviceIndex 
)

Convert a host-API-specific device index to standard PortAudio device index.

This function may be used in conjunction with the deviceCount field of PaHostApiInfo to enumerate all devices for the specified host API.

引数:
hostApiA valid host API index ranging from 0 to (Pa_GetHostApiCount()-1)
hostApiDeviceIndexA valid per-host device index in the range 0 to (Pa_GetHostApiInfo(hostApi)->deviceCount-1)
戻り値:
A non-negative PaDeviceIndex ranging from 0 to (Pa_GetDeviceCount()-1) or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered.

A paInvalidHostApi error code indicates that the host API index specified by the hostApi parameter is out of range.

A paInvalidDevice error code indicates that the hostApiDeviceIndex parameter is out of range.

参照:
PaHostApiInfo
const PaHostErrorInfo* Pa_GetLastHostErrorInfo ( void  )

Return information about the last host error encountered.

The error information returned by Pa_GetLastHostErrorInfo() will never be modified asyncronously by errors occurring in other PortAudio owned threads (such as the thread that manages the stream callback.)

This function is provided as a last resort, primarily to enhance debugging by providing clients with access to all available error information.

戻り値:
A pointer to an immutable structure constaining information about the host error. The values in this structure will only be valid if a PortAudio function has previously returned the paUnanticipatedHostError error code.
PaDeviceIndex Pa_GetDeviceCount ( void  )

Retrieve the number of available devices.

The number of available devices may be zero.

戻り値:
A non-negative value indicating the number of available devices or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered.
PaDeviceIndex Pa_GetDefaultInputDevice ( void  )

Retrieve the index of the default input device.

The result can be used in the inputDevice parameter to Pa_OpenStream().

戻り値:
The default input device index for the default host API, or paNoDevice if no default input device is available or an error was encountered.

参照元 adin_mic_open().

PaDeviceIndex Pa_GetDefaultOutputDevice ( void  )

Retrieve the index of the default output device.

The result can be used in the outputDevice parameter to Pa_OpenStream().

戻り値:
The default output device index for the defualt host API, or paNoDevice if no default output device is available or an error was encountered.
覚え書き:
On the PC, the user can specify a default device by setting an environment variable. For example, to use device #1.
 set PA_RECOMMENDED_OUTPUT_DEVICE=1
The user should first determine the available device ids by using the supplied application "pa_devs".
const PaDeviceInfo* Pa_GetDeviceInfo ( PaDeviceIndex  device)

Retrieve a pointer to a PaDeviceInfo structure containing information about the specified device.

戻り値:
A pointer to an immutable PaDeviceInfo structure. If the device parameter is out of range the function returns NULL.
引数:
deviceA valid device index in the range 0 to (Pa_GetDeviceCount()-1)
覚え書き:
PortAudio manages the memory referenced by the returned pointer, the client must not manipulate or free the memory. The pointer is only guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate().
参照:
PaDeviceInfo, PaDeviceIndex

参照元 adin_mic_open().

PaError Pa_IsFormatSupported ( const PaStreamParameters inputParameters,
const PaStreamParameters outputParameters,
double  sampleRate 
)

Determine whether it would be possible to open a stream with the specified parameters.

引数:
inputParametersA structure that describes the input parameters used to open a stream. The suggestedLatency field is ignored. See PaStreamParameters for a description of these parameters. inputParameters must be NULL for output-only streams.
outputParametersA structure that describes the output parameters used to open a stream. The suggestedLatency field is ignored. See PaStreamParameters for a description of these parameters. outputParameters must be NULL for input-only streams.
sampleRateThe required sampleRate. For full-duplex streams it is the sample rate for both input and output
戻り値:
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.
参照:
paFormatIsSupported, PaStreamParameters
PaError Pa_OpenStream ( PaStream **  stream,
const PaStreamParameters inputParameters,
const PaStreamParameters outputParameters,
double  sampleRate,
unsigned long  framesPerBuffer,
PaStreamFlags  streamFlags,
PaStreamCallback streamCallback,
void *  userData 
)

Opens a stream for either input, output or both.

引数:
streamThe address of a PaStream pointer which will receive a pointer to the newly opened stream.
inputParametersA structure that describes the input parameters used by the opened stream. See PaStreamParameters for a description of these parameters. inputParameters must be NULL for output-only streams.
outputParametersA structure that describes the output parameters used by the opened stream. See PaStreamParameters for a description of these parameters. outputParameters must be NULL for input-only streams.
sampleRateThe desired sampleRate. For full-duplex streams it is the sample rate for both input and output
framesPerBufferThe number of frames passed to the stream callback function, or the preferred block granularity for a blocking read/write stream. The special value paFramesPerBufferUnspecified (0) may be used to request that the stream callback will recieve an optimal (and possibly varying) number of frames based on host requirements and the requested latency settings. Note: With some host APIs, the use of non-zero framesPerBuffer for a callback stream may introduce an additional layer of buffering which could introduce additional latency. PortAudio guarantees that the additional latency will be kept to the theoretical minimum however, it is strongly recommended that a non-zero framesPerBuffer value only be used when your algorithm requires a fixed number of frames per stream callback.
streamFlagsFlags which modify the behaviour of the streaming process. This parameter may contain a combination of flags ORed together. Some flags may only be relevant to certain buffer formats.
streamCallbackA 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. In blocking mode, the client can receive sample data using Pa_ReadStream and write sample data using Pa_WriteStream, the number of samples that may be read or written without blocking is returned by Pa_GetStreamReadAvailable and Pa_GetStreamWriteAvailable respectively.
userDataA client supplied pointer which is passed to the stream callback function. It could for example, contain a pointer to instance data necessary for processing the audio buffers. This parameter is ignored if streamCallback is NULL.
戻り値:
Upon success Pa_OpenStream() returns paNoError and places a pointer to a valid PaStream in the stream argument. The stream is inactive (stopped). If a call to Pa_OpenStream() fails, a non-zero error code is returned (see PaError for possible error codes) and the value of stream is invalid.
参照:
PaStreamParameters, PaStreamCallback, Pa_ReadStream, Pa_WriteStream, Pa_GetStreamReadAvailable, Pa_GetStreamWriteAvailable

参照元 adin_mic_open().

PaError Pa_OpenDefaultStream ( PaStream **  stream,
int  numInputChannels,
int  numOutputChannels,
PaSampleFormat  sampleFormat,
double  sampleRate,
unsigned long  framesPerBuffer,
PaStreamCallback streamCallback,
void *  userData 
)

A simplified version of Pa_OpenStream() that opens the default input and/or output devices.

引数:
streamThe address of a PaStream pointer which will receive a pointer to the newly opened stream.
numInputChannelsThe number of channels of sound that will be supplied to the stream callback or returned by Pa_ReadStream. It can range from 1 to the value of maxInputChannels in the PaDeviceInfo record for the default input device. If 0 the stream is opened as an output-only stream.
numOutputChannelsThe number of channels of sound to be delivered to the stream callback or passed to Pa_WriteStream. It can range from 1 to the value of maxOutputChannels in the PaDeviceInfo record for the default output dvice. If 0 the stream is opened as an output-only stream.
sampleFormatThe sample format of both the input and output buffers provided to the callback or passed to and from Pa_ReadStream and Pa_WriteStream. sampleFormat may be any of the formats described by the PaSampleFormat enumeration.
sampleRateSame as Pa_OpenStream parameter of the same name.
framesPerBufferSame as Pa_OpenStream parameter of the same name.
streamCallbackSame as Pa_OpenStream parameter of the same name.
userDataSame as Pa_OpenStream parameter of the same name.
戻り値:
As for Pa_OpenStream
参照:
Pa_OpenStream, PaStreamCallback

参照元 adin_mic_open().

PaError Pa_CloseStream ( PaStream stream)

Closes an audio stream.

If the audio stream is active it discards any pending buffers as if Pa_AbortStream() had been called.

参照元 adin_mic_end().

PaError Pa_SetStreamFinishedCallback ( PaStream stream,
PaStreamFinishedCallback streamFinishedCallback 
)

Register a stream finished callback function which will be called when the stream becomes inactive.

See the description of PaStreamFinishedCallback for further details about when the callback will be called.

引数:
streama pointer to a PaStream that is in the stopped state - if the stream is not stopped, the stream's finished callback will remain unchanged and an error code will be returned.
streamFinishedCallbacka pointer to a function with the same signature as PaStreamFinishedCallback, that will be called when the stream becomes inactive. Passing NULL for this parameter will un-register a previously registered stream finished callback function.
戻り値:
on success returns paNoError, otherwise an error code indicating the cause of the error.
参照:
PaStreamFinishedCallback
PaError Pa_StopStream ( PaStream stream)

Terminates audio processing.

It waits until all pending audio buffers have been played before it returns.

PaError Pa_IsStreamStopped ( PaStream stream)

Determine whether the stream is stopped.

A stream is considered to be stopped prior to a successful call to Pa_StartStream and after a successful call to Pa_StopStream or Pa_AbortStream. If a stream callback returns a value other than paContinue the stream is NOT considered to be stopped.

戻り値:
Returns one (1) when the stream is stopped, zero (0) when the stream is running or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered.
参照:
Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive
PaError Pa_IsStreamActive ( PaStream stream)

Determine whether the stream is active.

A stream is active after a successful call to Pa_StartStream(), until it becomes inactive either as a result of a call to Pa_StopStream() or Pa_AbortStream(), or as a result of a return value other than paContinue from the stream callback. In the latter case, the stream is considered inactive after the last buffer has finished playing.

戻り値:
Returns one (1) when the stream is active (ie playing or recording audio), zero (0) when not playing or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered.
参照:
Pa_StopStream, Pa_AbortStream, Pa_IsStreamStopped
const PaStreamInfo* Pa_GetStreamInfo ( PaStream stream)

Retrieve a pointer to a PaStreamInfo structure containing information about the specified stream.

戻り値:
A pointer to an immutable PaStreamInfo structure. If the stream parameter invalid, or an error is encountered, the function returns NULL.
引数:
streamA pointer to an open stream previously created with Pa_OpenStream.
覚え書き:
PortAudio manages the memory referenced by the returned pointer, the client must not manipulate or free the memory. The pointer is only guaranteed to be valid until the specified stream is closed.
参照:
PaStreamInfo

参照元 adin_mic_open().

PaTime Pa_GetStreamTime ( PaStream stream)

Determine the current time for the stream according to the same clock used to generate buffer timestamps.

This time may be used for syncronising other events to the audio stream, for example synchronizing audio to MIDI.

戻り値:
The stream's current time in seconds, or 0 if an error occurred.
参照:
PaTime, PaStreamCallback
double Pa_GetStreamCpuLoad ( PaStream stream)

Retrieve CPU usage information for the specified stream.

The "CPU Load" is a fraction of total CPU time consumed by a callback stream's audio processing routines including, but not limited to the client supplied stream callback. This function does not work with blocking read/write streams.

This function may be called from the stream callback function or the application.

戻り値:
A floating point value, typically between 0.0 and 1.0, where 1.0 indicates that the stream callback is consuming the maximum number of CPU cycles possible to maintain real-time operation. A value of 0.5 would imply that PortAudio and the stream callback was consuming roughly 50% of the available CPU time. The return value may exceed 1.0. A value of 0.0 will always be returned for a blocking read/write stream, or if an error occurrs.
PaError Pa_ReadStream ( PaStream stream,
void *  buffer,
unsigned long  frames 
)

Read 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.

引数:
streamA pointer to an open stream previously created with Pa_OpenStream.
bufferA pointer to a buffer of sample frames. The buffer contains samples in the format specified by the inputParameters->sampleFormat field used to open the stream, and the number of channels specified by inputParameters->numChannels. If non-interleaved samples were requested, buffer is a pointer to the first element of an array of non-interleaved buffer pointers, one for each channel.
framesThe number of frames to be read into buffer. This parameter is not constrained to a specific range, however high performance applications will want to match this parameter to the framesPerBuffer parameter used when opening the stream.
戻り値:
On success PaNoError will be returned, or PaInputOverflowed if input data was discarded by PortAudio after the previous call and before this call.
PaError Pa_WriteStream ( PaStream stream,
const void *  buffer,
unsigned long  frames 
)

Write 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.

引数:
streamA pointer to an open stream previously created with Pa_OpenStream.
bufferA pointer to a buffer of sample frames. The buffer contains samples in the format specified by the outputParameters->sampleFormat field used to open the stream, and the number of channels specified by outputParameters->numChannels. If non-interleaved samples were requested, buffer is a pointer to the first element of an array of non-interleaved buffer pointers, one for each channel.
framesThe number of frames to be written from buffer. This parameter is not constrained to a specific range, however high performance applications will want to match this parameter to the framesPerBuffer parameter used when opening the stream.
戻り値:
On success PaNoError will be returned, or paOutputUnderflowed if additional output data was inserted after the previous call and before this call.
signed long Pa_GetStreamReadAvailable ( PaStream stream)

Retrieve the number of frames that can be read from the stream without waiting.

戻り値:
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.
signed long Pa_GetStreamWriteAvailable ( PaStream stream)

Retrieve the number of frames that can be written to the stream without waiting.

戻り値:
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.
PaError Pa_GetSampleSize ( PaSampleFormat  format)

Retrieve the size of a given sample format in bytes.

戻り値:
The size in bytes of a single sample in the specified format, or paSampleFormatNotSupported if the format is not supported.
void Pa_Sleep ( long  msec)

Put the caller to sleep for at least 'msec' milliseconds.

This function is provided only as a convenience for authors of portable code (such as the tests and examples in the PortAudio distribution.)

The function may sleep longer than requested so don't rely on this for accurate musical timing.

参照元 adin_mic_read().