PortAudio
2.0
|
PulseAudio implementation of support for a host API. More...
#include "pa_linux_pulseaudio_cb_internal.h"
#include "pa_linux_pulseaudio_block_internal.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <pulse/pulseaudio.h>
Functions | |
int | PaPulseAudio_CheckConnection (PaPulseAudio_HostApiRepresentation *ptr) |
PaPulseAudio_HostApiRepresentation * | PaPulseAudio_New (void) |
void | PaPulseAudio_Free (PaPulseAudio_HostApiRepresentation *ptr) |
void | PaPulseAudio_CheckContextStateCb (pa_context *c, void *userdata) |
void | PaPulseAudio_ServerInfoCb (pa_context *c, const pa_server_info *i, void *userdata) |
int | _PaPulseAudio_AddAudioDevice (PaPulseAudio_HostApiRepresentation *hostapi, const char *PaPulseAudio_SinkSourceName, const char *PaPulseAudio_SinkSourceNameDesc, int inputChannels, int outputChannels, double defaultLowInputLatency, double defaultHighInputLatency, double defaultLowOutputLatency, double defaultHighOutputLatency, const long defaultSampleRate) |
void | PaPulseAudio_SinkListCb (pa_context *c, const pa_sink_info *l, int eol, void *userdata) |
void | PaPulseAudio_SourceListCb (pa_context *c, const pa_source_info *l, int eol, void *userdata) |
void | PaPulseAudio_StreamStateCb (pa_stream *s, void *userdata) |
void | PaPulseAudio_StreamUnderflowCb (pa_stream *s, void *userdata) |
PaError | PaPulseAudio_Initialize (PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex) |
void | Terminate (struct PaUtilHostApiRepresentation *hostApi) |
PaError | IsFormatSupported (struct PaUtilHostApiRepresentation *hostApi, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate) |
PaError | PaPulseAudio_ConvertPortaudioFormatToPaPulseAudio_ (PaSampleFormat portaudiosf, pa_sample_spec *pulseaudiosf) |
PaError | PaPulseAudio_BlockingInitRingBuffer (PaUtilRingBuffer *rbuf, int size) |
PaError | OpenStream (struct PaUtilHostApiRepresentation *hostApi, PaStream **s, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate, unsigned long framesPerBuffer, PaStreamFlags streamFlags, PaStreamCallback *streamCallback, void *userData) |
PaError | IsStreamStopped (PaStream *s) |
PaError | IsStreamActive (PaStream *s) |
PaTime | GetStreamTime (PaStream *s) |
double | GetStreamCpuLoad (PaStream *s) |
PaError | PaPulseAudio_RenameSource (PaStream *s, const char *streamName) |
PaError | PaPulseAudio_RenameSink (PaStream *s, const char *streamName) |
Variables | |
char * | __progname |
PulseAudio implementation of support for a host API.
This host API implements PulseAudio support for portaudio it has callbackmode and normal write mode support
int _PaPulseAudio_AddAudioDevice | ( | PaPulseAudio_HostApiRepresentation * | hostapi, |
const char * | PaPulseAudio_SinkSourceName, | ||
const char * | PaPulseAudio_SinkSourceNameDesc, | ||
int | inputChannels, | ||
int | outputChannels, | ||
double | defaultLowInputLatency, | ||
double | defaultHighInputLatency, | ||
double | defaultLowOutputLatency, | ||
double | defaultHighOutputLatency, | ||
const long | defaultSampleRate | ||
) |
References PaPulseAudio_HostApiRepresentation::allocations, PaDeviceInfo::defaultHighInputLatency, PaDeviceInfo::defaultHighOutputLatency, PaDeviceInfo::defaultLowInputLatency, PaDeviceInfo::defaultLowOutputLatency, PaDeviceInfo::defaultSampleRate, PaPulseAudio_HostApiRepresentation::deviceCount, PaPulseAudio_HostApiRepresentation::deviceInfoArray, PaDeviceInfo::hostApi, PaPulseAudio_HostApiRepresentation::hostApiIndex, PaDeviceInfo::maxInputChannels, PaDeviceInfo::maxOutputChannels, PaDeviceInfo::name, PA_PULSEAUDIO_SET_LAST_HOST_ERROR, paDeviceUnavailable, paInsufficientMemory, paNoError, PAPULSEAUDIO_MAX_DEVICECOUNT, PAPULSEAUDIO_MAX_DEVICENAME, PaUtil_GroupAllocateZeroInitializedMemory(), PaPulseAudio_HostApiRepresentation::pulseaudioDeviceNames, and PaDeviceInfo::structVersion.
Referenced by PaPulseAudio_Initialize(), PaPulseAudio_SinkListCb(), and PaPulseAudio_SourceListCb().
static double GetStreamCpuLoad | ( | PaStream * | s | ) |
References PaStreamCallbackTimeInfo::currentTime, GetStreamTime(), PaPulseAudio_Stream::hostapi, PaPulseAudio_Stream::inputStream, PaPulseAudio_HostApiRepresentation::mainloop, PaPulseAudio_Stream::outputStream, PaPulseAudio_Lock(), PaPulseAudio_UnLock(), and PaPulseAudio_updateTimeInfo().
Referenced by GetStreamTime(), PaPulseAudio_Initialize(), PaSkeleton_Initialize(), PaSndio_Initialize(), PaWasapi_Initialize(), PaWinMme_Initialize(), and PaWinWdm_Initialize().
static PaError IsFormatSupported | ( | struct PaUtilHostApiRepresentation * | hostApi, |
const PaStreamParameters * | inputParameters, | ||
const PaStreamParameters * | outputParameters, | ||
double | sampleRate | ||
) |
References PaStreamParameters::channelCount, PaStreamParameters::device, PaUtilHostApiRepresentation::deviceInfos, PaStreamParameters::hostApiSpecificStreamInfo, IsFormatSupported(), PaDeviceInfo::maxInputChannels, PaDeviceInfo::maxOutputChannels, paCustomFormat, paFormatIsSupported, paIncompatibleHostApiSpecificStreamInfo, paInvalidChannelCount, paInvalidDevice, paSampleFormatNotSupported, paUseHostApiSpecificDeviceSpecification, and PaStreamParameters::sampleFormat.
Referenced by IsFormatSupported(), PaPulseAudio_Initialize(), PaSndio_Initialize(), PaWasapi_Initialize(), PaWinMme_Initialize(), and PaWinWdm_Initialize().
References PaPulseAudio_Stream::isActive, and IsStreamActive().
Referenced by IsStreamActive(), PaPulseAudio_Initialize(), PaSkeleton_Initialize(), PaSndio_Initialize(), PaWasapi_Initialize(), PaWinMme_Initialize(), and PaWinWdm_Initialize().
References PaPulseAudio_Stream::isStopped, and IsStreamStopped().
Referenced by IsStreamStopped(), PaPulseAudio_Initialize(), PaSkeleton_Initialize(), PaSndio_Initialize(), PaWasapi_Initialize(), PaWinMme_Initialize(), and PaWinWdm_Initialize().
static PaError OpenStream | ( | struct PaUtilHostApiRepresentation * | hostApi, |
PaStream ** | s, | ||
const PaStreamParameters * | inputParameters, | ||
const PaStreamParameters * | outputParameters, | ||
double | sampleRate, | ||
unsigned long | framesPerBuffer, | ||
PaStreamFlags | streamFlags, | ||
PaStreamCallback * | streamCallback, | ||
void * | userData | ||
) |
References PaPulseAudio_HostApiRepresentation::blockingStreamInterface, PaPulseAudio_Stream::bufferProcessor, PaPulseAudio_HostApiRepresentation::callbackStreamInterface, PaStreamParameters::channelCount, PaPulseAudio_HostApiRepresentation::context, PaPulseAudio_Stream::context, PaPulseAudio_Stream::cpuLoadMeasurer, PaStreamParameters::device, PaUtilHostApiRepresentation::deviceInfos, PaPulseAudio_Stream::framesPerHostCallback, PaPulseAudio_Stream::hostapi, PaStreamParameters::hostApiSpecificStreamInfo, PaPulseAudio_Stream::inputChannelCount, PaPulseAudio_Stream::inputDevice, PaPulseAudio_Stream::inputFrameSize, PaStreamInfo::inputLatency, PaPulseAudio_Stream::inputRing, PaPulseAudio_Stream::inputSampleSpec, PaPulseAudio_Stream::inputStream, PaPulseAudio_Stream::inputStreamName, PaPulseAudio_Stream::isActive, PaPulseAudio_Stream::isStopped, PaPulseAudio_HostApiRepresentation::mainloop, PaPulseAudio_Stream::mainloop, PaPulseAudio_Stream::maxFramesHostPerBuffer, PaPulseAudio_Stream::maxFramesPerBuffer, PaDeviceInfo::maxInputChannels, PaDeviceInfo::maxOutputChannels, OpenStream(), PaPulseAudio_Stream::outputChannelCount, PaPulseAudio_Stream::outputDevice, PaPulseAudio_Stream::outputFrameSize, PaStreamInfo::outputLatency, PaPulseAudio_Stream::outputSampleSpec, PaPulseAudio_Stream::outputStream, PaPulseAudio_Stream::outputStreamName, PA_DEBUG, Pa_GetSampleSize(), paFloat32, paFramesPerBufferUnspecified, paIncompatibleHostApiSpecificStreamInfo, paInsufficientMemory, paInvalidChannelCount, paInvalidDevice, paInvalidFlag, paNoError, paPlatformSpecificFlags, PaPulseAudio_BlockingInitRingBuffer(), PaPulseAudio_ConvertPortaudioFormatToPaPulseAudio_(), PAPULSEAUDIO_FRAMESPERBUFFERUNSPEC, PaPulseAudio_Lock(), PaPulseAudio_StreamStartedCb(), PaPulseAudio_StreamStateCb(), PaPulseAudio_StreamUnderflowCb(), PaPulseAudio_UnLock(), paUnanticipatedHostError, paUseHostApiSpecificDeviceSpecification, PaUtil_AllocateZeroInitializedMemory(), PaUtil_FreeMemory(), PaUtil_GetBufferProcessorInputLatencyFrames(), PaUtil_GetBufferProcessorOutputLatencyFrames(), PaUtil_InitializeBufferProcessor(), PaUtil_InitializeCpuLoadMeasurer(), PaUtil_InitializeStreamRepresentation(), PaUtil_SelectClosestAvailableFormat(), paUtilUnknownHostBufferSize, PaPulseAudio_Stream::pulseaudioIsActive, PaPulseAudio_Stream::pulseaudioIsStopped, PaStreamParameters::sampleFormat, PaStreamInfo::sampleRate, PaUtilStreamRepresentation::streamInfo, PaPulseAudio_Stream::streamRepresentation, PaStreamParameters::suggestedLatency, and PaPulseAudio_Stream::suggestedLatencyUSecs.
Referenced by OpenStream(), PaPulseAudio_Initialize(), PaSndio_Initialize(), PaWasapi_Initialize(), PaWinMme_Initialize(), and PaWinWdm_Initialize().
PaError PaPulseAudio_BlockingInitRingBuffer | ( | PaUtilRingBuffer * | rbuf, |
int | size | ||
) |
References PA_DEBUG, PA_PULSEAUDIO_SET_LAST_HOST_ERROR, paInsufficientMemory, paNoError, paNotInitialized, and PaUtil_InitializeRingBuffer().
Referenced by OpenStream().
int PaPulseAudio_CheckConnection | ( | PaPulseAudio_HostApiRepresentation * | ptr | ) |
References PaPulseAudio_HostApiRepresentation::context, and PA_DEBUG.
Referenced by PaPulseAudio_Initialize().
void PaPulseAudio_CheckContextStateCb | ( | pa_context * | c, |
void * | userdata | ||
) |
References PaPulseAudio_HostApiRepresentation::mainloop, and PA_PULSEAUDIO_SET_LAST_HOST_ERROR.
Referenced by PaPulseAudio_New().
PaError PaPulseAudio_ConvertPortaudioFormatToPaPulseAudio_ | ( | PaSampleFormat | portaudiosf, |
pa_sample_spec * | pulseaudiosf | ||
) |
References PA_DEBUG, paCustomFormat, paFloat32, paInt16, paInt24, paInt32, paInt8, paNoError, paNonInterleaved, paSampleFormatNotSupported, and paUInt8.
Referenced by OpenStream().
void PaPulseAudio_Free | ( | PaPulseAudio_HostApiRepresentation * | ptr | ) |
References PaPulseAudio_HostApiRepresentation::allocations, PaPulseAudio_HostApiRepresentation::context, PaPulseAudio_HostApiRepresentation::mainloop, PaPulseAudio_HostApiRepresentation::mainloopApi, PA_PULSEAUDIO_SET_LAST_HOST_ERROR, PaUtil_DestroyAllocationGroup(), PaUtil_FreeAllAllocations(), PaUtil_FreeMemory(), and PaPulseAudio_HostApiRepresentation::timeEvent.
Referenced by PaPulseAudio_Initialize(), PaPulseAudio_New(), and Terminate().
PaError PaPulseAudio_Initialize | ( | PaUtilHostApiRepresentation ** | hostApi, |
PaHostApiIndex | hostApiIndex | ||
) |
References _PaPulseAudio_AddAudioDevice(), PaPulseAudio_HostApiRepresentation::allocations, PaPulseAudio_HostApiRepresentation::blockingStreamInterface, PaPulseAudio_HostApiRepresentation::callbackStreamInterface, PaPulseAudio_HostApiRepresentation::context, PaHostApiInfo::defaultInputDevice, PaHostApiInfo::defaultOutputDevice, PaPulseAudio_HostApiRepresentation::deviceCount, PaPulseAudio_HostApiRepresentation::deviceInfoArray, GetStreamCpuLoad(), GetStreamTime(), PaPulseAudio_HostApiRepresentation::hostApiIndex, PaUtilHostApiRepresentation::info, PaPulseAudio_HostApiRepresentation::inheritedHostApiRep, IsFormatSupported(), IsStreamActive(), IsStreamStopped(), PaPulseAudio_HostApiRepresentation::mainloop, OpenStream(), PA_DEBUG, PA_PULSEAUDIO_DEFAULT_MAX_LATENCY, PA_PULSEAUDIO_DEFAULT_MIN_LATENCY, PA_PULSEAUDIO_SET_LAST_HOST_ERROR, paInsufficientMemory, paNoDevice, paNoError, paPulseAudio, PaPulseAudio_AbortStreamCb(), PaPulseAudio_CheckConnection(), PaPulseAudio_CloseStreamCb(), PaPulseAudio_Free(), PaPulseAudio_GetStreamReadAvailableBlock(), PaPulseAudio_Lock(), PAPULSEAUDIO_MAX_DEVICECOUNT, PaPulseAudio_New(), PaPulseAudio_ReadStreamBlock(), PaPulseAudio_ReleaseOperation(), PaPulseAudio_ServerInfoCb(), PaPulseAudio_SinkListCb(), PaPulseAudio_SourceListCb(), PaPulseAudio_StartStreamCb(), PaPulseAudio_StopStreamCb(), PaPulseAudio_UnLock(), PaPulseAudio_WriteStreamBlock(), paUnanticipatedHostError, PaUtil_CreateAllocationGroup(), PaUtil_DummyGetCpuLoad(), PaUtil_DummyGetReadAvailable(), PaUtil_DummyGetWriteAvailable(), PaUtil_DummyRead(), PaUtil_DummyWrite(), PaUtil_GroupAllocateZeroInitializedMemory(), PaUtil_InitializeStreamInterface(), PaPulseAudio_HostApiRepresentation::pulseaudioDefaultSampleSpec, PaPulseAudio_HostApiRepresentation::pulseaudioDeviceNames, PaHostApiInfo::structVersion, and Terminate().
PaPulseAudio_HostApiRepresentation* PaPulseAudio_New | ( | void | ) |
References __progname, PaPulseAudio_HostApiRepresentation::context, PaPulseAudio_HostApiRepresentation::deviceCount, PaPulseAudio_HostApiRepresentation::mainloop, PaPulseAudio_HostApiRepresentation::mainloopApi, PA_PULSEAUDIO_SET_LAST_HOST_ERROR, PaPulseAudio_CheckContextStateCb(), PaPulseAudio_Free(), PAPULSEAUDIO_MAX_DEVICENAME, and PaUtil_AllocateZeroInitializedMemory().
Referenced by PaPulseAudio_Initialize().
Renames the PulseAudio description for the sink that is opened by PortAudio.
s | The PortAudio stream to operate on. |
streamName | The new name/description of the sink. |
References PaPulseAudio_Stream::hostapi, PaPulseAudio_Stream::mainloop, PaPulseAudio_Stream::outputStream, PaPulseAudio_Stream::outputStreamName, paInsufficientMemory, paInvalidDevice, paNoError, PaPulseAudio_Lock(), PAPULSEAUDIO_MAX_DEVICENAME, PaPulseAudio_ReleaseOperation(), PaPulseAudio_UnLock(), PaUtil_AllocateZeroInitializedMemory(), and PaUtil_FreeMemory().
Renames the PulseAudio description for the source that is opened by PortAudio.
s | The PortAudio stream to operate on. |
streamName | The new name/description of the source. |
References PaPulseAudio_Stream::hostapi, PaPulseAudio_Stream::inputStream, PaPulseAudio_Stream::inputStreamName, PaPulseAudio_Stream::mainloop, paInsufficientMemory, paInvalidDevice, paNoError, PaPulseAudio_Lock(), PAPULSEAUDIO_MAX_DEVICENAME, PaPulseAudio_ReleaseOperation(), PaPulseAudio_UnLock(), PaUtil_AllocateZeroInitializedMemory(), and PaUtil_FreeMemory().
void PaPulseAudio_ServerInfoCb | ( | pa_context * | c, |
const pa_server_info * | i, | ||
void * | userdata | ||
) |
void PaPulseAudio_SinkListCb | ( | pa_context * | c, |
const pa_sink_info * | l, | ||
int | eol, | ||
void * | userdata | ||
) |
void PaPulseAudio_SourceListCb | ( | pa_context * | c, |
const pa_source_info * | l, | ||
int | eol, | ||
void * | userdata | ||
) |
void PaPulseAudio_StreamStateCb | ( | pa_stream * | s, |
void * | userdata | ||
) |
References PA_DEBUG, and PA_PULSEAUDIO_SET_LAST_HOST_ERROR.
Referenced by OpenStream().
void PaPulseAudio_StreamUnderflowCb | ( | pa_stream * | s, |
void * | userdata | ||
) |
References PaPulseAudio_Stream::mainloop, PaPulseAudio_Stream::outputUnderflows, and PA_DEBUG.
Referenced by OpenStream().
static void Terminate | ( | struct PaUtilHostApiRepresentation * | hostApi | ) |
References PaPulseAudio_HostApiRepresentation::context, PaPulseAudio_HostApiRepresentation::mainloop, PaPulseAudio_Free(), PaPulseAudio_Lock(), PaPulseAudio_UnLock(), and Terminate().
Referenced by PaPulseAudio_Initialize(), PaSndio_Initialize(), PaWasapi_Initialize(), PaWinMme_Initialize(), PaWinWdm_Initialize(), and Terminate().
char* __progname |
Referenced by PaPulseAudio_New().