// default audio format ranges supported, applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat
#define XAPOBASE_DEFAULT_FORMAT_TAG WAVE_FORMAT_IEEE_FLOAT // 32-bit float only, applies to WAVEFORMATEX.wFormatTag or WAVEFORMATEXTENSIBLE.SubFormat when used
#define XAPOBASE_DEFAULT_FORMAT_MIN_CHANNELS XAPO_MIN_CHANNELS // minimum channel count, applies to WAVEFORMATEX.nChannels
#define XAPOBASE_DEFAULT_FORMAT_MAX_CHANNELS XAPO_MAX_CHANNELS // maximum channel count, applies to WAVEFORMATEX.nChannels
#define XAPOBASE_DEFAULT_FORMAT_MIN_FRAMERATE XAPO_MIN_FRAMERATE // minimum framerate, applies to WAVEFORMATEX.nSamplesPerSec
#define XAPOBASE_DEFAULT_FORMAT_MAX_FRAMERATE XAPO_MAX_FRAMERATE // maximum framerate, applies to WAVEFORMATEX.nSamplesPerSec
#define XAPOBASE_DEFAULT_FORMAT_BITSPERSAMPLE 32 // 32-bit float only, applies to WAVEFORMATEX.wBitsPerSample and WAVEFORMATEXTENSIBLE.wValidBitsPerSample when used
// default XAPO property flags supported, applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS
#pragma pack(push, 8) // set packing alignment to ensure consistency across arbitrary build environments, and ensure synchronization variables used by Interlocked functionality are correctly aligned
// primitive types
typedeffloatFLOAT32;// 32-bit IEEE float
////
// DESCRIPTION:
// Default implementation of the IXAPO and IUnknown interfaces.
// Provides overridable implementations for all methods save IXAPO::Process.
////
class__declspec(novtable)CXAPOBase:publicIXAPO{
private:
constXAPO_REGISTRATION_PROPERTIES*m_pRegistrationProperties;// pointer to registration properties of the XAPO, set via constructor
void*m_pfnMatrixMixFunction;// optimal matrix function pointer, used for thru processing
FLOAT32*m_pfl32MatrixCoefficients;// matrix coefficient table, used for thru processing
UINT32m_nSrcFormatType;// input format type, used for thru processing
BOOLm_fIsScalarMatrix;// TRUE if m_pfl32MatrixCoefficients is diagonal matrix with all main diagonal entries equal, i.e. m_pfnMatrixMixFunction only used for type conversion (no channel conversion), used for thru processing
BOOLm_fIsLocked;// TRUE if XAPO locked via CXAPOBase.LockForProcess
protected:
LONGm_lReferenceCount;// COM reference count, must be aligned for atomic operations
////
// DESCRIPTION:
// Verifies an audio format falls within the default ranges supported.
//
// REMARKS:
// If pFormat is unsupported, and fOverwrite is TRUE,
// pFormat is overwritten with the nearest format supported.
// Nearest meaning closest bit depth, framerate, and channel count,
// in that order of importance.
//
// PARAMETERS:
// pFormat - [in/out] audio format to examine
// fOverwrite - [in] TRUE to overwrite pFormat if audio format unsupported
//
// RETURN VALUE:
// COM error code, including:
// S_OK - audio format supported, pFormat left untouched
// XAPO_E_FORMAT_UNSUPPORTED - audio format unsupported, pFormat overwritten with nearest audio format supported if fOverwrite TRUE
// E_INVALIDARG - audio format invalid, pFormat left untouched
// For in-place processing (input buffer == output buffer)
// this method does nothing.
//
// This method should be called only if the XAPO is locked and
// XAPO_FLAG_FRAMERATE_MUST_MATCH is used.
//
// PARAMETERS:
// pInputBuffer - [in] input buffer, format may be INT8, INT16, INT20 (contained in 24 or 32 bits), INT24 (contained in 24 or 32 bits), INT32, or FLOAT32
// pOutputBuffer - [out] output buffer, format must be FLOAT32
// FrameCount - [in] number of frames to process
// InputChannelCount - [in] number of input channels
// OutputChannelCount - [in] number of output channels
// MixWithOutput - [in] TRUE to mix with output, FALSE to overwrite output
BYTE*m_pParameterBlocks;// three contiguous process parameter blocks used for synchronization, user responsible for initialization of parameter blocks before IXAPO::Process/SetParameters/GetParameters called
BYTE*m_pCurrentParameters;// pointer to current process parameters, must be aligned for atomic operations
BYTE*m_pCurrentParametersInternal;// pointer to current process parameters (temp pointer read by SetParameters/BeginProcess/EndProcess)
UINT32m_uCurrentParametersIndex;// index of current process parameters
UINT32m_uParameterBlockByteSize;// size of a single parameter block in bytes, must be > 0
BOOLm_fNewerResultsReady;// TRUE if there exists new processing results not yet picked up by GetParameters(), must be aligned for atomic operations
BOOLm_fProducer;// IXAPO::Process produces data to be returned by GetParameters(); SetParameters() disallowed
public:
////
// PARAMETERS:
// pRegistrationProperties - [in] registration properties of the XAPO
// pParameterBlocks - [in] three contiguous process parameter blocks used for synchronization
// uParameterBlockByteSize - [in] size of one of the parameter blocks, must be > 0
// fProducer - [in] TRUE if IXAPO::Process produces data to be returned by GetParameters() (SetParameters() and ParametersChanged() disallowed)