PortAudio  2.0
Functions | Variables
pa_linux_pulseaudio.c File Reference

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_HostApiRepresentationPaPulseAudio_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
 

Detailed Description

PulseAudio implementation of support for a host API.

This host API implements PulseAudio support for portaudio it has callbackmode and normal write mode support

Function Documentation

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 
)
static double GetStreamCpuLoad ( PaStream s)
static PaTime GetStreamTime ( PaStream s)
static PaError IsFormatSupported ( struct PaUtilHostApiRepresentation hostApi,
const PaStreamParameters inputParameters,
const PaStreamParameters outputParameters,
double  sampleRate 
)
static PaError IsStreamActive ( PaStream s)
static PaError IsStreamStopped ( PaStream s)
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 
)
int PaPulseAudio_CheckConnection ( PaPulseAudio_HostApiRepresentation ptr)
void PaPulseAudio_CheckContextStateCb ( pa_context *  c,
void *  userdata 
)
PaError PaPulseAudio_ConvertPortaudioFormatToPaPulseAudio_ ( PaSampleFormat  portaudiosf,
pa_sample_spec *  pulseaudiosf 
)
void PaPulseAudio_Free ( PaPulseAudio_HostApiRepresentation ptr)
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  )
PaError PaPulseAudio_RenameSink ( PaStream s,
const char *  streamName 
)

Renames the PulseAudio description for the sink that is opened by PortAudio.

Parameters
sThe PortAudio stream to operate on.
streamNameThe new name/description of the sink.
Returns
paNoError on success or the error encountered otherwise.

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().

PaError PaPulseAudio_RenameSource ( PaStream s,
const char *  streamName 
)

Renames the PulseAudio description for the source that is opened by PortAudio.

Parameters
sThe PortAudio stream to operate on.
streamNameThe new name/description of the source.
Returns
paNoError on success or the error encountered otherwise.

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 
)
static void Terminate ( struct PaUtilHostApiRepresentation hostApi)

Variable Documentation

char* __progname

Referenced by PaPulseAudio_New().