PortAudio
2.0
|
#include "pa_mac_core_internal.h"
#include <string.h>
#include <libkern/OSAtomic.h>
#include "pa_mac_core.h"
#include "pa_mac_core_utilities.h"
#include "pa_mac_core_blocking.h"
Macros | |
#define | PA_MAC_SMALL_BUFFER_SIZE (64) |
#define | RING_BUFFER_ADVANCE_DENOMINATOR (4) |
#define | PA_AUHAL_SET_LAST_HOST_ERROR(errorCode, errorText) PaUtil_SetLastHostErrorInfo( paCoreAudio, errorCode, errorText ) |
#define | ERR_WRAP(mac_err) do { result = mac_err ; line = __LINE__ ; if ( result != noErr ) goto error ; } while(0) |
#define | HOST_TIME_TO_PA_TIME(x) ( AudioConvertHostTimeToNanos( (x) ) * 1.0E-09) /* convert to nanoseconds and then to seconds */ |
#define | RING_BUFFER_EMPTY (1000) |
#define | ERR_WRAP(mac_err) do { result = mac_err ; if ( result != noErr ) return ERR(result) ; } while(0) |
#define | ERR_WRAP(mac_err) do { result = mac_err ; if ( result != noErr ) return ERR(result) ; } while(0) |
Functions | |
PaError | PaMacCore_Initialize (PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index) |
void | PaMacCore_SetupStreamInfo (PaMacCoreStreamInfo *data, const unsigned long flags) |
void | PaMacCore_SetupChannelMap (PaMacCoreStreamInfo *data, const SInt32 *const channelMap, const unsigned long channelMapSize) |
const char * | PaMacCore_GetChannelName (int device, int channelIndex, bool input) |
PaError | PaMacCore_GetBufferSizeRange (PaDeviceIndex device, long *minBufferSizeFrames, long *maxBufferSizeFrames) |
AudioDeviceID | PaMacCore_GetStreamInputDevice (PaStream *s) |
AudioDeviceID | PaMacCore_GetStreamOutputDevice (PaStream *s) |
#define ERR_WRAP | ( | mac_err | ) | do { result = mac_err ; line = __LINE__ ; if ( result != noErr ) goto error ; } while(0) |
#define ERR_WRAP | ( | mac_err | ) | do { result = mac_err ; if ( result != noErr ) return ERR(result) ; } while(0) |
#define ERR_WRAP | ( | mac_err | ) | do { result = mac_err ; if ( result != noErr ) return ERR(result) ; } while(0) |
#define HOST_TIME_TO_PA_TIME | ( | x | ) | ( AudioConvertHostTimeToNanos( (x) ) * 1.0E-09) /* convert to nanoseconds and then to seconds */ |
#define PA_AUHAL_SET_LAST_HOST_ERROR | ( | errorCode, | |
errorText | |||
) | PaUtil_SetLastHostErrorInfo( paCoreAudio, errorCode, errorText ) |
#define PA_MAC_SMALL_BUFFER_SIZE (64) |
#define RING_BUFFER_ADVANCE_DENOMINATOR (4) |
#define RING_BUFFER_EMPTY (1000) |
PaError PaMacCore_GetBufferSizeRange | ( | PaDeviceIndex | device, |
long * | minBufferSizeFrames, | ||
long * | maxBufferSizeFrames | ||
) |
Retrieve the range of legal native buffer sizes for the specified device, in sample frames.
device | The global index of the PortAudio device about which the query is being made. |
minBufferSizeFrames | A pointer to the location which will receive the minimum buffer size value. |
maxBufferSizeFrames | A pointer to the location which will receive the maximum buffer size value. |
References PaUtilHostApiRepresentation::deviceInfos, PaMacAUHAL::devIds, PaMacAUHAL::inheritedHostApiRep, PaDeviceInfo::maxOutputChannels, paCoreAudio, PaMacCore_AudioDeviceGetProperty(), paNoError, PaUtil_DeviceIndexToHostApiDeviceIndex(), PaUtil_GetHostApiRepresentation(), and WARNING.
const char* PaMacCore_GetChannelName | ( | int | device, |
int | channelIndex, | ||
bool | input | ||
) |
Returns a statically allocated string with the device's name for the given channel. NULL will be returned on failure.
This function's implementation is not complete!
device | The PortAudio device index. |
channel | The channel number who's name is requested. |
References PaUtilHostApiRepresentation::deviceInfos, PaMacAUHAL::devIds, PaDeviceInfo::name, paCoreAudio, PaMacCore_AudioDeviceGetProperty(), PaMacCore_AudioDeviceGetPropertySize(), paNoError, and PaUtil_GetHostApiRepresentation().
AudioDeviceID PaMacCore_GetStreamInputDevice | ( | PaStream * | s | ) |
Retrieve the AudioDeviceID of the input device assigned to an open stream
s | The stream to query. |
References PaMacCoreStream::inputDevice, and VVDBUG.
AudioDeviceID PaMacCore_GetStreamOutputDevice | ( | PaStream * | s | ) |
Retrieve the AudioDeviceID of the output device assigned to an open stream
s | The stream to query. |
References PaMacCoreStream::outputDevice, and VVDBUG.
PaError PaMacCore_Initialize | ( | PaUtilHostApiRepresentation ** | hostApi, |
PaHostApiIndex | index | ||
) |
References PaMacAUHAL::allocations, PaMacAUHAL::blockingStreamInterface, PaMacAUHAL::callbackStreamInterface, PaMacAUHAL::defaultIn, PaMacAUHAL::defaultOut, PaMacAUHAL::devCount, PaMacAUHAL::devIds, GetStreamReadAvailable(), GetStreamWriteAvailable(), PaUtilHostApiRepresentation::info, PaMacAUHAL::inheritedHostApiRep, initializeXRunListenerList(), PaUtilHostApiRepresentation::IsFormatSupported, PaUtilHostApiRepresentation::OpenStream, paCoreAudio, paInsufficientMemory, paNoDevice, paNoError, PaUtil_AllocateZeroInitializedMemory(), PaUtil_CreateAllocationGroup(), PaUtil_DestroyAllocationGroup(), PaUtil_DummyGetCpuLoad(), PaUtil_DummyGetReadAvailable(), PaUtil_DummyGetWriteAvailable(), PaUtil_DummyRead(), PaUtil_DummyWrite(), PaUtil_FreeAllAllocations(), PaUtil_FreeMemory(), PaUtil_GroupAllocateZeroInitializedMemory(), PaUtil_InitializeStreamInterface(), ReadStream(), PaHostApiInfo::structVersion, PaUtilHostApiRepresentation::Terminate, UNIX_ERR, VVDBUG, and WriteStream().
void PaMacCore_SetupChannelMap | ( | PaMacCoreStreamInfo * | data, |
const SInt32 *const | channelMap, | ||
unsigned long | channelMapSize | ||
) |
call this after pa_SetupMacCoreStreamInfo to use channel mapping as described in notes.txt.
data | The stream info structure to assign a channel mapping to |
channelMap | The channel map array, as described in notes.txt. This array pointer will be used directly (ie the underlying data will not be copied), so the caller should not free the array until after the stream has been opened. |
channelMapSize | The size of the channel map array. |
References PaMacCoreStreamInfo::channelMap, and PaMacCoreStreamInfo::channelMapSize.
void PaMacCore_SetupStreamInfo | ( | PaMacCoreStreamInfo * | data, |
unsigned long | flags | ||
) |
Functions Use this function to initialize a paMacCoreStreamInfo struct using the requested flags. Note that channel mapping is turned off after a call to this function.
data | The datastructure to initialize |
flags | The flags to initialize the datastructure with. |
References PaMacCoreStreamInfo::channelMap, PaMacCoreStreamInfo::channelMapSize, PaMacCoreStreamInfo::flags, PaMacCoreStreamInfo::hostApiType, paCoreAudio, PaMacCoreStreamInfo::size, and PaMacCoreStreamInfo::version.