43 #ifndef _PA_HOSTAPI_PULSEAUDIO_H_
44 #define _PA_HOSTAPI_PULSEAUDIO_H_
60 #include <pulse/pulseaudio.h>
69 #define PA_PULSEAUDIO_SET_LAST_HOST_ERROR(errorCode, errorText) \
70 PaUtil_SetLastHostErrorInfo(paInDevelopment, errorCode, errorText)
72 #define PAPULSEAUDIO_MAX_DEVICECOUNT 1024
73 #define PAPULSEAUDIO_MAX_DEVICENAME 1024
76 #define PA_PULSEAUDIO_DEFAULT_MIN_LATENCY 0.010
77 #define PA_PULSEAUDIO_DEFAULT_MAX_LATENCY 0.080
80 #define PAPULSEAUDIO_FRAMESPERBUFFERUNSPEC 32
86 #define PULSEAUDIO_BUFFER_SIZE (96100 * 4 * 2)
178 #define PA_PULSEAUDIO_IS_ERROR(pastream, errorCode) \
180 !(pastream)->context || \
181 !PA_CONTEXT_IS_GOOD( pa_context_get_state( (pastream)->context ) ) || \
182 ( (pastream)->outputStream && \
183 !PA_STREAM_IS_GOOD( pa_stream_get_state( (pastream)->outputStream ) ) ) || \
184 ( (pastream)->inputStream && \
185 !PA_STREAM_IS_GOOD( pa_stream_get_state( (pastream)->inputStream ) ) ) ) \
188 ( (pastream)->context && \
189 pa_context_get_state( (pastream)->context ) == PA_CONTEXT_FAILED ) || \
190 ( (pastream)->outputStream && \
191 pa_stream_get_state( (pastream)->outputStream ) == PA_STREAM_FAILED ) || \
192 ( (pastream)->inputStream && \
193 pa_stream_get_state( (pastream)->inputStream ) == PA_STREAM_FAILED ) ) \
198 if( !(pastream)->isActive || (pastream)->isStopped ) \
200 return paStreamIsStopped; \
204 pa_operation **pulseaudioOperation);
226 unsigned long framesPerBuffer,
245 const pa_server_info *i,
249 const pa_sink_info * l,
254 const pa_source_info * l,
268 pa_sample_spec * pulseaudiosf
PaUtilStreamRepresentation streamRepresentation
Definition: pa_linux_pulseaudio_internal.h:114
pa_buffer_attr inputBufferAttr
Definition: pa_linux_pulseaudio_internal.h:127
void Terminate(struct PaUtilHostApiRepresentation *hostApi)
Definition: pa_linux_pulseaudio.c:807
struct PaPulseAudio_Stream PaPulseAudio_Stream
Single-reader single-writer lock-free ring buffer.
pa_buffer_attr outputBufferAttr
Definition: pa_linux_pulseaudio_internal.h:126
int PaHostApiIndex
Definition: portaudio.h:240
Definition: pa_cpuload.h:56
PaUtilStreamInterface callbackStreamInterface
Definition: pa_linux_pulseaudio_internal.h:91
pa_threaded_mainloop * mainloop
Definition: pa_linux_pulseaudio_internal.h:102
PaUtilRingBuffer inputRing
Definition: pa_linux_pulseaudio_internal.h:144
void PaStream
Definition: portaudio.h:644
Definition: pa_ringbuffer.h:93
double GetStreamCpuLoad(PaStream *s)
Definition: pa_linux_pulseaudio.c:1426
Definition: portaudio.h:505
volatile sig_atomic_t isActive
Definition: pa_linux_pulseaudio_internal.h:169
pa_time_event * timeEvent
Definition: pa_linux_pulseaudio_internal.h:106
int outputChannelCount
Definition: pa_linux_pulseaudio_internal.h:130
Definition: pa_linux_pulseaudio_internal.h:112
void PaPulseAudio_Lock(pa_threaded_mainloop *mainloop)
Definition: pa_linux_pulseaudio_cb.c:154
volatile sig_atomic_t pulseaudioIsStopped
Definition: pa_linux_pulseaudio_internal.h:172
void PaPulseAudio_StreamStateCb(pa_stream *s, void *userdata)
Definition: pa_linux_pulseaudio.c:471
PaDeviceIndex outputDevice
Definition: pa_linux_pulseaudio_internal.h:139
PaError IsFormatSupported(struct PaUtilHostApiRepresentation *hostApi, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate)
Definition: pa_linux_pulseaudio.c:820
int PaStreamCallback(const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
Definition: portaudio.h:839
size_t maxFramesPerBuffer
Definition: pa_linux_pulseaudio_internal.h:133
int PaPulseAudio_CheckConnection(PaPulseAudio_HostApiRepresentation *ptr)
Definition: pa_linux_pulseaudio.c:67
PaPulseAudio_HostApiRepresentation * PaPulseAudio_New(void)
Definition: pa_linux_pulseaudio.c:141
pa_sample_spec inputSampleSpec
Definition: pa_linux_pulseaudio_internal.h:123
PaError OpenStream(struct PaUtilHostApiRepresentation *hostApi, PaStream **s, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate, unsigned long framesPerBuffer, PaStreamFlags streamFlags, PaStreamCallback *streamCallback, void *userData)
Definition: pa_linux_pulseaudio.c:1000
PaUtilAllocationGroup * allocations
Definition: pa_linux_pulseaudio_internal.h:94
void PaPulseAudio_StreamUnderflowCb(pa_stream *s, void *userdata)
Definition: pa_linux_pulseaudio.c:535
void PaPulseAudio_StreamStartedCb(pa_stream *stream, void *userdata)
Definition: pa_linux_pulseaudio_cb.c:497
pa_threaded_mainloop * mainloop
Definition: pa_linux_pulseaudio_internal.h:120
char * inputStreamName
Definition: pa_linux_pulseaudio_internal.h:142
int PaDeviceIndex
Definition: portaudio.h:214
Buffer Processor prototypes. A Buffer Processor performs buffer length adaption, coordinates sample f...
int deviceCount
Definition: pa_linux_pulseaudio_internal.h:105
Definition: pa_stream.h:67
pa_context * context
Definition: pa_linux_pulseaudio_internal.h:121
Allocation Group prototypes. An Allocation Group makes it easy to allocate multiple blocks of memory ...
Interfaces and representation structures used by pa_front.c to manage and communicate with host API i...
unsigned int suggestedLatencyUSecs
Definition: pa_linux_pulseaudio_internal.h:128
PaError IsStreamActive(PaStream *s)
Definition: pa_linux_pulseaudio.c:1386
unsigned long framesPerHostCallback
Definition: pa_linux_pulseaudio_internal.h:119
void PaPulseAudio_CheckContextStateCb(pa_context *c, void *userdata)
Definition: pa_linux_pulseaudio.c:257
void PaPulseAudio_ReleaseOperation(PaPulseAudio_HostApiRepresentation *hostapi, pa_operation **operation)
Definition: pa_linux_pulseaudio_cb.c:109
Stream interfaces, representation structures and helper functions used to interface between pa_front...
pa_context * context
Definition: pa_linux_pulseaudio_internal.h:104
void PaPulseAudio_UnLock(pa_threaded_mainloop *mainloop)
Definition: pa_linux_pulseaudio_cb.c:162
Definition: pa_allocation.h:65
void PaPulseAudio_SinkListCb(pa_context *c, const pa_sink_info *l, int eol, void *userdata)
Definition: pa_linux_pulseaudio.c:367
unsigned long PaStreamFlags
Definition: portaudio.h:662
int PaError
Definition: portaudio.h:122
Definition: pa_stream.h:147
pa_sample_spec pulseaudioDefaultSampleSpec
Definition: pa_linux_pulseaudio_internal.h:99
PaUtilHostApiRepresentation inheritedHostApiRep
Definition: pa_linux_pulseaudio_internal.h:90
int inputChannelCount
Definition: pa_linux_pulseaudio_internal.h:131
Definition: portaudio.h:547
pa_stream * outputStream
Definition: pa_linux_pulseaudio_internal.h:124
volatile sig_atomic_t pulseaudioIsActive
Definition: pa_linux_pulseaudio_internal.h:171
int outputUnderflows
Definition: pa_linux_pulseaudio_internal.h:129
PaUtilBufferProcessor bufferProcessor
Definition: pa_linux_pulseaudio_internal.h:116
unsigned long PaSampleFormat
Definition: portaudio.h:489
PaPulseAudio_HostApiRepresentation * hostapi
Definition: pa_linux_pulseaudio_internal.h:117
PaError PaPulseAudio_Initialize(PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex)
Definition: pa_linux_pulseaudio.c:561
void PaPulseAudio_Free(PaPulseAudio_HostApiRepresentation *ptr)
Definition: pa_linux_pulseaudio.c:206
volatile sig_atomic_t isStopped
Definition: pa_linux_pulseaudio_internal.h:170
pa_mainloop_api * mainloopApi
Definition: pa_linux_pulseaudio_internal.h:103
Prototypes for utility functions used by PortAudio implementations.
PaUtilCpuLoadMeasurer cpuLoadMeasurer
Definition: pa_linux_pulseaudio_internal.h:115
size_t maxFramesHostPerBuffer
Definition: pa_linux_pulseaudio_internal.h:134
PaHostApiIndex hostApiIndex
Definition: pa_linux_pulseaudio_internal.h:96
pa_sample_spec outputSampleSpec
Definition: pa_linux_pulseaudio_internal.h:122
int inputFrameSize
Definition: pa_linux_pulseaudio_internal.h:136
The main buffer processor data structure.
Definition: pa_process.h:253
Functions to assist in measuring the CPU utilization of a callback stream. Used to implement the Pa_G...
double PaTime
Definition: portaudio.h:465
int outputFrameSize
Definition: pa_linux_pulseaudio_internal.h:135
Definition: pa_linux_pulseaudio_internal.h:88
PaError PaPulseAudio_ConvertPortaudioFormatToPaPulseAudio_(PaSampleFormat portaudiosf, pa_sample_spec *pulseaudiosf)
Definition: pa_linux_pulseaudio.c:920
PaError IsStreamStopped(PaStream *s)
Definition: pa_linux_pulseaudio.c:1379
PaDeviceIndex inputDevice
Definition: pa_linux_pulseaudio_internal.h:138
char * outputStreamName
Definition: pa_linux_pulseaudio_internal.h:141
Definition: pa_hostapi.h:201
pa_stream * inputStream
Definition: pa_linux_pulseaudio_internal.h:125
size_t missedBytes
Definition: pa_linux_pulseaudio_internal.h:146
void PaPulseAudio_ServerInfoCb(pa_context *c, const pa_server_info *i, void *userdata)
Definition: pa_linux_pulseaudio.c:275
void PaPulseAudio_SourceListCb(pa_context *c, const pa_source_info *l, int eol, void *userdata)
Definition: pa_linux_pulseaudio.c:419
#define PAPULSEAUDIO_MAX_DEVICECOUNT
Definition: pa_linux_pulseaudio_internal.h:72
PaUtilStreamInterface blockingStreamInterface
Definition: pa_linux_pulseaudio_internal.h:92
PaTime GetStreamTime(PaStream *s)
Definition: pa_linux_pulseaudio.c:1393