AudRecordLib
Classes | Namespaces | Defines | Typedefs | Functions
convert.h File Reference

Declares and implements function used for converting between the mixer and codec formats. More...

#include <boost/function.hpp>
#include "ctnumlimits.h"
#include "misc.h"

Go to the source code of this file.

Classes

struct  detail::IfThenElse< true, TrueType, FalseType >
struct  detail::IfThenElse< false, TrueType, FalseType >
struct  detail::ScaleFactor< Source, Dest >
struct  detail::ScaleFactor< Source, Source >

Namespaces

namespace  detail
namespace  detail::SSE

Defines

#define CONVERT_PREAMBLE()
#define CONVERT_RETURN()   return static_cast<DWORD>(reinterpret_cast<BYTE*>(pDstSamples) - static_cast<BYTE*>(pDstArray));

Typedefs

typedef boost::function< DWORD(LPCVOID,
DWORD, PVOID)> 
ConverterFnPtr

Functions

template<class SourceSampleType , class DestSampleType >
DWORD detail::ConvertChannelEqual (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD srcChannels, WORD)
template<class DestSampleType >
DWORD detail::ConvertChannelEqual (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD srcChannels)
FORCEINLINE void detail::SSE::StoreConvertedSamples (short *pDstSamples, const __m128 &samples)
FORCEINLINE void detail::SSE::StoreConvertedSamples (long *pDstSamples, const __m128 &samples)
FORCEINLINE void detail::SSE::StoreConvertedSamples (short *&pDstSamples, __m128 samples[4])
FORCEINLINE void detail::SSE::StoreConvertedSamples (long *&pDstSamples, __m128 samples[4])
FORCEINLINE __m128i detail::SSE::LongShortToShorts (__m128 &samples)
FORCEINLINE void detail::SSE::Get16ConvertedSamples (const float *&pSrcSamples, __m128 samplePacks[4], const __m128 &scaleFactors)
template<class DestSampleType >
void detail::SSE::Convert16SamplesLoop (const float *&pSrcSamples, DestSampleType *&pDstSamples, DWORD numPacks, const __m128 &scaleFactors)
template<class DestSampleType >
DWORD detail::ConvertChannelEqualSSE (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD srcChannels)
template<class SourceSampleType , class DestSampleType >
DWORD detail::ConvertChannelDown (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD srcChannels, WORD dstChannels)
template<class SourceSampleType , class DestSampleType >
DWORD detail::ConvertChannelUp (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD srcChannels, WORD dstChannels)
DWORD detail::ConvertCopy (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD sampleSize, WORD numChannels)
void DetermineSampleConverter (const tWAVEFORMATEX &inp, const tWAVEFORMATEX &out, ConverterFnPtr &converter)

Detailed Description

Declares and implements function used for converting between the mixer and codec formats.


Define Documentation

#define CONVERT_PREAMBLE ( )
Value:
const SourceSampleType* pSrcSamples = static_cast<const SourceSampleType*>(pSrcArray); \
                DestSampleType* pDstSamples = static_cast<DestSampleType*>(pDstArray); \
                typedef ScaleFactor<SourceSampleType, DestSampleType> ScaleFactorType; \
                const typename ScaleFactorType::ScaleType scaleFactor = ScaleFactorType::value;

Defines the common declaration used by the conversion functions including appropriately casted soucre and destination sample pointers and the caching of the scale value in a local variable

#define CONVERT_RETURN ( )    return static_cast<DWORD>(reinterpret_cast<BYTE*>(pDstSamples) - static_cast<BYTE*>(pDstArray));

Evaluates the number of bytes written to the destination array by subtracting the iterating pointer from the base dest pointer and returning it


Typedef Documentation

typedef boost::function<DWORD (LPCVOID, DWORD, PVOID)> ConverterFnPtr

Function object type for the sample conversion function


Function Documentation

void DetermineSampleConverter ( const tWAVEFORMATEX &  inp,
const tWAVEFORMATEX &  out,
ConverterFnPtr converter 
)

Determines the correct function that'll convert between the sample types

Picks a suitable function and template parameters that'll change samples from the input wave format to the output wave format.

Parameters:
inpThe input wave format, that from the audio mixing device
outThe output wave format, that to feed to the codec
[out]converterOn output, the function object that'll call the actual Convert* function when called
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Defines