PortAudio
2.0
|
#include "pa_mac_core_blocking.h"
#include "pa_mac_core_internal.h"
#include <assert.h>
#include <libkern/OSAtomic.h>
Functions | |
PaError | initializeBlioRingBuffers (PaMacBlio *blio, PaSampleFormat inputSampleFormat, PaSampleFormat outputSampleFormat, long ringBufferSizeInFrames, int inChan, int outChan) |
PaError | resetBlioRingBuffers (PaMacBlio *blio) |
PaError | destroyBlioRingBuffers (PaMacBlio *blio) |
int | BlioCallback (const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData) |
PaError | ReadStream (PaStream *stream, void *buffer, unsigned long framesRequested) |
PaError | WriteStream (PaStream *stream, const void *buffer, unsigned long framesRequested) |
PaError | waitUntilBlioWriteBufferIsEmpty (PaMacBlio *blio, double sampleRate, size_t framesPerBuffer) |
signed long | GetStreamReadAvailable (PaStream *stream) |
signed long | GetStreamWriteAvailable (PaStream *stream) |
This file contains the implementation required for blocking I/O. It is separated from pa_mac_core.c simply to ease development.
int BlioCallback | ( | const void * | input, |
void * | output, | ||
unsigned long | frameCount, | ||
const PaStreamCallbackTimeInfo * | timeInfo, | ||
PaStreamCallbackFlags | statusFlags, | ||
void * | userData | ||
) |
References PaMacBlio::inChan, PaMacBlio::inputRingBuffer, PaMacBlio::outChan, PaMacBlio::outputRingBuffer, PaMacBlio::outputSampleSizeActual, paContinue, paInputOverflow, paOutputUnderflow, PaUtil_GetRingBufferReadAvailable(), PaUtil_GetRingBufferWriteAvailable(), PaUtil_ReadRingBuffer(), PaUtil_WriteRingBuffer(), and PaMacBlio::statusFlags.
References PaUtilRingBuffer::buffer, PaMacBlio::inputRingBuffer, PaMacBlio::outputRingBuffer, paNoError, and UNIX_ERR.
Referenced by initializeBlioRingBuffers().
static signed long GetStreamReadAvailable | ( | PaStream * | stream | ) |
References GetStreamReadAvailable(), PaMacBlio::inputRingBuffer, PaUtil_GetRingBufferReadAvailable(), and VVDBUG.
Referenced by GetStreamReadAvailable(), PaMacCore_Initialize(), PaOSS_Initialize(), PaSkeleton_Initialize(), PaWasapi_Initialize(), PaWinDs_Initialize(), PaWinMme_Initialize(), and PaWinWdm_Initialize().
static signed long GetStreamWriteAvailable | ( | PaStream * | stream | ) |
References GetStreamWriteAvailable(), PaMacBlio::outputRingBuffer, PaUtil_GetRingBufferWriteAvailable(), and VVDBUG.
Referenced by GetStreamWriteAvailable(), PaMacCore_Initialize(), PaOSS_Initialize(), PaSkeleton_Initialize(), PaWasapi_Initialize(), PaWinDs_Initialize(), PaWinMme_Initialize(), and PaWinWdm_Initialize().
PaError initializeBlioRingBuffers | ( | PaMacBlio * | blio, |
PaSampleFormat | inputSampleFormat, | ||
PaSampleFormat | outputSampleFormat, | ||
long | ringBufferSizeInFrames, | ||
int | inChan, | ||
int | outChan | ||
) |
This should be called with the relevant info when initializing a stream for callback.
ringBufferSizeInFrames | must be a power of 2 |
References PaUtilRingBuffer::buffer, destroyBlioRingBuffers(), PaMacBlio::errors, PaMacBlio::inChan, PaMacBlio::inputRingBuffer, PaMacBlio::inputSampleFormat, PaMacBlio::inputSampleSizeActual, PaMacBlio::inputSampleSizePow2, PaMacBlio::outChan, PaMacBlio::outputRingBuffer, PaMacBlio::outputSampleFormat, PaMacBlio::outputSampleSizeActual, PaMacBlio::outputSampleSizePow2, paInsufficientMemory, PaMacCore_SetUnixError(), paNoError, PaUtil_InitializeRingBuffer(), resetBlioRingBuffers(), PaMacBlio::ringBufferFrames, PaMacBlio::statusFlags, and UNIX_ERR.
References PaMacBlio::inChan, PaMacBlio::inputRingBuffer, PaMacBlio::inputSampleSizeActual, MIN, PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL, Pa_Sleep(), paInputOverflow, paInputOverflowed, paNoError, PaUtil_GetRingBufferReadAvailable(), PaUtil_ReadRingBuffer(), ReadStream(), PaMacBlio::statusFlags, UNIX_ERR, and VVDBUG.
Referenced by PaMacCore_Initialize(), PaOSS_Initialize(), PaSkeleton_Initialize(), PaWasapi_Initialize(), PaWinDs_Initialize(), PaWinMme_Initialize(), PaWinWdm_Initialize(), and ReadStream().
References PaUtilRingBuffer::buffer, PaUtilRingBuffer::bufferSize, PaUtilRingBuffer::elementSizeBytes, PaMacBlio::inputRingBuffer, PaMacBlio::outputRingBuffer, paNoError, PaUtil_AdvanceRingBufferWriteIndex(), PaUtil_FlushRingBuffer(), PaMacBlio::ringBufferFrames, and PaMacBlio::statusFlags.
Referenced by initializeBlioRingBuffers().
static PaError WriteStream | ( | PaStream * | stream, |
const void * | buffer, | ||
unsigned long | framesRequested | ||
) |
References PaMacCoreStream::blio, MIN, PaMacBlio::outChan, PaMacBlio::outputRingBuffer, PaMacBlio::outputSampleSizeActual, PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL, Pa_Sleep(), paInternalError, paNoError, paOutputUnderflow, paOutputUnderflowed, PaUtil_GetRingBufferWriteAvailable(), PaUtil_WriteRingBuffer(), PaMacCoreStream::state, PaMacBlio::statusFlags, UNIX_ERR, VVDBUG, and WriteStream().
Referenced by PaMacCore_Initialize(), PaOSS_Initialize(), PaSkeleton_Initialize(), PaWasapi_Initialize(), PaWinDs_Initialize(), PaWinMme_Initialize(), PaWinWdm_Initialize(), and WriteStream().