PortAudio
2.0
|
Buffer Processor prototypes. A Buffer Processor performs buffer length adaption, coordinates sample format conversion, and interleaves/deinterleaves channels. More...
Go to the source code of this file.
Data Structures | |
struct | PaUtilChannelDescriptor |
An auxiliary data structure used internally by the buffer processor to represent host input and output buffers. More... | |
struct | PaUtilBufferProcessor |
The main buffer processor data structure. More... | |
Typedefs | |
typedef struct PaUtilChannelDescriptor | PaUtilChannelDescriptor |
An auxiliary data structure used internally by the buffer processor to represent host input and output buffers. More... | |
Enumerations | |
enum | PaUtilHostBufferSizeMode { paUtilFixedHostBufferSize, paUtilBoundedHostBufferSize, paUtilUnknownHostBufferSize, paUtilVariableHostBufferSizePartialUsageAllowed } |
Mode flag passed to PaUtil_InitializeBufferProcessor indicating the type of buffering that the host API uses. More... | |
Functions | |
Initialization, termination, resetting and info | |
PaError | PaUtil_InitializeBufferProcessor (PaUtilBufferProcessor *bufferProcessor, int inputChannelCount, PaSampleFormat userInputSampleFormat, PaSampleFormat hostInputSampleFormat, int outputChannelCount, PaSampleFormat userOutputSampleFormat, PaSampleFormat hostOutputSampleFormat, double sampleRate, PaStreamFlags streamFlags, unsigned long framesPerUserBuffer, unsigned long framesPerHostBuffer, PaUtilHostBufferSizeMode hostBufferSizeMode, PaStreamCallback *streamCallback, void *userData) |
void | PaUtil_TerminateBufferProcessor (PaUtilBufferProcessor *bufferProcessor) |
void | PaUtil_ResetBufferProcessor (PaUtilBufferProcessor *bufferProcessor) |
unsigned long | PaUtil_GetBufferProcessorInputLatencyFrames (PaUtilBufferProcessor *bufferProcessor) |
unsigned long | PaUtil_GetBufferProcessorOutputLatencyFrames (PaUtilBufferProcessor *bufferProcessor) |
Host buffer pointer configuration | |
Functions to set host input and output buffers, used by both callback streams and blocking read/write streams. | |
void | PaUtil_SetInputFrameCount (PaUtilBufferProcessor *bufferProcessor, unsigned long frameCount) |
void | PaUtil_SetNoInput (PaUtilBufferProcessor *bufferProcessor) |
void | PaUtil_SetInputChannel (PaUtilBufferProcessor *bufferProcessor, unsigned int channel, void *data, unsigned int stride) |
void | PaUtil_SetInterleavedInputChannels (PaUtilBufferProcessor *bufferProcessor, unsigned int firstChannel, void *data, unsigned int channelCount) |
void | PaUtil_SetNonInterleavedInputChannel (PaUtilBufferProcessor *bufferProcessor, unsigned int channel, void *data) |
void | PaUtil_Set2ndInputFrameCount (PaUtilBufferProcessor *bufferProcessor, unsigned long frameCount) |
void | PaUtil_Set2ndInputChannel (PaUtilBufferProcessor *bufferProcessor, unsigned int channel, void *data, unsigned int stride) |
void | PaUtil_Set2ndInterleavedInputChannels (PaUtilBufferProcessor *bufferProcessor, unsigned int firstChannel, void *data, unsigned int channelCount) |
void | PaUtil_Set2ndNonInterleavedInputChannel (PaUtilBufferProcessor *bufferProcessor, unsigned int channel, void *data) |
void | PaUtil_SetOutputFrameCount (PaUtilBufferProcessor *bufferProcessor, unsigned long frameCount) |
void | PaUtil_SetNoOutput (PaUtilBufferProcessor *bufferProcessor) |
void | PaUtil_SetOutputChannel (PaUtilBufferProcessor *bufferProcessor, unsigned int channel, void *data, unsigned int stride) |
void | PaUtil_SetInterleavedOutputChannels (PaUtilBufferProcessor *bufferProcessor, unsigned int firstChannel, void *data, unsigned int channelCount) |
void | PaUtil_SetNonInterleavedOutputChannel (PaUtilBufferProcessor *bufferProcessor, unsigned int channel, void *data) |
void | PaUtil_Set2ndOutputFrameCount (PaUtilBufferProcessor *bufferProcessor, unsigned long frameCount) |
void | PaUtil_Set2ndOutputChannel (PaUtilBufferProcessor *bufferProcessor, unsigned int channel, void *data, unsigned int stride) |
void | PaUtil_Set2ndInterleavedOutputChannels (PaUtilBufferProcessor *bufferProcessor, unsigned int firstChannel, void *data, unsigned int channelCount) |
void | PaUtil_Set2ndNonInterleavedOutputChannel (PaUtilBufferProcessor *bufferProcessor, unsigned int channel, void *data) |
Buffer processing functions for callback streams | |
void | PaUtil_BeginBufferProcessing (PaUtilBufferProcessor *bufferProcessor, PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags callbackStatusFlags) |
unsigned long | PaUtil_EndBufferProcessing (PaUtilBufferProcessor *bufferProcessor, int *callbackResult) |
int | PaUtil_IsBufferProcessorOutputEmpty (PaUtilBufferProcessor *bufferProcessor) |
Buffer processing functions for blocking read/write streams | |
unsigned long | PaUtil_CopyInput (PaUtilBufferProcessor *bufferProcessor, void **buffer, unsigned long frameCount) |
unsigned long | PaUtil_CopyOutput (PaUtilBufferProcessor *bufferProcessor, const void **buffer, unsigned long frameCount) |
unsigned long | PaUtil_ZeroOutput (PaUtilBufferProcessor *bufferProcessor, unsigned long frameCount) |
Buffer Processor prototypes. A Buffer Processor performs buffer length adaption, coordinates sample format conversion, and interleaves/deinterleaves channels.
The "Buffer Processor" (PaUtilBufferProcessor) manages conversion of audio data from host buffers to user buffers and back again. Where required, the buffer processor takes care of converting between host and user sample formats, interleaving and deinterleaving multichannel buffers, and adapting between host and user buffers with different lengths. The buffer processor may be used with full and half duplex streams, for both callback streams and blocking read/write streams.
One of the important capabilities provided by the buffer processor is the ability to adapt between user and host buffer sizes of different lengths with minimum latency. Although this task is relatively easy to perform when the host buffer size is an integer multiple of the user buffer size, the problem is more complicated when this is not the case - especially for full-duplex callback streams. Where necessary the adaption is implemented by internally buffering some input and/or output data. The buffer adation algorithm used by the buffer processor was originally implemented by Stephan Letz for the ASIO version of PortAudio, and is described in his Callback_adaption_.pdf which is included in the distribution.
The buffer processor performs sample conversion using the functions provided by pa_converters.c.
The following sections provide an overview of how to use the buffer processor. Interested readers are advised to consult the host API implementations for examples of buffer processor usage.
When a stream is opened, the buffer processor should be initialized using PaUtil_InitializeBufferProcessor. This function initializes internal state and allocates temporary buffers as necessary according to the supplied configuration parameters. Some of the parameters correspond to those requested by the user in their call to Pa_OpenStream(), others reflect the requirements of the host API implementation - they indicate host buffer sizes, formats, and the type of buffering which the Host API uses. The buffer processor should be initialized for callback streams and blocking read/write streams.
Call PaUtil_ResetBufferProcessor to clear any sample data which is present in the buffer processor before starting to use it (for example when Pa_StartStream is called).
When the buffer processor is no longer used call PaUtil_TerminateBufferProcessor.
The buffer processor's role in a callback stream is to take host input buffers process them with the stream callback, and fill host output buffers. For a full duplex stream, the buffer processor handles input and output simultaneously due to the requirements of the minimum-latency buffer adation algorithm.
When a host buffer becomes available, the implementation should call the buffer processor to process the buffer. The buffer processor calls the stream callback to consume and/or produce audio data as necessary. The buffer processor will convert sample formats, interleave/deinterleave channels, and slice or chunk the data to the appropriate buffer lengths according to the requirements of the stream callback and the host API.
To process a host buffer (or a pair of host buffers for a full-duplex stream) use the following calling sequence:
Blocking read/write streams use the buffer processor to convert and copy user output data to a host buffer, and to convert and copy host input data to the user's buffer. The buffer processor does not perform any buffer adaption. When using the buffer processor in a blocking read/write stream the input and output conversion are performed separately by the PaUtil_CopyInput and PaUtil_CopyOutput functions.
To copy data from a host input buffer to the buffer(s) which the user supplies to Pa_ReadStream, use the following calling sequence.
To copy data to the host output buffer from the user buffers(s) supplied to Pa_WriteStream use the following calling sequence.
typedef struct PaUtilChannelDescriptor PaUtilChannelDescriptor |
An auxiliary data structure used internally by the buffer processor to represent host input and output buffers.
Mode flag passed to PaUtil_InitializeBufferProcessor indicating the type of buffering that the host API uses.
The mode used depends on whether the host API or the implementation manages the buffers, and how these buffers are used (scatter gather, circular buffer).
Enumerator | |
---|---|
paUtilFixedHostBufferSize |
The host buffer size is a fixed known size. |
paUtilBoundedHostBufferSize |
The host buffer size may vary, but has a known maximum size. |
paUtilUnknownHostBufferSize |
Nothing is known about the host buffer size. |
paUtilVariableHostBufferSizePartialUsageAllowed |
The host buffer size varies, and the client does not require the buffer processor to consume all of the input and fill all of the output buffer. This is useful when the implementation has access to the host API's circular buffer and only needs to consume/fill some of it, not necessarily all of it, with each call to the buffer processor. This is the only mode where PaUtil_EndBufferProcessing() may not consume the whole buffer. |
void PaUtil_BeginBufferProcessing | ( | PaUtilBufferProcessor * | bufferProcessor, |
PaStreamCallbackTimeInfo * | timeInfo, | ||
PaStreamCallbackFlags | callbackStatusFlags | ||
) |
Commence processing a host buffer (or a pair of host buffers in the full-duplex case) for a callback stream.
bufferProcessor | The buffer processor. |
timeInfo | Timing information for the first sample of the host buffer(s). This information may be adjusted when buffer adaption is being performed. |
callbackStatusFlags | Flags indicating whether underruns and overruns have occurred since the last time the buffer processor was called. |
References PaUtilBufferProcessor::callbackStatusFlags, PaUtilBufferProcessor::framesInTempInputBuffer, PaUtilBufferProcessor::framesInTempOutputBuffer, PaUtilBufferProcessor::hostInputFrameCount, PaUtilBufferProcessor::hostOutputFrameCount, PaStreamCallbackTimeInfo::inputBufferAdcTime, PaStreamCallbackTimeInfo::outputBufferDacTime, PaUtilBufferProcessor::samplePeriod, and PaUtilBufferProcessor::timeInfo.
Referenced by ProcessingThreadProc().
unsigned long PaUtil_CopyInput | ( | PaUtilBufferProcessor * | bufferProcessor, |
void ** | buffer, | ||
unsigned long | frameCount | ||
) |
Copy samples from host input channels set up by the PaUtil_Set*InputChannels functions to a user supplied buffer. This function is intended for use with blocking read/write streams. Copies the minimum of the number of user frames (specified by the frameCount parameter) and the number of available host frames (specified in a previous call to SetInputFrameCount()).
bufferProcessor | The buffer processor. |
buffer | A pointer to the user buffer pointer, or a pointer to a pointer to an array of user buffer pointers for a non-interleaved stream. It is important that this parameter points to a copy of the user buffer pointers, not to the actual user buffer pointers, because this function updates the pointers before returning. |
frameCount | The number of frames of data in the buffer(s) pointed to by the buffer parameter. |
References PaUtilBufferProcessor::bytesPerHostInputSample, PaUtilBufferProcessor::bytesPerUserInputSample, PaUtilChannelDescriptor::data, PaUtilBufferProcessor::ditherGenerator, PaUtilBufferProcessor::hostInputChannels, PaUtilBufferProcessor::hostInputFrameCount, PaUtilBufferProcessor::inputChannelCount, PaUtilBufferProcessor::inputConverter, PA_MIN_, PaUtilChannelDescriptor::stride, and PaUtilBufferProcessor::userInputIsInterleaved.
unsigned long PaUtil_CopyOutput | ( | PaUtilBufferProcessor * | bufferProcessor, |
const void ** | buffer, | ||
unsigned long | frameCount | ||
) |
References PaUtilBufferProcessor::bytesPerHostOutputSample, PaUtilBufferProcessor::bytesPerUserOutputSample, PaUtilChannelDescriptor::data, PaUtilBufferProcessor::ditherGenerator, PaUtilBufferProcessor::hostOutputChannels, PaUtilBufferProcessor::hostOutputFrameCount, PaUtilBufferProcessor::outputChannelCount, PaUtilBufferProcessor::outputConverter, PA_MIN_, PaUtilChannelDescriptor::stride, and PaUtilBufferProcessor::userOutputIsInterleaved.
unsigned long PaUtil_EndBufferProcessing | ( | PaUtilBufferProcessor * | bufferProcessor, |
int * | callbackResult | ||
) |
Finish processing a host buffer (or a pair of host buffers in the full-duplex case) for a callback stream.
bufferProcessor | The buffer processor. |
callbackResult | On input, indicates a previous callback result, and on exit, the result of the user stream callback, if it is called. On entry callbackResult should contain one of { paContinue, paComplete, or paAbort}. If paComplete is passed, the stream callback will not be called but any audio that was generated by previous stream callbacks will be copied to the output buffer(s). You can check whether the buffer processor's internal buffer is empty by calling PaUtil_IsBufferProcessorOutputEmpty. |
If the stream callback is called its result is stored in *callbackResult. If the stream callback returns paComplete or paAbort, all output buffers will be full of valid data - some of which may be zeros to account for data that wasn't generated by the terminating callback.
References PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostBufferSizeMode, PaUtilBufferProcessor::hostInputChannels, PaUtilBufferProcessor::hostInputFrameCount, PaUtilBufferProcessor::hostOutputChannels, PaUtilBufferProcessor::hostOutputFrameCount, PaUtilBufferProcessor::inputChannelCount, PaUtilBufferProcessor::outputChannelCount, PA_MIN_, paAbort, paComplete, paContinue, paUtilVariableHostBufferSizePartialUsageAllowed, and PaUtilBufferProcessor::useNonAdaptingProcess.
Referenced by ProcessingThreadProc().
unsigned long PaUtil_GetBufferProcessorInputLatencyFrames | ( | PaUtilBufferProcessor * | bufferProcessor | ) |
Retrieve the input latency of a buffer processor, in frames.
bufferProcessor | The buffer processor examine. |
References PaUtilBufferProcessor::initialFramesInTempInputBuffer.
Referenced by OpenStream().
unsigned long PaUtil_GetBufferProcessorOutputLatencyFrames | ( | PaUtilBufferProcessor * | bufferProcessor | ) |
Retrieve the output latency of a buffer processor, in frames.
bufferProcessor | The buffer processor examine. |
References PaUtilBufferProcessor::initialFramesInTempOutputBuffer.
Referenced by OpenStream().
PaError PaUtil_InitializeBufferProcessor | ( | PaUtilBufferProcessor * | bufferProcessor, |
int | inputChannelCount, | ||
PaSampleFormat | userInputSampleFormat, | ||
PaSampleFormat | hostInputSampleFormat, | ||
int | outputChannelCount, | ||
PaSampleFormat | userOutputSampleFormat, | ||
PaSampleFormat | hostOutputSampleFormat, | ||
double | sampleRate, | ||
PaStreamFlags | streamFlags, | ||
unsigned long | framesPerUserBuffer, | ||
unsigned long | framesPerHostBuffer, | ||
PaUtilHostBufferSizeMode | hostBufferSizeMode, | ||
PaStreamCallback * | streamCallback, | ||
void * | userData | ||
) |
Initialize a buffer processor's representation stored in a PaUtilBufferProcessor structure. Be sure to call PaUtil_TerminateBufferProcessor after finishing with a buffer processor.
bufferProcessor | The buffer processor structure to initialize. |
inputChannelCount | The number of input channels as passed to Pa_OpenStream or 0 for an output-only stream. |
userInputSampleFormat | Format of user input samples, as passed to Pa_OpenStream. This parameter is ignored for ouput-only streams. |
hostInputSampleFormat | Format of host input samples. This parameter is ignored for output-only streams. See note about host buffer interleave below. |
outputChannelCount | The number of output channels as passed to Pa_OpenStream or 0 for an input-only stream. |
userOutputSampleFormat | Format of user output samples, as passed to Pa_OpenStream. This parameter is ignored for input-only streams. |
hostOutputSampleFormat | Format of host output samples. This parameter is ignored for input-only streams. See note about host buffer interleave below. |
sampleRate | Sample rate of the stream. The more accurate this is the better - it is used for updating time stamps when adapting buffers. |
streamFlags | Stream flags as passed to Pa_OpenStream, this parameter is used for selecting special sample conversion options such as clipping and dithering. |
framesPerUserBuffer | Number of frames per user buffer, as requested by the framesPerBuffer parameter to Pa_OpenStream. This parameter may be zero to indicate that the user will accept any (and varying) buffer sizes. |
framesPerHostBuffer | Specifies the number of frames per host buffer for the fixed buffer size mode, and the maximum number of frames per host buffer for the bounded host buffer size mode. It is ignored for the other modes. |
hostBufferSizeMode | A mode flag indicating the size variability of host buffers that will be passed to the buffer processor. See PaUtilHostBufferSizeMode for further details. |
streamCallback | The user stream callback passed to Pa_OpenStream. |
userData | The user data field passed to Pa_OpenStream. |
References PaUtilBufferProcessor::bytesPerHostInputSample, PaUtilBufferProcessor::bytesPerHostOutputSample, PaUtilBufferProcessor::bytesPerUserInputSample, PaUtilBufferProcessor::bytesPerUserOutputSample, PaUtilBufferProcessor::ditherGenerator, PaUtilBufferProcessor::framesInTempInputBuffer, PaUtilBufferProcessor::framesInTempOutputBuffer, PaUtilBufferProcessor::framesPerHostBuffer, PaUtilBufferProcessor::framesPerTempBuffer, PaUtilBufferProcessor::framesPerUserBuffer, PaUtilBufferProcessor::hostBufferSizeMode, PaUtilBufferProcessor::hostInputChannels, PaUtilBufferProcessor::hostInputIsInterleaved, PaUtilBufferProcessor::hostOutputChannels, PaUtilBufferProcessor::hostOutputIsInterleaved, PaUtilBufferProcessor::initialFramesInTempInputBuffer, PaUtilBufferProcessor::initialFramesInTempOutputBuffer, PaUtilBufferProcessor::inputChannelCount, PaUtilBufferProcessor::inputConverter, PaUtilBufferProcessor::inputZeroer, PaUtilBufferProcessor::outputChannelCount, PaUtilBufferProcessor::outputConverter, PaUtilBufferProcessor::outputZeroer, PA_FRAMES_PER_TEMP_BUFFER_WHEN_HOST_BUFFER_SIZE_IS_UNKNOWN_, Pa_GetSampleSize(), paDitherOff, paFramesPerBufferUnspecified, paInsufficientMemory, paInt24, paInt32, paInvalidFlag, paNeverDropInput, paNoError, paNonInterleaved, PaUtil_AllocateZeroInitializedMemory(), PaUtil_FreeMemory(), PaUtil_InitializeTriangularDitherState(), PaUtil_SelectConverter(), PaUtil_SelectZeroer(), paUtilBoundedHostBufferSize, paUtilFixedHostBufferSize, PaUtilBufferProcessor::samplePeriod, PaUtilBufferProcessor::streamCallback, PaUtilBufferProcessor::tempInputBuffer, PaUtilBufferProcessor::tempInputBufferPtrs, PaUtilBufferProcessor::tempOutputBuffer, PaUtilBufferProcessor::tempOutputBufferPtrs, PaUtilBufferProcessor::useNonAdaptingProcess, PaUtilBufferProcessor::userData, PaUtilBufferProcessor::userInputIsInterleaved, PaUtilBufferProcessor::userInputSampleFormatIsEqualToHost, PaUtilBufferProcessor::userOutputIsInterleaved, and PaUtilBufferProcessor::userOutputSampleFormatIsEqualToHost.
Referenced by OpenStream().
int PaUtil_IsBufferProcessorOutputEmpty | ( | PaUtilBufferProcessor * | bufferProcessor | ) |
Determine whether any callback generated output remains in the buffer processor's internal buffers. This method may be used to determine when to continue calling PaUtil_EndBufferProcessing() after the callback has returned a callbackResult of paComplete.
bufferProcessor | The buffer processor. |
References PaUtilBufferProcessor::framesInTempOutputBuffer.
void PaUtil_ResetBufferProcessor | ( | PaUtilBufferProcessor * | bufferProcessor | ) |
Clear any internally buffered data. If you call PaUtil_InitializeBufferProcessor in your OpenStream routine, make sure you call PaUtil_ResetBufferProcessor in your StartStream call.
bufferProcessor | The buffer processor to reset. |
References PaUtilBufferProcessor::bytesPerUserInputSample, PaUtilBufferProcessor::bytesPerUserOutputSample, PaUtilBufferProcessor::framesInTempInputBuffer, PaUtilBufferProcessor::framesInTempOutputBuffer, PaUtilBufferProcessor::framesPerTempBuffer, PaUtilBufferProcessor::initialFramesInTempInputBuffer, PaUtilBufferProcessor::initialFramesInTempOutputBuffer, PaUtilBufferProcessor::inputChannelCount, PaUtilBufferProcessor::outputChannelCount, PaUtilBufferProcessor::tempInputBuffer, and PaUtilBufferProcessor::tempOutputBuffer.
Referenced by PaPulseAudio_StartStreamCb().
void PaUtil_Set2ndInputChannel | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | channel, | ||
void * | data, | ||
unsigned int | stride | ||
) |
Use for the second buffer half when the input buffer is split in two halves.
References PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostInputChannels, and PaUtilChannelDescriptor::stride.
void PaUtil_Set2ndInputFrameCount | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned long | frameCount | ||
) |
Use for the second buffer half when the input buffer is split in two halves.
References PaUtilBufferProcessor::hostInputFrameCount.
void PaUtil_Set2ndInterleavedInputChannels | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | firstChannel, | ||
void * | data, | ||
unsigned int | channelCount | ||
) |
Use for the second buffer half when the input buffer is split in two halves.
References PaUtilBufferProcessor::bytesPerHostInputSample, PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostInputChannels, PaUtilBufferProcessor::hostInputIsInterleaved, PaUtilBufferProcessor::inputChannelCount, and PaUtilChannelDescriptor::stride.
void PaUtil_Set2ndInterleavedOutputChannels | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | firstChannel, | ||
void * | data, | ||
unsigned int | channelCount | ||
) |
Use for the second buffer half when the output buffer is split in two halves.
References PaUtilBufferProcessor::bytesPerHostOutputSample, PaUtilBufferProcessor::hostOutputIsInterleaved, PaUtilBufferProcessor::outputChannelCount, and PaUtil_Set2ndOutputChannel().
void PaUtil_Set2ndNonInterleavedInputChannel | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | channel, | ||
void * | data | ||
) |
Use for the second buffer half when the input buffer is split in two halves.
References PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostInputChannels, PaUtilBufferProcessor::hostInputIsInterleaved, and PaUtilChannelDescriptor::stride.
void PaUtil_Set2ndNonInterleavedOutputChannel | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | channel, | ||
void * | data | ||
) |
Use for the second buffer half when the output buffer is split in two halves.
References PaUtilBufferProcessor::hostOutputIsInterleaved, and PaUtil_Set2ndOutputChannel().
void PaUtil_Set2ndOutputChannel | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | channel, | ||
void * | data, | ||
unsigned int | stride | ||
) |
Use for the second buffer half when the output buffer is split in two halves.
References PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostOutputChannels, and PaUtilChannelDescriptor::stride.
Referenced by PaUtil_Set2ndInterleavedOutputChannels(), and PaUtil_Set2ndNonInterleavedOutputChannel().
void PaUtil_Set2ndOutputFrameCount | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned long | frameCount | ||
) |
Use for the second buffer half when the output buffer is split in two halves.
References PaUtilBufferProcessor::hostOutputFrameCount.
void PaUtil_SetInputChannel | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | channel, | ||
void * | data, | ||
unsigned int | stride | ||
) |
Provide the buffer processor with a pointer to a host input channel.
bufferProcessor | The buffer processor. |
channel | The channel number. |
data | The buffer. |
stride | The stride from one sample to the next, in samples. For interleaved host buffers, the stride will usually be the same as the number of channels in the buffer. |
References PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostInputChannels, and PaUtilChannelDescriptor::stride.
void PaUtil_SetInputFrameCount | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned long | frameCount | ||
) |
Set the number of frames in the input host buffer(s) specified by the PaUtil_Set*InputChannel functions.
bufferProcessor | The buffer processor. |
frameCount | The number of host input frames. A 0 frameCount indicates to use the framesPerHostBuffer value passed to PaUtil_InitializeBufferProcessor. |
References PaUtilBufferProcessor::framesPerHostBuffer, and PaUtilBufferProcessor::hostInputFrameCount.
Referenced by ProcessingThreadProc().
void PaUtil_SetInterleavedInputChannels | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | firstChannel, | ||
void * | data, | ||
unsigned int | channelCount | ||
) |
Provide the buffer processor with a pointer to an number of interleaved host input channels.
bufferProcessor | The buffer processor. |
firstChannel | The first channel number. |
data | The buffer. |
channelCount | The number of interleaved channels in the buffer. If channelCount is zero, the number of channels specified to PaUtil_InitializeBufferProcessor will be used. |
References PaUtilBufferProcessor::bytesPerHostInputSample, PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostInputChannels, PaUtilBufferProcessor::hostInputIsInterleaved, PaUtilBufferProcessor::inputChannelCount, and PaUtilChannelDescriptor::stride.
Referenced by ProcessingThreadProc().
void PaUtil_SetInterleavedOutputChannels | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | firstChannel, | ||
void * | data, | ||
unsigned int | channelCount | ||
) |
Provide the buffer processor with a pointer to a number of interleaved host output channels.
bufferProcessor | The buffer processor. |
firstChannel | The first channel number. |
data | The buffer. |
channelCount | The number of interleaved channels in the buffer. If channelCount is zero, the number of channels specified to PaUtil_InitializeBufferProcessor will be used. |
References PaUtilBufferProcessor::bytesPerHostOutputSample, PaUtilBufferProcessor::hostOutputIsInterleaved, PaUtilBufferProcessor::outputChannelCount, and PaUtil_SetOutputChannel().
Referenced by ProcessingThreadProc().
void PaUtil_SetNoInput | ( | PaUtilBufferProcessor * | bufferProcessor | ) |
Indicate that no input is available. This function should be used when priming the output of a full-duplex stream opened with the paPrimeOutputBuffersUsingStreamCallback flag. Note that it is not necessary to call this or any other PaUtil_Set*Input* functions for ouput-only streams.
bufferProcessor | The buffer processor. |
References PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostInputChannels, and PaUtilBufferProcessor::inputChannelCount.
void PaUtil_SetNonInterleavedInputChannel | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | channel, | ||
void * | data | ||
) |
Provide the buffer processor with a pointer to one non-interleaved host output channel.
bufferProcessor | The buffer processor. |
channel | The channel number. |
data | The buffer. |
References PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostInputChannels, PaUtilBufferProcessor::hostInputIsInterleaved, and PaUtilChannelDescriptor::stride.
void PaUtil_SetNonInterleavedOutputChannel | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | channel, | ||
void * | data | ||
) |
Provide the buffer processor with a pointer to one non-interleaved host output channel.
bufferProcessor | The buffer processor. |
channel | The channel number. |
data | The buffer. |
References PaUtilBufferProcessor::hostOutputIsInterleaved, and PaUtil_SetOutputChannel().
void PaUtil_SetNoOutput | ( | PaUtilBufferProcessor * | bufferProcessor | ) |
Indicate that the output will be discarded. This function should be used when implementing the paNeverDropInput mode for full duplex streams.
bufferProcessor | The buffer processor. |
References PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostOutputChannels, and PaUtilBufferProcessor::outputChannelCount.
void PaUtil_SetOutputChannel | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned int | channel, | ||
void * | data, | ||
unsigned int | stride | ||
) |
Provide the buffer processor with a pointer to a host output channel.
bufferProcessor | The buffer processor. |
channel | The channel number. |
data | The buffer. |
stride | The stride from one sample to the next, in samples. For interleaved host buffers, the stride will usually be the same as the number of channels in the buffer. |
References PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostOutputChannels, and PaUtilChannelDescriptor::stride.
Referenced by PaUtil_SetInterleavedOutputChannels(), and PaUtil_SetNonInterleavedOutputChannel().
void PaUtil_SetOutputFrameCount | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned long | frameCount | ||
) |
Set the number of frames in the output host buffer(s) specified by the PaUtil_Set*OutputChannel functions.
bufferProcessor | The buffer processor. |
frameCount | The number of host output frames. A 0 frameCount indicates to use the framesPerHostBuffer value passed to PaUtil_InitializeBufferProcessor. |
References PaUtilBufferProcessor::framesPerHostBuffer, and PaUtilBufferProcessor::hostOutputFrameCount.
Referenced by ProcessingThreadProc().
void PaUtil_TerminateBufferProcessor | ( | PaUtilBufferProcessor * | bufferProcessor | ) |
Terminate a buffer processor's representation. Deallocates any temporary buffers allocated by PaUtil_InitializeBufferProcessor.
bufferProcessor | The buffer processor structure to terminate. |
References PaUtilBufferProcessor::hostInputChannels, PaUtilBufferProcessor::hostOutputChannels, PaUtil_FreeMemory(), PaUtilBufferProcessor::tempInputBuffer, PaUtilBufferProcessor::tempInputBufferPtrs, PaUtilBufferProcessor::tempOutputBuffer, and PaUtilBufferProcessor::tempOutputBufferPtrs.
Referenced by PaPulseAudio_CloseStreamCb().
unsigned long PaUtil_ZeroOutput | ( | PaUtilBufferProcessor * | bufferProcessor, |
unsigned long | frameCount | ||
) |
References PaUtilBufferProcessor::bytesPerHostOutputSample, PaUtilChannelDescriptor::data, PaUtilBufferProcessor::hostOutputChannels, PaUtilBufferProcessor::hostOutputFrameCount, PaUtilBufferProcessor::outputChannelCount, PaUtilBufferProcessor::outputZeroer, PA_MIN_, and PaUtilChannelDescriptor::stride.
Referenced by ProcessingThreadProc().