PortAudio
2.0
|
#include "pa_util.h"
#include "pa_allocation.h"
#include "pa_hostapi.h"
#include "pa_stream.h"
#include "pa_cpuload.h"
#include "pa_process.h"
#include "pa_unix_util.h"
#include "pa_ringbuffer.h"
#include "pa_debugprint.h"
#include <stdio.h>
#include <string.h>
#include <pulse/pulseaudio.h>
Go to the source code of this file.
Data Structures | |
struct | PaPulseAudio_HostApiRepresentation |
struct | PaPulseAudio_Stream |
Macros | |
#define | PA_PULSEAUDIO_SET_LAST_HOST_ERROR(errorCode, errorText) PaUtil_SetLastHostErrorInfo(paInDevelopment, errorCode, errorText) |
#define | PAPULSEAUDIO_MAX_DEVICECOUNT 1024 |
#define | PAPULSEAUDIO_MAX_DEVICENAME 1024 |
#define | PA_PULSEAUDIO_DEFAULT_MIN_LATENCY 0.010 |
#define | PA_PULSEAUDIO_DEFAULT_MAX_LATENCY 0.080 |
#define | PAPULSEAUDIO_FRAMESPERBUFFERUNSPEC 32 |
#define | PULSEAUDIO_BUFFER_SIZE (96100 * 4 * 2) |
#define | PA_PULSEAUDIO_IS_ERROR(pastream, errorCode) |
Typedefs | |
typedef struct PaPulseAudio_Stream | PaPulseAudio_Stream |
Functions | |
void | PaPulseAudio_ReleaseOperation (PaPulseAudio_HostApiRepresentation *hostapi, pa_operation **pulseaudioOperation) |
void | PaPulseAudio_Lock (pa_threaded_mainloop *mainloop) |
void | PaPulseAudio_UnLock (pa_threaded_mainloop *mainloop) |
PaError | PaPulseAudio_Initialize (PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index) |
void | Terminate (struct PaUtilHostApiRepresentation *hostApi) |
PaError | IsFormatSupported (struct PaUtilHostApiRepresentation *hostApi, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate) |
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 *stream) |
PaTime | GetStreamTime (PaStream *stream) |
double | GetStreamCpuLoad (PaStream *stream) |
PaPulseAudio_HostApiRepresentation * | PaPulseAudio_New (void) |
void | PaPulseAudio_Free (PaPulseAudio_HostApiRepresentation *ptr) |
int | PaPulseAudio_CheckConnection (PaPulseAudio_HostApiRepresentation *ptr) |
void | PaPulseAudio_CheckContextStateCb (pa_context *c, void *userdata) |
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) |
void | PaPulseAudio_StreamStartedCb (pa_stream *s, void *userdata) |
void | PaPulseAudio_StreamUnderflowCb (pa_stream *s, void *userdata) |
PaError | PaPulseAudio_ConvertPortaudioFormatToPaPulseAudio_ (PaSampleFormat portaudiosf, pa_sample_spec *pulseaudiosf) |
#define PA_PULSEAUDIO_DEFAULT_MAX_LATENCY 0.080 |
Referenced by PaPulseAudio_Initialize(), PaPulseAudio_SinkListCb(), and PaPulseAudio_SourceListCb().
#define PA_PULSEAUDIO_DEFAULT_MIN_LATENCY 0.010 |
Referenced by PaPulseAudio_Initialize(), PaPulseAudio_SinkListCb(), and PaPulseAudio_SourceListCb().
#define PA_PULSEAUDIO_IS_ERROR | ( | pastream, | |
errorCode | |||
) |
Referenced by PaPulseAudio_ReadStreamBlock(), and PaPulseAudio_WriteStreamBlock().
#define PA_PULSEAUDIO_SET_LAST_HOST_ERROR | ( | errorCode, | |
errorText | |||
) | PaUtil_SetLastHostErrorInfo(paInDevelopment, errorCode, errorText) |
Referenced by _PaPulseAudio_AddAudioDevice(), PaPulseAudio_BlockingInitRingBuffer(), PaPulseAudio_CheckContextStateCb(), PaPulseAudio_Free(), PaPulseAudio_Initialize(), PaPulseAudio_New(), PaPulseAudio_ServerInfoCb(), PaPulseAudio_SinkListCb(), PaPulseAudio_SourceListCb(), and PaPulseAudio_StreamStateCb().
#define PAPULSEAUDIO_FRAMESPERBUFFERUNSPEC 32 |
Referenced by OpenStream().
#define PAPULSEAUDIO_MAX_DEVICECOUNT 1024 |
Referenced by _PaPulseAudio_AddAudioDevice(), and PaPulseAudio_Initialize().
#define PAPULSEAUDIO_MAX_DEVICENAME 1024 |
Referenced by _PaPulseAudio_AddAudioDevice(), PaPulseAudio_New(), PaPulseAudio_RenameSink(), and PaPulseAudio_RenameSource().
#define PULSEAUDIO_BUFFER_SIZE (96100 * 4 * 2) |
Referenced by _PaPulseAudio_WriteRingBuffer().
typedef struct PaPulseAudio_Stream PaPulseAudio_Stream |
double GetStreamCpuLoad | ( | PaStream * | stream | ) |
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().
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().
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().
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 | index | ||
) |
void PaPulseAudio_Lock | ( | pa_threaded_mainloop * | mainloop | ) |
Referenced by _PaPulseAudio_WaitStreamState(), GetStreamTime(), OpenStream(), PaPulseAudio_CloseStreamCb(), PaPulseAudio_Initialize(), PaPulseAudio_ReadStreamBlock(), PaPulseAudio_ReleaseOperation(), PaPulseAudio_RenameSink(), PaPulseAudio_RenameSource(), PaPulseAudio_StartStreamCb(), PaPulseAudio_WriteStreamBlock(), 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().
void PaPulseAudio_ReleaseOperation | ( | PaPulseAudio_HostApiRepresentation * | hostapi, |
pa_operation ** | pulseaudioOperation | ||
) |
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_StreamStartedCb | ( | pa_stream * | s, |
void * | userdata | ||
) |
References PaPulseAudio_Stream::mainloop.
Referenced by OpenStream().
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().
void PaPulseAudio_UnLock | ( | pa_threaded_mainloop * | mainloop | ) |
Referenced by _PaPulseAudio_WaitStreamState(), GetStreamTime(), OpenStream(), PaPulseAudio_CloseStreamCb(), PaPulseAudio_Initialize(), PaPulseAudio_ReadStreamBlock(), PaPulseAudio_ReleaseOperation(), PaPulseAudio_RenameSink(), PaPulseAudio_RenameSource(), PaPulseAudio_StartStreamCb(), PaPulseAudio_WriteStreamBlock(), and Terminate().
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().