globally remove all trailing whitespace from .cpp and .hpp files missed by previous commit

This commit is contained in:
Paul Davis 2015-10-04 15:11:15 -04:00
parent 4dc63966f0
commit 4178db5f63
56 changed files with 50764 additions and 50764 deletions

View File

@ -55,7 +55,7 @@ struct AudioBuffer
};
*/
AUOutputBL::AUOutputBL (const CAStreamBasicDescription &inDesc, UInt32 inDefaultNumFrames)
AUOutputBL::AUOutputBL (const CAStreamBasicDescription &inDesc, UInt32 inDefaultNumFrames)
: mFormat (inDesc),
mBufferMemory(NULL),
mBufferList (NULL),
@ -76,7 +76,7 @@ AUOutputBL::~AUOutputBL()
delete [] mBufferList;
}
void AUOutputBL::Prepare (UInt32 inNumFrames, bool inWantNullBufferIfAllocated)
void AUOutputBL::Prepare (UInt32 inNumFrames, bool inWantNullBufferIfAllocated)
{
UInt32 channelsPerBuffer = mFormat.IsInterleaved() ? mFormat.NumberChannels() : 1;
@ -111,11 +111,11 @@ void AUOutputBL::Prepare (UInt32 inNumFrames, bool inWantNullBufferIfAllocated)
void AUOutputBL::Allocate (UInt32 inNumFrames)
{
if (inNumFrames)
if (inNumFrames)
{
UInt32 nBytes = mFormat.FramesToBytes (inNumFrames);
if (nBytes <= AllocatedBytes())
if (nBytes <= AllocatedBytes())
return;
// align successive buffers for Altivec and to take alternating
@ -134,8 +134,8 @@ void AUOutputBL::Allocate (UInt32 inNumFrames)
delete[] oldMemory;
mFrames = inNumFrames;
}
else
}
else
{
if (mBufferMemory) {
delete [] mBufferMemory;

View File

@ -42,8 +42,8 @@
#include "AUParamInfo.h"
#include "CAXException.h"
AUParamInfo::AUParamInfo (AudioUnit inAU,
bool inIncludeExpert,
AUParamInfo::AUParamInfo (AudioUnit inAU,
bool inIncludeExpert,
bool inIncludeReadOnly,
AudioUnitScope inScope,
AudioUnitElement inElement)
@ -73,13 +73,13 @@ AUParamInfo::AUParamInfo (AudioUnit inAU,
}
ParameterMap params;
for (int i = 0; i < nparams; ++i)
for (int i = 0; i < nparams; ++i)
{
CAAUParameter auvp (mAU, paramList[i], mScope, mElement); // took out only using global scope in CAAUParameter creation
const AudioUnitParameterInfo &paramInfo = auvp.ParamInfo();
// don't include if parameter can't be read or written
if (!(paramInfo.flags & kAudioUnitParameterFlag_IsWritable)
if (!(paramInfo.flags & kAudioUnitParameterFlag_IsWritable)
&& !(paramInfo.flags & kAudioUnitParameterFlag_IsReadable))
continue;
@ -88,7 +88,7 @@ AUParamInfo::AUParamInfo (AudioUnit inAU,
continue;
// only include if read only params are wanted
if (!(paramInfo.flags & kAudioUnitParameterFlag_IsWritable)
if (!(paramInfo.flags & kAudioUnitParameterFlag_IsWritable)
&& (paramInfo.flags & kAudioUnitParameterFlag_IsReadable))
{
if (!inIncludeReadOnly)
@ -113,9 +113,9 @@ AUParamInfo::~AUParamInfo()
}
UInt32 AUParamInfo::NumParamsForClump (UInt32 inClump) const
{
{
ParameterMap::const_iterator it = mParams.find(inClump);
if (it != mParams.end())
if (it != mParams.end())
return (*it).second.size();
return 0;
}

View File

@ -42,7 +42,7 @@
#include "CAAUParameter.h"
CAAUParameter::CAAUParameter()
CAAUParameter::CAAUParameter()
{
memset(this, 0, sizeof(CAAUParameter));
}
@ -59,7 +59,7 @@ CAAUParameter::CAAUParameter (AudioUnitParameter &inParam)
Init (inParam.mAudioUnit, inParam.mParameterID, inParam.mScope, inParam.mElement);
}
CAAUParameter::CAAUParameter(const CAAUParameter &a)
CAAUParameter::CAAUParameter(const CAAUParameter &a)
{
memset(this, 0, sizeof(CAAUParameter));
*this = a;
@ -101,7 +101,7 @@ void CAAUParameter::Init (AudioUnit au, AudioUnitParameterID param, AudioUnitSc
memset(&mParamInfo, 0, sizeof(mParamInfo));
if (mParamInfo.flags & kAudioUnitParameterFlag_HasCFNameString) {
mParamName = mParamInfo.cfNameString;
if (!(mParamInfo.flags & kAudioUnitParameterFlag_CFNameRelease))
if (!(mParamInfo.flags & kAudioUnitParameterFlag_CFNameRelease))
CFRetain (mParamName);
} else
mParamName = CFStringCreateWithCString(NULL, mParamInfo.name, kCFStringEncodingUTF8);
@ -173,11 +173,11 @@ void CAAUParameter::Init (AudioUnit au, AudioUnitParameterID param, AudioUnitSc
case kAudioUnitParameterUnit_Indexed:
{
propertySize = sizeof(mNamedParams);
err = AudioUnitGetProperty (au,
err = AudioUnitGetProperty (au,
kAudioUnitProperty_ParameterValueStrings,
scope,
param,
&mNamedParams,
scope,
param,
&mNamedParams,
&propertySize);
if (!err && mNamedParams) {
mNumIndexedParams = CFArrayGetCount(mNamedParams);
@ -215,7 +215,7 @@ void CAAUParameter::Init (AudioUnit au, AudioUnitParameterID param, AudioUnitSc
Float32 CAAUParameter::GetValue() const
{
Float32 value = 0.;
//OSStatus err =
//OSStatus err =
AudioUnitGetParameter(mAudioUnit, mParameterID, mScope, mElement, &value);
return value;
}
@ -232,7 +232,7 @@ CFStringRef CAAUParameter::GetStringFromValueCopy(const Float32 *value) const
return str;
}
}
else if (ValuesHaveStrings())
else if (ValuesHaveStrings())
{
AudioUnitParameterStringFromValue stringValue;
stringValue.inParamID = mParameterID;
@ -240,11 +240,11 @@ CFStringRef CAAUParameter::GetStringFromValueCopy(const Float32 *value) const
stringValue.outString = NULL;
UInt32 propertySize = sizeof(stringValue);
OSStatus err = AudioUnitGetProperty (mAudioUnit,
OSStatus err = AudioUnitGetProperty (mAudioUnit,
kAudioUnitProperty_ParameterStringFromValue,
mScope,
mParameterID,
&stringValue,
mScope,
mParameterID,
&stringValue,
&propertySize);
if (err == noErr && stringValue.outString != NULL)
@ -259,18 +259,18 @@ CFStringRef CAAUParameter::GetStringFromValueCopy(const Float32 *value) const
Float32 CAAUParameter::GetValueFromString(CFStringRef str) const
{
if (ValuesHaveStrings())
if (ValuesHaveStrings())
{
AudioUnitParameterValueFromString valueString;
valueString.inParamID = mParameterID;
valueString.inString = str;
UInt32 propertySize = sizeof(valueString);
OSStatus err = AudioUnitGetProperty (mAudioUnit,
OSStatus err = AudioUnitGetProperty (mAudioUnit,
kAudioUnitProperty_ParameterValueFromString,
mScope,
mParameterID,
&valueString,
mScope,
mParameterID,
&valueString,
&propertySize);
if (err == noErr) {
@ -285,7 +285,7 @@ Float32 CAAUParameter::GetValueFromString(CFStringRef str) const
return paramValue;
}
void CAAUParameter::SetValue( AUParameterListenerRef inListener,
void CAAUParameter::SetValue( AUParameterListenerRef inListener,
void * inObject,
Float32 inValue) const
{
@ -295,7 +295,7 @@ void CAAUParameter::SetValue( AUParameterListenerRef inListener,
valueToSet = mParamInfo.maxValue;
if (valueToSet < mParamInfo.minValue)
valueToSet = mParamInfo.minValue;
AUParameterSet(inListener, inObject, this, valueToSet, 0);
}

View File

@ -37,7 +37,7 @@
*/
/*=============================================================================
CAAudioChannelLayoutObject.cpp
=============================================================================*/
#include "CAAudioChannelLayout.h"
@ -69,7 +69,7 @@ CAAudioChannelLayout::CAAudioChannelLayout (UInt32 inNumberChannels, bool inChoo
layout->mNumberChannelDescriptions = inNumberChannels;
switch (inNumberChannels)
switch (inNumberChannels)
{
case 1:
layout->mChannelLayoutTag = kAudioChannelLayoutTag_Mono;

View File

@ -243,7 +243,7 @@ void CAAudioFile::CreateNew(const FSRef &parentDir, CFStringRef filename, AudioF
// _______________________________________________________________________________________
//
// called to create the file -- or update its format/channel layout/properties based on an encoder
// called to create the file -- or update its format/channel layout/properties based on an encoder
// setting change
void CAAudioFile::FileFormatChanged(const FSRef *parentDir, CFStringRef filename, AudioFileTypeID filetype)
{
@ -356,7 +356,7 @@ void CAAudioFile::FileFormatChanged(const FSRef *parentDir, CFStringRef filename
#if VERBOSE_CHANNELMAP
printf("writing file's channel layout: %s\n", CAChannelLayouts::ConstantToString(mFileChannelLayout.Tag()));
#endif
err = AudioFileSetProperty(mAudioFile, kAudioFilePropertyChannelLayout,
err = AudioFileSetProperty(mAudioFile, kAudioFilePropertyChannelLayout,
mFileChannelLayout.Size(), &mFileChannelLayout.Layout());
if (err)
CAXException::Warning("could not set the file's channel layout", err);
@ -378,7 +378,7 @@ void CAAudioFile::InitFileMaxPacketSize()
{
LOG_FUNCTION("CAAudioFile::InitFileMaxPacketSize", "%p", this);
UInt32 propertySize = sizeof(UInt32);
OSStatus err = AudioFileGetProperty(mAudioFile, kAudioFilePropertyMaximumPacketSize,
OSStatus err = AudioFileGetProperty(mAudioFile, kAudioFilePropertyMaximumPacketSize,
&propertySize, &mFileMaxPacketSize);
if (err) {
// workaround for 3361377: not all file formats' maximum packet sizes are supported
@ -657,7 +657,7 @@ void CAAudioFile::UpdateClientMaxPacketSize()
LOG_FUNCTION("CAAudioFile::UpdateClientMaxPacketSize", "%p", this);
mFrame0Offset = 0;
if (mConverter != NULL) {
AudioConverterPropertyID property = (mMode == kReading) ?
AudioConverterPropertyID property = (mMode == kReading) ?
kAudioConverterPropertyMaximumOutputPacketSize :
kAudioConverterPropertyMaximumInputPacketSize;
@ -1078,14 +1078,14 @@ void CAAudioFile::Write(UInt32 numPackets, const AudioBufferList *data)
WritePacketsFromCallback(WriteInputProc, this);
} else {
StartTiming(this, write);
XThrowIfError(AudioFileWritePackets(mAudioFile, mUseCache, data->mBuffers[0].mDataByteSize,
XThrowIfError(AudioFileWritePackets(mAudioFile, mUseCache, data->mBuffers[0].mDataByteSize,
NULL, mPacketMark, &numPackets, data->mBuffers[0].mData),
"write audio file");
ElapsedTime(this, write, mTicksInIO);
#if VERBOSE_IO
printf("CAAudioFile::WritePackets: wrote %ld packets at %qd, %ld bytes\n", numPackets, mPacketMark, data->mBuffers[0].mDataByteSize);
#endif
//mNumberPackets =
//mNumberPackets =
mPacketMark += numPackets;
if (mFileDataFormat.mFramesPerPacket > 0)
mFrameMark += numPackets * mFileDataFormat.mFramesPerPacket;
@ -1201,7 +1201,7 @@ void CAAudioFile::WritePacketsFromCallback(
mInConverter = true;
#endif
StartTiming(this, fill);
OSStatus err = AudioConverterFillComplexBuffer(mConverter, inInputDataProc, inInputDataProcUserData,
OSStatus err = AudioConverterFillComplexBuffer(mConverter, inInputDataProc, inInputDataProcUserData,
&numEncodedPackets, &mIOBufferList, mPacketDescs);
ElapsedTime(this, fill, mTicksInConverter);
#if CAAUDIOFILE_PROFILE

View File

@ -37,7 +37,7 @@
*/
/*=============================================================================
CAAudioUnit.cpp
=============================================================================*/
#include "CAAudioUnit.h"
@ -65,15 +65,15 @@ class CAAudioUnit::AUState : public CAReferenceCounted {
public:
AUState (Component inComp)
: mUnit(0), mNode (0)
{
OSStatus result = ::OpenAComponent (inComp, &mUnit);
{
OSStatus result = ::OpenAComponent (inComp, &mUnit);
if (result)
throw result;
Init();
}
AUState (const AUNode &inNode, const AudioUnit& inUnit)
: mUnit (inUnit), mNode (inNode)
: mUnit (inUnit), mNode (inNode)
{
Init();
}
@ -87,7 +87,7 @@ public:
Float32 &outValue) const
{
if (mGetParamProc != NULL) {
return reinterpret_cast<AudioUnitGetParameterProc>(mGetParamProc) (mConnInstanceStorage,
return reinterpret_cast<AudioUnitGetParameterProc>(mGetParamProc) (mConnInstanceStorage,
inID, scope, element, &outValue);
}
return AudioUnitGetParameter(mUnit, inID, scope, element, &outValue);
@ -97,7 +97,7 @@ public:
Float32 value, UInt32 bufferOffsetFrames)
{
if (mSetParamProc != NULL) {
return reinterpret_cast<AudioUnitSetParameterProc>(mSetParamProc) (mConnInstanceStorage,
return reinterpret_cast<AudioUnitSetParameterProc>(mSetParamProc) (mConnInstanceStorage,
inID, scope, element, value, bufferOffsetFrames);
}
return AudioUnitSetParameter(mUnit, inID, scope, element, value, bufferOffsetFrames);
@ -110,7 +110,7 @@ public:
AudioBufferList * ioData)
{
if (mRenderProc != NULL) {
return reinterpret_cast<AudioUnitRenderProc>(mRenderProc) (mConnInstanceStorage,
return reinterpret_cast<AudioUnitRenderProc>(mRenderProc) (mConnInstanceStorage,
ioActionFlags, inTimeStamp, inOutputBusNumber, inNumberFrames, ioData);
}
return AudioUnitRender(mUnit, ioActionFlags, inTimeStamp, inOutputBusNumber, inNumberFrames, ioData);
@ -123,7 +123,7 @@ public:
{
#if !TARGET_OS_WIN32
if (mMIDIEventProc != NULL) {
return reinterpret_cast<MusicDeviceMIDIEventProc>(mMIDIEventProc) (mConnInstanceStorage,
return reinterpret_cast<MusicDeviceMIDIEventProc>(mMIDIEventProc) (mConnInstanceStorage,
inStatus, inData1, inData2, inOffsetSampleFrame);
}
return MusicDeviceMIDIEvent (mUnit, inStatus, inData1, inData2, inOffsetSampleFrame);
@ -157,7 +157,7 @@ public:
private:
// get the fast dispatch pointers
void Init()
void Init()
{
UInt32 size = sizeof(AudioUnitRenderProc);
if (AudioUnitGetProperty(mUnit, kAudioUnitProperty_FastDispatch,
@ -192,7 +192,7 @@ private:
// get the compiler to tell us when we do a bad thing!!!
AUState () {}
AUState (const AUState& other) : CAReferenceCounted (other) {}
AUState& operator= (const AUState&) { return *this; }
AUState& operator= (const AUState&) { return *this; }
};
@ -208,7 +208,7 @@ CAAudioUnit::AUState::~AUState ()
OSStatus CAAudioUnit::Open (const CAComponent& inComp, CAAudioUnit &outUnit)
{
try {
outUnit = inComp;
outUnit = inComp;
return noErr;
} catch (OSStatus res) {
return res;
@ -229,7 +229,7 @@ CAAudioUnit::CAAudioUnit (const CAComponent& inComp)
}
CAAudioUnit::CAAudioUnit (const AUNode &inNode, const AudioUnit& inUnit)
: mComp (inUnit), mDataPtr(new AUState (inNode, inUnit))
: mComp (inUnit), mDataPtr(new AUState (inNode, inUnit))
{
}
@ -272,24 +272,24 @@ bool CAAudioUnit::operator== (const AudioUnit& y) const
#pragma mark __State Management
bool CAAudioUnit::IsValid () const
{
return mDataPtr ? mDataPtr->mUnit != 0 : false;
bool CAAudioUnit::IsValid () const
{
return mDataPtr ? mDataPtr->mUnit != 0 : false;
}
AudioUnit CAAudioUnit::AU() const
{
return mDataPtr ? mDataPtr->mUnit : 0;
AudioUnit CAAudioUnit::AU() const
{
return mDataPtr ? mDataPtr->mUnit : 0;
}
AUNode CAAudioUnit::GetAUNode () const
{
return mDataPtr ? mDataPtr->mNode : 0;
return mDataPtr ? mDataPtr->mNode : 0;
}
#pragma mark __Format Handling
bool CAAudioUnit::CanDo ( int inChannelsIn,
bool CAAudioUnit::CanDo ( int inChannelsIn,
int inChannelsOut) const
{
// this is the default assumption of an audio effect unit
@ -303,14 +303,14 @@ bool CAAudioUnit::CanDo ( int inChannelsIn,
// if this property is NOT implemented an FX unit
// is expected to deal with same channel valance in and out
if (result)
if (result)
{
if ((Comp().Desc().IsEffect() && (inChannelsIn == inChannelsOut))
|| (Comp().Desc().IsOffline() && (inChannelsIn == inChannelsOut)))
{
return true;
}
else
else
{
// the au should either really tell us about this
// or we will assume the worst
@ -342,9 +342,9 @@ int CAAudioUnit::GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt)
// if this property is NOT implemented an FX unit
// is expected to deal with same channel valance in and out
if (result)
if (result)
{
if (Comp().Desc().IsEffect())
if (Comp().Desc().IsEffect())
{
return 1;
}
@ -383,7 +383,7 @@ int CAAudioUnit::GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt)
}
return 0;
}
else
else
{
// the au should either really tell us about this
// or we will assume the worst
@ -403,7 +403,7 @@ int CAAudioUnit::GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt)
}
bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
int inChannelsOut,
const AUChannelInfo * info,
UInt32 numChanInfo) const
@ -415,8 +415,8 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
-1 wild card:
-1,-1 any num channels as long as same channels on in and out
-1,-2 any num channels channels on in and out - special meaning
-2+ indicates total num channs AU can handle
- elements configurable to any num channels,
-2+ indicates total num channs AU can handle
- elements configurable to any num channels,
- element count in scope must be writable
*/
@ -433,7 +433,7 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
}
}
else if ((info[i].inChannels == -1 && info[i].outChannels == -2)
|| (info[i].inChannels == -2 && info[i].outChannels == -1))
|| (info[i].inChannels == -2 && info[i].outChannels == -1))
{
return true;
}
@ -445,7 +445,7 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
IsElementCountWritable (kAudioUnitScope_Input, inWrite);
if (inWrite && outWrite) {
if ((inChannelsOut <= abs(info[i].outChannels))
&& (inChannelsIn <= abs(info[i].inChannels)))
&& (inChannelsIn <= abs(info[i].inChannels)))
{
return true;
}
@ -455,12 +455,12 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
// special meaning on input, specific num on output
else if (info[i].inChannels < 0) {
if (info[i].outChannels == inChannelsOut)
if (info[i].outChannels == inChannelsOut)
{
// can do any in channels
if (info[i].inChannels == -1) {
return true;
}
}
// total chans on input
else {
bool inWrite = false;
@ -474,12 +474,12 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
// special meaning on output, specific num on input
else if (info[i].outChannels < 0) {
if (info[i].inChannels == inChannelsIn)
if (info[i].inChannels == inChannelsIn)
{
// can do any out channels
if (info[i].outChannels == -1) {
return true;
}
}
// total chans on output
else {
bool outWrite = false;
@ -494,9 +494,9 @@ bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
// both chans in struct >= 0 - thus has to explicitly match
else if ((info[i].inChannels == inChannelsIn) && (info[i].outChannels == inChannelsOut)) {
return true;
}
}
// now check to see if a wild card on the args (inChannelsIn or inChannelsOut chans is zero) is found
// now check to see if a wild card on the args (inChannelsIn or inChannelsOut chans is zero) is found
// tells us to match just one side of the scopes
else if (inChannelsIn == 0) {
if (info[i].outChannels == inChannelsOut) {
@ -521,9 +521,9 @@ bool CheckDynCount (SInt32 inTotalChans, const CAAUChanHelper &inHelper)
return (totalChans <= inTotalChans);
}
bool CAAudioUnit::CheckOneSide (const CAAUChanHelper &inHelper,
bool checkOutput,
const AUChannelInfo *info,
bool CAAudioUnit::CheckOneSide (const CAAUChanHelper &inHelper,
bool checkOutput,
const AUChannelInfo *info,
UInt32 numInfo) const
{
// now we can use the wildcard option (see above impl) to see if this matches
@ -546,7 +546,7 @@ bool CAAudioUnit::CheckOneSide (const CAAUChanHelper &inHelper,
return true;
}
bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
const CAAUChanHelper &outputs) const
{
@ -564,7 +564,7 @@ bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
// (1) special cases (effects and sources (generators and instruments) only)
UInt32 dataSize = 0;
if (GetPropertyInfo (kAudioUnitProperty_SupportedNumChannels,
kAudioUnitScope_Global, 0, &dataSize, NULL) != noErr)
kAudioUnitScope_Global, 0, &dataSize, NULL) != noErr)
{
if (Comp().Desc().IsEffect() || Comp().Desc().IsOffline()) {
UInt32 numChan = outputs.mNumEls > 0 ? outputs.mChans[0] : inputs.mChans[0];
@ -599,8 +599,8 @@ bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
if (GetProperty (kAudioUnitProperty_SupportedNumChannels,
kAudioUnitScope_Global, 0,
info.mChanInfo, &dataSize) != noErr)
{
return false;
{
return false;
}
int numInfo = dataSize / sizeof(AUChannelInfo);
@ -628,7 +628,7 @@ bool CAAudioUnit::CanDo (const CAAUChanHelper &inputs,
}
// (4) - not a dynamic AU, has ins and outs, and has channel constraints so we test every possible pairing
for (unsigned int in = 0; in < inputs.mNumEls; ++in)
for (unsigned int in = 0; in < inputs.mNumEls; ++in)
{
bool testInAlready = false;
for (unsigned int i = 0; i < in; ++i) {
@ -683,7 +683,7 @@ bool CAAudioUnit::GetChannelLayouts (AudioUnitScope inScope,
AudioUnitElement inEl,
ChannelTagVector &outChannelVector) const
{
if (HasChannelLayouts (inScope, inEl) == false) return false;
if (HasChannelLayouts (inScope, inEl) == false) return false;
UInt32 dataSize;
OSStatus result = AudioUnitGetPropertyInfo (AU(),
@ -721,7 +721,7 @@ home:
return canDo;
}
bool CAAudioUnit::HasChannelLayouts (AudioUnitScope inScope,
bool CAAudioUnit::HasChannelLayouts (AudioUnitScope inScope,
AudioUnitElement inEl) const
{
OSStatus result = AudioUnitGetPropertyInfo (AU(),
@ -763,7 +763,7 @@ OSStatus CAAudioUnit::SetChannelLayout (AudioUnitScope inScope,
return result;
}
OSStatus CAAudioUnit::SetChannelLayout (AudioUnitScope inScope,
OSStatus CAAudioUnit::SetChannelLayout (AudioUnitScope inScope,
AudioUnitElement inEl,
AudioChannelLayout &inLayout,
UInt32 inSize)
@ -789,7 +789,7 @@ OSStatus CAAudioUnit::GetFormat (AudioUnitScope inScope,
{
UInt32 dataSize = sizeof (AudioStreamBasicDescription);
return AudioUnitGetProperty (AU(), kAudioUnitProperty_StreamFormat,
inScope, inEl,
inScope, inEl,
&outFormat, &dataSize);
}
@ -799,7 +799,7 @@ OSStatus CAAudioUnit::SetFormat (AudioUnitScope inScope,
{
return AudioUnitSetProperty (AU(), kAudioUnitProperty_StreamFormat,
inScope, inEl,
const_cast<AudioStreamBasicDescription*>(&inFormat),
const_cast<AudioStreamBasicDescription*>(&inFormat),
sizeof (AudioStreamBasicDescription));
}
@ -809,7 +809,7 @@ OSStatus CAAudioUnit::GetSampleRate (AudioUnitScope inScope,
{
UInt32 dataSize = sizeof (Float64);
return AudioUnitGetProperty (AU(), kAudioUnitProperty_SampleRate,
inScope, inEl,
inScope, inEl,
&outRate, &dataSize);
}
@ -924,9 +924,9 @@ bool CAAudioUnit::HasDynamicScope (AudioUnitScope inScope, SInt32 &outTotalNum
-N (where N is less than -2), signifies the total channel count on the scope side (in or out)
*/
bool CAAudioUnit::ValidateDynamicScope (AudioUnitScope inScope,
SInt32 &outTotalNumChannels,
const AUChannelInfo *info,
bool CAAudioUnit::ValidateDynamicScope (AudioUnitScope inScope,
SInt32 &outTotalNumChannels,
const AUChannelInfo *info,
UInt32 numInfo) const
{
bool writable = false;
@ -956,7 +956,7 @@ bool CAAudioUnit::ValidateDynamicScope (AudioUnitScope inScope,
outTotalNumChannels = abs (info[i].inChannels);
return true;
}
}
}
else if (inScope == kAudioUnitScope_Output) {
// isn't dynamic on this side at least
@ -967,7 +967,7 @@ bool CAAudioUnit::ValidateDynamicScope (AudioUnitScope inScope,
outTotalNumChannels = abs (info[i].outChannels);
return true;
}
}
}
else {
break; // wrong scope was specified
@ -977,9 +977,9 @@ bool CAAudioUnit::ValidateDynamicScope (AudioUnitScope inScope,
return false;
}
OSStatus CAAudioUnit::ConfigureDynamicScope (AudioUnitScope inScope,
UInt32 inNumElements,
UInt32 *inChannelsPerElement,
OSStatus CAAudioUnit::ConfigureDynamicScope (AudioUnitScope inScope,
UInt32 inNumElements,
UInt32 *inChannelsPerElement,
Float64 inSampleRate)
{
SInt32 numChannels = 0;
@ -1142,7 +1142,7 @@ OSStatus CAAudioUnit::StartNote (MusicDeviceInstrumentID inInstrument,
UInt32 inOffsetSampleFrame,
const MusicDeviceNoteParams * inParams)
{
return mDataPtr ? (OSStatus) mDataPtr->StartNote (inInstrument, inGroupID, outNoteInstanceID, inOffsetSampleFrame, inParams)
return mDataPtr ? (OSStatus) mDataPtr->StartNote (inInstrument, inGroupID, outNoteInstanceID, inOffsetSampleFrame, inParams)
: paramErr;
}
@ -1165,11 +1165,11 @@ OSStatus CAAudioUnit::Render (AudioUnitRenderActionFlags * ioActionFlags,
}
static AURenderCallbackStruct sRenderCallback;
static OSStatus PrerollRenderProc ( void * /*inRefCon*/,
static OSStatus PrerollRenderProc ( void * /*inRefCon*/,
AudioUnitRenderActionFlags * /*inActionFlags*/,
const AudioTimeStamp * /*inTimeStamp*/,
const AudioTimeStamp * /*inTimeStamp*/,
UInt32 /*inBusNumber*/,
UInt32 /*inNumFrames*/,
UInt32 /*inNumFrames*/,
AudioBufferList *ioData)
{
AudioBuffer *buf = ioData->mBuffers;
@ -1185,12 +1185,12 @@ OSStatus CAAudioUnit::Preroll (UInt32 inFrameSize)
OSStatus result = GetFormat (kAudioUnitScope_Input, 0, desc);
bool hasInput = false;
//we have input
if (result == noErr)
if (result == noErr)
{
sRenderCallback.inputProc = PrerollRenderProc;
sRenderCallback.inputProcRefCon = 0;
result = SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
result = SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
0, &sRenderCallback, sizeof(sRenderCallback));
if (result) return result;
hasInput = true;
@ -1217,7 +1217,7 @@ home:
sRenderCallback.inputProc = 0;
sRenderCallback.inputProcRefCon = 0;
SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
0, &sRenderCallback, sizeof(sRenderCallback));
}
return result;
@ -1251,8 +1251,8 @@ CAAUChanHelper::~CAAUChanHelper()
if (mDidAllocate) delete [] mChans;
}
CAAUChanHelper& CAAUChanHelper::operator= (const CAAUChanHelper &c)
{
CAAUChanHelper& CAAUChanHelper::operator= (const CAAUChanHelper &c)
{
if (mDidAllocate) delete [] mChans;
if (c.mDidAllocate) {
mChans = new UInt32[c.mNumEls];
@ -1263,7 +1263,7 @@ CAAUChanHelper& CAAUChanHelper::operator= (const CAAUChanHelper &c)
}
memcpy (mChans, c.mChans, c.mNumEls * sizeof(int));
return *this;
return *this;
}
#pragma mark __Print Utilities
@ -1271,7 +1271,7 @@ CAAUChanHelper& CAAUChanHelper::operator= (const CAAUChanHelper &c)
void CAAudioUnit::Print (FILE* file) const
{
fprintf (file, "AudioUnit:%p\n", AU());
if (IsValid()) {
if (IsValid()) {
fprintf (file, "\tnode=%ld\t", (long)GetAUNode()); Comp().Print (file);
}
}

View File

@ -123,7 +123,7 @@ void CABufferList::DeallocateBuffers()
delete[] mBufferMemory;
mBufferMemory = NULL;
}
}
extern "C" void CAShowAudioBufferList(const AudioBufferList *abl, int framesToPrint, int wordSize)
@ -131,7 +131,7 @@ extern "C" void CAShowAudioBufferList(const AudioBufferList *abl, int framesToPr
printf("AudioBufferList @ %p:\n", abl);
const AudioBuffer *buf = abl->mBuffers;
for (UInt32 i = 0; i < abl->mNumberBuffers; ++i, ++buf) {
printf(" [%2ld]: %2ldch, %5ld bytes @ %8p",
printf(" [%2ld]: %2ldch, %5ld bytes @ %8p",
i, buf->mNumberChannels, buf->mDataByteSize, buf->mData);
if (framesToPrint) {
printf(":");

View File

@ -37,7 +37,7 @@
*/
/*=============================================================================
CAComponent.cpp
=============================================================================*/
#include "CAComponent.h"
@ -55,23 +55,23 @@ CAComponent::CAComponent (const ComponentDescription& inDesc, CAComponent* next)
memcpy (&mDesc, &inDesc, sizeof(ComponentDescription));
}
CAComponent::CAComponent (const Component& comp)
CAComponent::CAComponent (const Component& comp)
: mComp (comp),
mManuName(0),
mAUName(0),
mCompName(0),
mCompInfo (0)
mManuName(0),
mAUName(0),
mCompName(0),
mCompInfo (0)
{
GetComponentInfo (Comp(), &mDesc, NULL, NULL, NULL);
}
CAComponent::CAComponent (const ComponentInstance& compInst)
: mComp (Component(compInst)),
mManuName(0),
mAUName(0),
mCompName(0),
mCompInfo (0)
{
CAComponent::CAComponent (const ComponentInstance& compInst)
: mComp (Component(compInst)),
mManuName(0),
mAUName(0),
mCompName(0),
mCompInfo (0)
{
GetComponentInfo (Comp(), &mDesc, NULL, NULL, NULL);
}
@ -107,7 +107,7 @@ OSStatus CAComponent::GetResourceVersion (UInt32 &outVersion) const
// only go on if we successfully found at least 1 thng resource
require_noerr (thngResourceCount <= 0 ? -1 : 0, home);
// loop through all of the Component thng resources trying to
// loop through all of the Component thng resources trying to
// find one that matches this Component description
for (short i = 0; i < thngResourceCount && (!versionFound); i++)
{
@ -121,8 +121,8 @@ OSStatus CAComponent::GetResourceVersion (UInt32 &outVersion) const
// check to see if this is the thng resource for the particular Component that we are looking at
// (there often is more than one Component described in the resource)
if ((componentThng->cd.componentType == mDesc.Type())
&& (componentThng->cd.componentSubType == mDesc.SubType())
if ((componentThng->cd.componentType == mDesc.Type())
&& (componentThng->cd.componentSubType == mDesc.SubType())
&& (componentThng->cd.componentManufacturer == mDesc.Manu()))
{
outVersion = componentThng->componentVersion;
@ -162,7 +162,7 @@ CAComponent& CAComponent::operator= (const CAComponent& y)
if (y.mManuName) { mManuName = y.mManuName; CFRetain (mManuName); }
if (y.mAUName) { mAUName = y.mAUName; CFRetain (mAUName); }
if (y.mCompName) { mCompName = y.mCompName; CFRetain (mCompName); }
if (y.mCompName) { mCompName = y.mCompName; CFRetain (mCompName); }
if (y.mCompInfo) { mCompInfo = y.mCompInfo; CFRetain (mCompInfo); }
return *this;
@ -208,7 +208,7 @@ void CAComponent::SetCompNames () const
displayStr[j] = 0;
const_cast<CAComponent*>(this)->mAUName = CFStringCreateWithCString(NULL, displayStr, kCFStringEncodingMacRoman);
}
}
DisposeHandle (h1);
}
@ -252,6 +252,6 @@ void CAComponent::Print(FILE* file) const
fprintf (file, ", Manu:"); _ShowCF (file, mManuName);
if (mAUName) fprintf (file, ", Name:"); _ShowCF (file, mAUName);
}
fprintf (file, ", ");
fprintf (file, ", ");
Desc ().Print(file);
}

View File

@ -37,7 +37,7 @@
*/
/*=============================================================================
CAComponentDescription.cpp
=============================================================================*/
#include "CAComponentDescription.h"
@ -87,8 +87,8 @@ CAComponentDescription::CAComponentDescription (OSType inType, OSType inSubtype,
componentFlagsMask = 0;
}
bool CAComponentDescription::IsAU () const
{
bool CAComponentDescription::IsAU () const
{
bool flag = IsEffect() || IsMusicDevice() || IsOffline();
if (flag) return true;
@ -103,7 +103,7 @@ bool CAComponentDescription::IsAU () const
inline bool _MatchTest (const OSType &inTypeA, const OSType &inTypeB)
{
return ((inTypeA == inTypeB) || (!inTypeA && !inTypeB) || (inTypeA && !inTypeB) || (!inTypeA && inTypeB));
return ((inTypeA == inTypeB) || (!inTypeA && !inTypeB) || (inTypeA && !inTypeB) || (!inTypeA && inTypeB));
}
bool CAComponentDescription::Matches (const ComponentDescription &desc) const

View File

@ -37,7 +37,7 @@
*/
/*=============================================================================
CAStreamBasicDescription.cpp
=============================================================================*/
#include "CAConditionalMacros.h"
@ -82,9 +82,9 @@ void CAStreamBasicDescription::PrintFormat(FILE *f, const char *indent, const ch
if (mFormatID == kAudioFormatLinearPCM) {
bool isInt = !(mFormatFlags & kLinearPCMFormatFlagIsFloat);
int wordSize = SampleWordSize();
const char *endian = (wordSize > 1) ?
const char *endian = (wordSize > 1) ?
((mFormatFlags & kLinearPCMFormatFlagIsBigEndian) ? " big-endian" : " little-endian" ) : "";
const char *sign = isInt ?
const char *sign = isInt ?
((mFormatFlags & kLinearPCMFormatFlagIsSignedInteger) ? " signed" : " unsigned") : "";
const char *floatInt = isInt ? "integer" : "float";
char packed[32];
@ -101,7 +101,7 @@ void CAStreamBasicDescription::PrintFormat(FILE *f, const char *indent, const ch
const char *commaSpace = (packed[0]!='\0') || (align[0]!='\0') ? ", " : "";
fprintf(f, "%ld-bit%s%s %s%s%s%s%s\n",
mBitsPerChannel, endian, sign, floatInt,
mBitsPerChannel, endian, sign, floatInt,
commaSpace, packed, align, deinter);
} else if (mFormatID == 'alac') { // kAudioFormatAppleLossless
int sourceBits = 0;
@ -128,7 +128,7 @@ void CAStreamBasicDescription::PrintFormat(FILE *f, const char *indent, const ch
fprintf(f, "%ld frames/packet\n", mFramesPerPacket);
}
else
fprintf(f, "%ld bits/channel, %ld bytes/packet, %ld frames/packet, %ld bytes/frame\n",
fprintf(f, "%ld bits/channel, %ld bytes/packet, %ld frames/packet, %ld bytes/frame\n",
mBitsPerChannel, mBytesPerPacket, mFramesPerPacket, mBytesPerFrame);
}
@ -440,7 +440,7 @@ static bool MatchFormatFlags(const AudioStreamBasicDescription& x, const AudioSt
UInt32 yFlags = y.mFormatFlags;
// match wildcards
if (x.mFormatID == 0 || y.mFormatID == 0 || xFlags == 0 || yFlags == 0)
if (x.mFormatID == 0 || y.mFormatID == 0 || xFlags == 0 || yFlags == 0)
return true;
if (x.mFormatID == kAudioFormatLinearPCM)
@ -488,7 +488,7 @@ bool operator==(const AudioStreamBasicDescription& x, const AudioStreamBasicDesc
#define MATCH(name) ((x.name) == 0 || (y.name) == 0 || (x.name) == (y.name))
return
return
// check the sample rate
(fiszero(x.mSampleRate) || fiszero(y.mSampleRate) || fequal(x.mSampleRate, y.mSampleRate))
@ -496,19 +496,19 @@ bool operator==(const AudioStreamBasicDescription& x, const AudioStreamBasicDesc
&& MATCH(mFormatID)
// check the format flags
&& MatchFormatFlags(x, y)
&& MatchFormatFlags(x, y)
// check the bytes per packet
&& MATCH(mBytesPerPacket)
&& MATCH(mBytesPerPacket)
// check the frames per packet
&& MATCH(mFramesPerPacket)
&& MATCH(mFramesPerPacket)
// check the bytes per frame
&& MATCH(mBytesPerFrame)
&& MATCH(mBytesPerFrame)
// check the channels per frame
&& MATCH(mChannelsPerFrame)
&& MATCH(mChannelsPerFrame)
// check the channels per frame
&& MATCH(mBitsPerChannel) ;

View File

@ -7,7 +7,7 @@
#include "UMicroseconds.h"
namespace wvNS {
namespace wvNS {
UMicroseconds& UMicroseconds::ReadTime()
{
// Note: g_get_monotonic_time() may be a viable alternative
@ -39,7 +39,7 @@ UMicroseconds& UMicroseconds::ReadTime()
return *this;
}
/*
Removed in favor of the posix implementation.
Removed in favor of the posix implementation.
#ifdef __APPLE__
uint32_t UMicroseconds::hi() {return reinterpret_cast<UnsignedWide*>(&theTime)->hi;}
uint32_t UMicroseconds::lo() {return reinterpret_cast<UnsignedWide*>(&theTime)->lo;}
@ -74,4 +74,4 @@ UMicrosecondsAccumulator& UMicrosecondsAccumulator::operator+=(const UMicrosecon
return *this;
}
} // namespace wvNS {
} // namespace wvNS {

View File

@ -66,7 +66,7 @@ namespace wvThread
//--------------------- begin measurement code
// poll to align to a tick of gettimeofday
::gettimeofday(&tvtmp,0);
do {
do {
::gettimeofday(&tvstart,0);
__asm__ __volatile__ (".byte 0x0f, 0x31" : "=A" (Tstart)); // RDTSC
} while (tvtmp.tv_usec!=tvstart.tv_usec);
@ -74,7 +74,7 @@ namespace wvThread
::usleep(sktd_TSC_MeasurementPeriod);
//
::gettimeofday(&tvtmp,0);
do {
do {
::gettimeofday(&tvend,0);
__asm__ __volatile__ (".byte 0x0f, 0x31" : "=A" (Tend)); // RDTSC
} while (tvtmp.tv_usec!=tvend.tv_usec);
@ -86,10 +86,10 @@ namespace wvThread
#endif
return nTicksPerMicrosecond;
}
#if defined(__APPLE__) //&& !defined(__MACH__)
bool FindNetInterfaceByIPAddress(const char *sIP, char *sInterface) // sIP and sInterface are both char[16]
{
FILE *fProcess , *pSubcall;
@ -106,7 +106,7 @@ namespace wvThread
while (pToken)
{
sprintf(sCommand, "ifconfig %s | grep \"inet %s \"", pToken, sIP);
pSubcall = popen(sCommand, "r");
if (pSubcall)
{
@ -121,12 +121,12 @@ namespace wvThread
}
}
pclose(pSubcall);
pToken = strtok(NULL, " ");
pToken = strtok(NULL, " ");
}
}
pclose(fProcess);
return res;
}
#endif // MACOS
@ -198,7 +198,7 @@ namespace wvThread
#elif XPLATFORMTHREADS_POSIX
void yield() { ::sched_yield(); }
#endif
@ -214,14 +214,14 @@ namespace wvThread
inline void obtain() { EnsureThreadingInitialized(); ::EnterCriticalSection (&m_critsec); }
inline void release() { EnsureThreadingInitialized(); ::LeaveCriticalSection (&m_critsec); }
inline bool tryobtain() { EnsureThreadingInitialized(); return TryEnterCriticalSection(&m_critsec)!=FALSE; }
#elif defined (XPLATFORMTHREADS_POSIX)
protected:
pthread_mutex_t m_ptmutex;
public:
inline OSDependentMutex()
{
EnsureThreadingInitialized();
inline OSDependentMutex()
{
EnsureThreadingInitialized();
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
@ -237,7 +237,7 @@ namespace wvThread
ThreadMutexInited::ThreadMutexInited() :
m_osdmutex(0) {}
void ThreadMutexInited::init()
{
if (! is_init())
@ -245,7 +245,7 @@ namespace wvThread
m_osdmutex = new OSDependentMutex;
}
}
void ThreadMutexInited::uninit()
{
if (is_init())
@ -254,38 +254,38 @@ namespace wvThread
m_osdmutex = 0;
}
}
ThreadMutexInited::~ThreadMutexInited()
{
uninit();
}
}
void ThreadMutexInited::obtain()
{
if (is_init())
{
m_osdmutex->obtain();
m_osdmutex->obtain();
}
}
}
void ThreadMutexInited::release()
{
if (is_init())
{
m_osdmutex->release();
m_osdmutex->release();
}
}
}
bool ThreadMutexInited::tryobtain()
{
bool retVal = true;
if (is_init())
{
retVal = m_osdmutex->tryobtain();
retVal = m_osdmutex->tryobtain();
}
return retVal;
}
}
class ThreadConditionSignal::OSDependentObject : public noncopyableobject
{
#if defined (XPLATFORMTHREADS_POSIX)
@ -294,17 +294,17 @@ namespace wvThread
pthread_cond_t m_ptcond;
pthread_mutex_t m_ptmutex;
public:
inline OSDependentObject()
inline OSDependentObject()
{
EnsureThreadingInitialized();
EnsureThreadingInitialized();
::pthread_mutex_init(&m_ptmutex,0);
::pthread_cond_init(&m_ptcond, 0);
::pthread_cond_init(&m_ptcond, 0);
}
inline ~OSDependentObject() { ::pthread_cond_destroy(&m_ptcond), ::pthread_mutex_destroy(&m_ptmutex); }
inline void signal_unicast() { ::pthread_cond_signal(&m_ptcond); }
inline void signal_broadcast() { ::pthread_cond_broadcast(&m_ptcond); }
inline void await_signal() { ::pthread_cond_wait(&m_ptcond, &m_ptmutex); }
inline bool await_signal(timediff td)
inline bool await_signal(timediff td)
{
timespec tspecDeadline;
timeval tvNow;
@ -423,14 +423,14 @@ namespace wvThread
#endif // OS switch
};
void ThreadConditionSignal::obtain_mutex()
{
m_osdepobj.obtain_mutex();
void ThreadConditionSignal::obtain_mutex()
{
m_osdepobj.obtain_mutex();
}
bool ThreadConditionSignal::tryobtain_mutex() { return m_osdepobj.tryobtain_mutex(); }
void ThreadConditionSignal::release_mutex()
{
m_osdepobj.release_mutex();
void ThreadConditionSignal::release_mutex()
{
m_osdepobj.release_mutex();
}
void ThreadConditionSignal::await_condition() { m_osdepobj.await_signal(); }
@ -587,7 +587,7 @@ namespace wvThread
0 // where to store thread ID
);
if (h)
if (h)
{
th.m_oshandle = h;
if (pri!=ThreadPriority::Normal)
@ -620,8 +620,8 @@ namespace wvThread
ThunkedThreadWrapper,
ptwdata
);
if (anyerr)
if (anyerr)
th=Invalid;
else
th.m_oshandle = OSDependent::from_oshandle(pt);
@ -676,7 +676,7 @@ namespace wvThread
class WCThreadRef::OSDependent
{
public:
static void GetCurrentThreadRef(WCThreadRef& tid);
static void GetCurrentThreadRef(WCThreadRef& tid);
#if XPLATFORMTHREADS_WINDOWS
static inline uintptr_t from_os(DWORD thread_id) { return (uintptr_t)(thread_id); }
static inline DWORD to_os(uintptr_t thread_id) { return (DWORD)(thread_id); }
@ -735,7 +735,7 @@ namespace wvThread
WCThreadRef GetCurrentThreadRef()
{
EnsureThreadingInitialized(); // Is it necessary?
EnsureThreadingInitialized(); // Is it necessary?
WCThreadRef tRefToReturn;
WCThreadRef::OSDependent::GetCurrentThreadRef(tRefToReturn);
return tRefToReturn;
@ -794,7 +794,7 @@ namespace wvThread
bool WCAtomicLock::obtain(const uint32_t in_num_trys)
{
bool retVal = false;
uint32_t timeOut = in_num_trys;
while (true)
{
@ -812,7 +812,7 @@ namespace wvThread
sleep_milliseconds(1000);
}
}
return retVal;
}

View File

@ -15,7 +15,7 @@ namespace Akupara
{
// The ultimate nothingness
// This is useful for writing constructors that nullify their object, and for testing nullness
struct null_type
struct null_type
{
null_type() {}
null_type(const null_type *) {} // this allows 0 to be implicitly converted to null_type

View File

@ -18,22 +18,22 @@ namespace Akupara
// Integer log2 functions
//------------------------------------------------------------------------
template<unsigned int n>
template<unsigned int n>
struct compiletime_bit_count_to_represent { static const unsigned int value = 1+compiletime_bit_count_to_represent<(n>>1)>::value; };
template<>
template<>
struct compiletime_bit_count_to_represent<0> { static const unsigned int value = 0; };
//------------------------------------------------------------------------
template<unsigned int n>
template<unsigned int n>
struct compiletime_log2_ceiling { static const unsigned int value=compiletime_bit_count_to_represent<n-1>::value; };
template<>
template<>
struct compiletime_log2_ceiling<0> {}; // no value for 0 argument
//------------------------------------------------------------------------
template<unsigned int n>
template<unsigned int n>
struct compiletime_log2_floor { static const unsigned int value=compiletime_bit_count_to_represent<n>::value-1; };
template<>
template<>
struct compiletime_log2_floor<0> {}; // no value for 0 argument
//------------------------------------------------------------------------
@ -41,13 +41,13 @@ namespace Akupara
// Assertion - accessing 'value' will generate a compile-time error if the argument evaluates to false
//------------------------------------------------------------------------
template<bool>
template<bool>
struct compiletime_assert;
template<>
struct compiletime_assert<true> { static const bool value=true; };
template<>
template<>
struct compiletime_assert<false> {}; // no value member for false assertion -> compile time error
//------------------------------------------------------------------------
@ -60,7 +60,7 @@ namespace Akupara
template<typename _true_type, typename _false_type>
struct compiletime_select_type<true, _true_type, _false_type> { typedef _true_type type; };
template<typename _true_type, typename _false_type>
template<typename _true_type, typename _false_type>
struct compiletime_select_type<false, _true_type, _false_type> { typedef _false_type type; };
//------------------------------------------------------------------------
@ -72,7 +72,7 @@ namespace Akupara
//------------------------------------------------------------------------
namespace detail
{
template<unsigned int _size, bool _signed>
template<unsigned int _size, bool _signed>
struct integer_with_byte_count_base;
template<>
@ -149,15 +149,15 @@ namespace Akupara
AKUPARA_SIGNED_UNSIGNED_INTEGER_PAIR(3, int )
//AKUPARA_SIGNED_UNSIGNED_INTEGER_PAIR(4, int32_t )// 64BitConversion
template<>
struct
signed_unsigned_pair<4>
{
typedef int32_t signed_type;
typedef uint32_t unsigned_type;
template<>
struct
signed_unsigned_pair<4>
{
typedef int32_t signed_type;
typedef uint32_t unsigned_type;
};
AKUPARA_SIGNED_UNSIGNED_INTEGER_PAIR(5, long long)
AKUPARA_SIGNED_UNSIGNED_FLOAT_PAIR (6, float )
AKUPARA_SIGNED_UNSIGNED_FLOAT_PAIR (7, double )

View File

@ -1,6 +1,6 @@
/*
* Akupara/threading/atomic_ops.hpp
*
*
*
* Created by Udi Barzilai on 06/06.
* Copyright 2006 __MyCompanyName__. All rights reserved.
@ -91,16 +91,16 @@ namespace Akupara
//----------------------------------------------------------------------------------------
namespace detail
{
template<unsigned int _byte_count>
struct largest_atomic_byte_count_upto
{
static const unsigned int value =
machine::implements_load<_byte_count>::value && machine::implements_store<_byte_count>::value ?
_byte_count :
largest_atomic_byte_count_upto<_byte_count/2>::value;
template<unsigned int _byte_count>
struct largest_atomic_byte_count_upto
{
static const unsigned int value =
machine::implements_load<_byte_count>::value && machine::implements_store<_byte_count>::value ?
_byte_count :
largest_atomic_byte_count_upto<_byte_count/2>::value;
};
template<>
template<>
struct largest_atomic_byte_count_upto<0> { static const unsigned int value = 0; };
const unsigned int k_byte_count_best_atomic = largest_atomic_byte_count_upto<sizeof(int)>::value;
@ -129,7 +129,7 @@ _byte_count :
namespace detail
{
template<
typename _integer_type,
typename _integer_type,
bool _implements_CAS = machine::implements_CAS <sizeof(_integer_type)>::value,
bool _implements_LL_SC = machine::implements_LL_SC<sizeof(_integer_type)>::value>
struct implementation_CAS
@ -138,7 +138,7 @@ _byte_count :
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// specialization for native CAS support
template<typename _integer_type, bool _implements_LL_SC>
template<typename _integer_type, bool _implements_LL_SC>
struct implementation_CAS<_integer_type, true, _implements_LL_SC>
{
static const bool s_exists = true;
@ -164,7 +164,7 @@ _byte_count :
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
} // namespace detail
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<typename _integer_type>
template<typename _integer_type>
inline bool compare_and_store(volatile _integer_type * operand_address, const _integer_type & expected_value, const _integer_type & value_to_store)
{
// if your compiler can't find the function to call here then there is no implementation available for your machine
@ -181,7 +181,7 @@ _byte_count :
namespace detail
{
template<
typename _integer_type,
typename _integer_type,
bool _0 = machine::implements_fetch_and_add<sizeof(_integer_type)>::value,
bool _1 = machine::implements_add_and_fetch<sizeof(_integer_type)>::value,
bool _2 = machine::implements_LL_SC <sizeof(_integer_type)>::value,
@ -244,7 +244,7 @@ _byte_count :
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
} // namespace detail
template<typename _integer_type>
template<typename _integer_type>
inline _integer_type fetch_and_add(volatile _integer_type * operand_address, const _integer_type & addend)
{
// if your compiler can't find the function to call here then there is no implementation available for your machine
@ -260,7 +260,7 @@ _byte_count :
namespace detail
{
template<
typename _integer_type,
typename _integer_type,
bool _0 = machine::implements_add_and_fetch<sizeof(_integer_type)>::value,
bool _1 = machine::implements_fetch_and_add<sizeof(_integer_type)>::value,
bool _2 = machine::implements_LL_SC <sizeof(_integer_type)>::value,
@ -323,7 +323,7 @@ _byte_count :
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
} // namespace detail
template<typename _integer_type>
template<typename _integer_type>
inline _integer_type add_and_fetch(volatile _integer_type * operand_address, const _integer_type & addend)
{
// if your compiler can't find the function to call here then there is no implementation available for your machine
@ -335,7 +335,7 @@ _byte_count :
//----------------------------------------------------------------------------------------
// add
template<typename _integer_type>
template<typename _integer_type>
inline void add(volatile _integer_type * operand_address, const _integer_type & addend)
{
if (machine::implements_add<sizeof(_integer_type)>::value)

View File

@ -1,6 +1,6 @@
/*
* Akupara/threading/atomic_ops_gcc_x86.hpp
*
*
*
* Created by Udi Barzilai on 06/06.
* Copyright 2006 __MyCompanyName__. All rights reserved.

View File

@ -12,7 +12,7 @@
//**********************************************************************************************
// WCMRAudioDevice::WCMRAudioDevice
// WCMRAudioDevice::WCMRAudioDevice
//
//! Constructor for the audio device. The derived classes will need to do more actual work, such
//! as determining supported sampling rates, buffer sizes, and channel counts. Connection
@ -20,7 +20,7 @@
//!
//! \param *pManager : The audio device manager that's managing this device.
//! \return Nothing.
//!
//!
//**********************************************************************************************
WCMRAudioDevice::WCMRAudioDevice (WCMRAudioDeviceManager *pManager) :
m_pMyManager (pManager)
@ -39,19 +39,19 @@ WCMRAudioDevice::WCMRAudioDevice (WCMRAudioDeviceManager *pManager) :
//**********************************************************************************************
// WCMRAudioDevice::~WCMRAudioDevice
// WCMRAudioDevice::~WCMRAudioDevice
//
//! Destructor for the audio device. It release all the connections that were created.
//!
//! \param none
//!
//!
//! \return Nothing.
//!
//!
//**********************************************************************************************
WCMRAudioDevice::~WCMRAudioDevice ()
{
AUTO_FUNC_DEBUG;
try
try
{
}
catch (...)
@ -65,14 +65,14 @@ WCMRAudioDevice::~WCMRAudioDevice ()
//**********************************************************************************************
// WCMRAudioDevice::DeviceName
// WCMRAudioDevice::DeviceName
//
//! Retrieves Device's name.
//!
//! \param none
//!
//!
//! \return The device name.
//!
//!
//**********************************************************************************************
const std::string& WCMRAudioDevice::DeviceName () const
{
@ -83,14 +83,14 @@ const std::string& WCMRAudioDevice::DeviceName () const
//**********************************************************************************************
// WCMRAudioDevice::InputChannels
// WCMRAudioDevice::InputChannels
//
//! Retrieves Input Channel information. Note that the list may be changed at run-time.
//!
//! \param none
//!
//!
//! \return A vector with Input Channel Names.
//!
//!
//**********************************************************************************************
const std::vector<std::string>& WCMRAudioDevice::InputChannels ()
{
@ -101,14 +101,14 @@ const std::vector<std::string>& WCMRAudioDevice::InputChannels ()
//**********************************************************************************************
// WCMRAudioDevice::OutputChannels
// WCMRAudioDevice::OutputChannels
//
//! Retrieves Output Channel Information. Note that the list may be changed at run-time.
//!
//! \param none
//!
//!
//! \return A vector with Output Channel Names.
//!
//!
//**********************************************************************************************
const std::vector<std::string>& WCMRAudioDevice::OutputChannels ()
{
@ -119,14 +119,14 @@ const std::vector<std::string>& WCMRAudioDevice::OutputChannels ()
//**********************************************************************************************
// WCMRAudioDevice::SamplingRates
// WCMRAudioDevice::SamplingRates
//
//! Retrieves supported sampling rate information.
//!
//! \param none
//!
//!
//! \return A vector with supported sampling rates.
//!
//!
//**********************************************************************************************
const std::vector<int>& WCMRAudioDevice::SamplingRates ()
{
@ -136,15 +136,15 @@ const std::vector<int>& WCMRAudioDevice::SamplingRates ()
//**********************************************************************************************
// WCMRAudioDevice::CurrentSamplingRate
// WCMRAudioDevice::CurrentSamplingRate
//
//! The device's current sampling rate. This may be overridden, if the device needs to
//! The device's current sampling rate. This may be overridden, if the device needs to
//! query the driver for the current rate.
//!
//! \param none
//!
//!
//! \return The device's current sampling rate. -1 on error.
//!
//!
//**********************************************************************************************
int WCMRAudioDevice::CurrentSamplingRate ()
{
@ -155,15 +155,15 @@ int WCMRAudioDevice::CurrentSamplingRate ()
//**********************************************************************************************
// WCMRAudioDevice::SetCurrentSamplingRate
// WCMRAudioDevice::SetCurrentSamplingRate
//
//! Change the sampling rate to be used by the device. This will most likely be overridden,
//! Change the sampling rate to be used by the device. This will most likely be overridden,
//! the base class simply updates the member variable.
//!
//! \param newRate : The rate to use (samples per sec).
//!
//!
//! \return eNoErr always. The derived classes may return error codes.
//!
//!
//**********************************************************************************************
WTErr WCMRAudioDevice::SetCurrentSamplingRate (int newRate)
{
@ -176,14 +176,14 @@ WTErr WCMRAudioDevice::SetCurrentSamplingRate (int newRate)
//**********************************************************************************************
// WCMRAudioDevice::BufferSizes
// WCMRAudioDevice::BufferSizes
//
//! Retrieves supported buffer size information.
//!
//! \param none
//!
//!
//! \return A vector with supported buffer sizes.
//!
//!
//**********************************************************************************************
const std::vector<int>& WCMRAudioDevice::BufferSizes ()
{
@ -195,13 +195,13 @@ const std::vector<int>& WCMRAudioDevice::BufferSizes ()
//**********************************************************************************************
// WCMRAudioDevice::CurrentBufferSize
//
//! The device's current buffer size in use. This may be overridden, if the device needs to
//! The device's current buffer size in use. This may be overridden, if the device needs to
//! query the driver for the current size.
//!
//! \param none
//!
//!
//! \return The device's current buffer size. 0 on error.
//!
//!
//**********************************************************************************************
int WCMRAudioDevice::CurrentBufferSize ()
{
@ -216,9 +216,9 @@ int WCMRAudioDevice::CurrentBufferSize ()
//! data other then the audio buffers, like frames info in SG, so it can be overridden
//!
//! \param none
//!
//!
//! \return The device's current block size. 0 on error.
//!
//!
//**********************************************************************************************
int WCMRAudioDevice::CurrentBlockSize()
{
@ -230,13 +230,13 @@ int WCMRAudioDevice::CurrentBlockSize()
//**********************************************************************************************
// WCMRAudioDevice::SetCurrentBufferSize
//
//! Change the buffer size to be used by the device. This will most likely be overridden,
//! Change the buffer size to be used by the device. This will most likely be overridden,
//! the base class simply updates the member variable.
//!
//! \param newSize : The buffer size to use (in sample-frames)
//!
//!
//! \return eNoErr always. The derived classes may return error codes.
//!
//!
//**********************************************************************************************
WTErr WCMRAudioDevice::SetCurrentBufferSize (int newSize)
{
@ -250,15 +250,15 @@ WTErr WCMRAudioDevice::SetCurrentBufferSize (int newSize)
//**********************************************************************************************
// WCMRAudioDevice::ConnectionStatus
// WCMRAudioDevice::ConnectionStatus
//
//! Retrieves the device's current connection status. This will most likely be overridden,
//! in case some driver communication is required to query the status.
//!
//! \param none
//!
//!
//! \return A ConnectionStates value.
//!
//!
//**********************************************************************************************
WCMRAudioDevice::ConnectionStates WCMRAudioDevice::ConnectionStatus ()
{
@ -270,14 +270,14 @@ WCMRAudioDevice::ConnectionStates WCMRAudioDevice::ConnectionStatus ()
//**********************************************************************************************
// WCMRAudioDevice::Active
// WCMRAudioDevice::Active
//
//! Retrieves Device activation status.
//!
//! \param none
//!
//!
//! \return true if device is active, false otherwise.
//!
//!
//**********************************************************************************************
bool WCMRAudioDevice::Active ()
{
@ -288,15 +288,15 @@ bool WCMRAudioDevice::Active ()
//**********************************************************************************************
// WCMRAudioDevice::SetActive
// WCMRAudioDevice::SetActive
//
//! Sets the device's activation status.
//!
//! \param newState : Should be true to activate, false to deactivate. This roughly corresponds
//! to opening and closing the device handle/stream/audio unit.
//!
//!
//! \return eNoErr always, the derived classes may return appropriate error code.
//!
//!
//**********************************************************************************************
WTErr WCMRAudioDevice::SetActive (bool newState)
{
@ -310,14 +310,14 @@ WTErr WCMRAudioDevice::SetActive (bool newState)
//**********************************************************************************************
// WCMRAudioDevice::Streaming
// WCMRAudioDevice::Streaming
//
//! Retrieves Device streaming status.
//!
//! \param none
//!
//!
//! \return true if device is streaming, false otherwise.
//!
//!
//**********************************************************************************************
bool WCMRAudioDevice::Streaming ()
{
@ -333,9 +333,9 @@ bool WCMRAudioDevice::Streaming ()
//!
//! \param newState : Should be true to start streaming, false to stop streaming. This roughly
//! corresponds to calling Start/Stop on the lower level interface.
//!
//!
//! \return eNoErr always, the derived classes may return appropriate error code.
//!
//!
//**********************************************************************************************
WTErr WCMRAudioDevice::SetStreaming (bool newState)
{
@ -387,15 +387,15 @@ bool WCMRAudioDevice::IsProcessActive()
//**********************************************************************************************
// WCMRAudioDevice::DoIdle
// WCMRAudioDevice::DoIdle
//
//! A place for doing idle time processing. The derived classes will probably do something
//! meaningful.
//!
//! \param none
//!
//!
//! \return eNoErr always.
//!
//!
//**********************************************************************************************
WTErr WCMRAudioDevice::DoIdle ()
{
@ -408,14 +408,14 @@ WTErr WCMRAudioDevice::DoIdle ()
//**********************************************************************************************
// WCMRAudioDevice::InputLevels
// WCMRAudioDevice::InputLevels
//
//! Retrieve current input levels.
//!
//! \param none
//!
//!
//! \return A vector (the same size as input channels list) that contains current input levels.
//!
//!
//**********************************************************************************************
const std::vector<float>& WCMRAudioDevice::InputLevels ()
{
@ -427,14 +427,14 @@ const std::vector<float>& WCMRAudioDevice::InputLevels ()
//**********************************************************************************************
// WCMRAudioDevice::OutputLevels
// WCMRAudioDevice::OutputLevels
//
//! Retrieve current output levels.
//!
//! \param none
//!
//!
//! \return A vector (the same size as output channels list) that contains current output levels.
//!
//!
//**********************************************************************************************
const std::vector<float>& WCMRAudioDevice::OutputLevels ()
{
@ -446,16 +446,16 @@ const std::vector<float>& WCMRAudioDevice::OutputLevels ()
//**********************************************************************************************
// WCMRAudioDevice::GetMonitorInfo
// WCMRAudioDevice::GetMonitorInfo
//
//! Retrieves current monitoring information.
//!
//! \param *pLeftChannel : Pointer to receive left monitor channel index.
//! \param *pRightChannel : Pointer to receive right monitor channel index.
//! \param *pGain : Pointer to receive the gain (linear) to be applied.
//!
//!
//! \return Nothing.
//!
//!
//**********************************************************************************************
void WCMRAudioDevice::GetMonitorInfo (int *pLeftChannel, int *pRightChannel, float *pGain)
{
@ -471,15 +471,15 @@ void WCMRAudioDevice::GetMonitorInfo (int *pLeftChannel, int *pRightChannel, flo
//**********************************************************************************************
// WCMRAudioDevice::SetMonitorChannels
// WCMRAudioDevice::SetMonitorChannels
//
//! Used to set the channels to be used for monitoring.
//!
//! \param leftChannel : Left monitor channel index.
//! \param rightChannel : Right monitor channel index.
//!
//!
//! \return eNoErr always, the derived classes may return appropriate errors.
//!
//!
//**********************************************************************************************
WTErr WCMRAudioDevice::SetMonitorChannels (int leftChannel, int rightChannel)
{
@ -493,14 +493,14 @@ WTErr WCMRAudioDevice::SetMonitorChannels (int leftChannel, int rightChannel)
//**********************************************************************************************
// WCMRAudioDevice::SetMonitorGain
// WCMRAudioDevice::SetMonitorGain
//
//! Used to set monitor gain (or atten).
//!
//! \param newGain : The new gain or atten. value to use. Specified as a linear multiplier (not dB)
//!
//! \param newGain : The new gain or atten. value to use. Specified as a linear multiplier (not dB)
//!
//! \return eNoErr always, the derived classes may return appropriate errors.
//!
//!
//**********************************************************************************************
WTErr WCMRAudioDevice::SetMonitorGain (float newGain)
{
@ -514,15 +514,15 @@ WTErr WCMRAudioDevice::SetMonitorGain (float newGain)
//**********************************************************************************************
// WCMRAudioDevice::ShowConfigPanel
// WCMRAudioDevice::ShowConfigPanel
//
//! Used to show device specific config/control panel. Some interfaces may not support it.
//! Some interfaces may require the device to be active before it can display a panel.
//!
//! \param pParam : A device/interface specific parameter - optional.
//!
//!
//! \return eNoErr always, the derived classes may return errors.
//!
//!
//**********************************************************************************************
WTErr WCMRAudioDevice::ShowConfigPanel (void *WCUNUSEDPARAM(pParam))
{
@ -532,16 +532,16 @@ WTErr WCMRAudioDevice::ShowConfigPanel (void *WCUNUSEDPARAM(pParam))
//**********************************************************************************************
// WCMRAudioDevice::SendCustomCommand
// WCMRAudioDevice::SendCustomCommand
//
//! Used to Send a custom command to the audiodevice. Some interfaces may require the device
//! Used to Send a custom command to the audiodevice. Some interfaces may require the device
//! to be active before it can do anything in this.
//!
//! \param customCommand : A device/interface specific command.
//! \param pCommandParam : A device/interface/command specific parameter - optional.
//!
//!
//! \return eNoErr always, the derived classes may return errors.
//!
//!
//**********************************************************************************************
WTErr WCMRAudioDevice::SendCustomCommand (int WCUNUSEDPARAM(customCommand), void *WCUNUSEDPARAM(pCommandParam))
{
@ -573,10 +573,10 @@ uint32_t WCMRAudioDevice::GetLatency (bool isInput)
//
//! The constructuor, most of the work will be done in the derived class' constructor.
//!
//! \param *pTheClient :
//!
//! \param *pTheClient :
//!
//! \return Nothing.
//!
//!
//**********************************************************************************************
WCMRAudioDeviceManager::WCMRAudioDeviceManager(WCMRAudioDeviceManagerClient *pTheClient, eAudioDeviceFilter eCurAudioDeviceFilter)
: m_eAudioDeviceFilter(eCurAudioDeviceFilter)
@ -592,9 +592,9 @@ WCMRAudioDeviceManager::WCMRAudioDeviceManager(WCMRAudioDeviceManagerClient *pTh
//! It clears the device list, releasing each of the device.
//!
//! \param none
//!
//!
//! \return Nothing.
//!
//!
//**********************************************************************************************
WCMRAudioDeviceManager::~WCMRAudioDeviceManager()
{
@ -674,15 +674,15 @@ WTErr WCMRAudioDeviceManager::GetDeviceBufferSizes(const std::string & nameToMat
//**********************************************************************************************
// WCMRAudioDeviceManager::NotifyClient
// WCMRAudioDeviceManager::NotifyClient
//
//! A helper routine used to call the client for notification.
//!
//! \param forReason : The reason for notification.
//! \param *pParam : A parameter (if required) for notification.
//!
//!
//! \return Nothing.
//!
//!
//**********************************************************************************************
void WCMRAudioDeviceManager::NotifyClient (WCMRAudioDeviceManagerClient::NotificationReason forReason, void *pParam)
{

View File

@ -30,8 +30,8 @@
//! the applications.
//!
//! \param pManager : The managing device manager - simply passed on to the base class.
//!
//!
//!
//!
//**********************************************************************************************
WCMRNativeAudioNoneDevice::WCMRNativeAudioNoneDevice (WCMRAudioDeviceManager *pManager)
: WCMRNativeAudioDevice (pManager, false /*useMultiThreading*/)
@ -155,7 +155,7 @@ WTErr WCMRNativeAudioNoneDevice::SetStreaming (bool newState)
std::cerr << "WCMRNativeAudioNoneDevice::SetStreaming (): pthread_attr_init () failed!" << std::endl;
return eGenericErr;
}
if (pthread_attr_setstacksize (&attributes, stack_size)) {
std::cerr << "WCMRNativeAudioNoneDevice::SetStreaming (): pthread_attr_setstacksize () failed!" << std::endl;
return eGenericErr;
@ -203,13 +203,13 @@ void WCMRNativeAudioNoneDevice::_SilenceThread()
(const float*)theInpBuffers,
_m_outputBuffer,
buffer_size,
0,
0,
0
};
audioCallbackData.acdCycleStartTimeNanos =__get_time_nanos();
// VERY ROUGH IMPLEMENTATION:
// VERY ROUGH IMPLEMENTATION:
while(Streaming()) {
uint64_t cycleEndTimeNanos = audioCallbackData.acdCycleStartTimeNanos + cyclePeriodNanos;
@ -236,13 +236,13 @@ void* WCMRNativeAudioNoneDevice::__SilenceThread(void *This)
#if defined(PLATFORM_WINDOWS)
void WCMRNativeAudioNoneDevice::_usleep(uint64_t duration_usec)
{
LARGE_INTEGER ft;
{
LARGE_INTEGER ft;
ft.QuadPart = -(10*duration_usec); // Convert to 100 nanosecond interval, negative value indicates relative time
SetWaitableTimer(_waitableTimerForUsleep, &ft, 0, NULL, NULL, 0);
WaitForSingleObject(_waitableTimerForUsleep, INFINITE);
WaitForSingleObject(_waitableTimerForUsleep, INFINITE);
}
#endif
@ -254,9 +254,9 @@ WCMRNativeAudioNoneDevice::__get_time_nanos ()
// the API should be a part of WCMRCoreAudioDeviceManager to give a chance of being tied to the
// audio device transport timeß.
return AudioConvertHostTimeToNanos (AudioGetCurrentHostTime ());
#elif PLATFORM_WINDOWS
LARGE_INTEGER Frequency, Count ;
QueryPerformanceFrequency (&Frequency) ;

View File

@ -25,7 +25,7 @@ using namespace wvNS;
#define PROPERTY_CHANGE_TIMEOUT_SECONDS 2
#define PROPERTY_CHANGE_RETRIES 3
///< Supported Sample rates
///< Supported Sample rates
static const double gAllSampleRates[] =
{
44100.0, 48000.0, 88200.0, 96000.0, 176400.0, 192000.0, -1 /* negative terminated list */
@ -64,7 +64,7 @@ DWORD WINAPI WCMRPortAudioDevice::__DoIdle__(LPVOID lpThreadParameter)
}
//**********************************************************************************************
// WCMRPortAudioDevice::WCMRPortAudioDevice
// WCMRPortAudioDevice::WCMRPortAudioDevice
//
//! Constructor for the audio device. Opens the PA device
//! and gets information about the device.
@ -74,9 +74,9 @@ DWORD WINAPI WCMRPortAudioDevice::__DoIdle__(LPVOID lpThreadParameter)
//! \param *pManager : The audio device manager that's managing this device.
//! \param deviceID : The port audio device ID.
//! \param useMultithreading : Whether to use multi-threading for audio processing. Default is true.
//!
//!
//! \return Nothing.
//!
//!
//**********************************************************************************************
WCMRPortAudioDevice::WCMRPortAudioDevice (WCMRPortAudioDeviceManager *pManager, unsigned int deviceID, bool useMultithreading, bool bNoCopy) :
WCMRNativeAudioDevice (pManager, useMultithreading, bNoCopy)
@ -230,16 +230,16 @@ void WCMRPortAudioDevice::terminateDevice()
//**********************************************************************************************
// WCMRPortAudioDevice::~WCMRPortAudioDevice
// WCMRPortAudioDevice::~WCMRPortAudioDevice
//
//! Destructor for the audio device. The base release all the connections that were created, if
//! they have not been already destroyed! Here we simply stop streaming, and close device
//! handles if necessary.
//!
//! \param none
//!
//!
//! \return Nothing.
//!
//!
//**********************************************************************************************
WCMRPortAudioDevice::~WCMRPortAudioDevice ()
{
@ -293,13 +293,13 @@ WTErr WCMRPortAudioDevice::UpdateDeviceInfo ()
//**********************************************************************************************
// WCMRPortAudioDevice::updateDeviceInfo
// WCMRPortAudioDevice::updateDeviceInfo
//
//! Must be called be device processing thread
//! Updates Device Information about channels, sampling rates, buffer sizes.
//!
//! \return Nothing.
//!
//!
//**********************************************************************************************
void WCMRPortAudioDevice::updateDeviceInfo (bool callerIsWaiting/*=false*/)
{
@ -353,7 +353,7 @@ void WCMRPortAudioDevice::updateDeviceInfo (bool callerIsWaiting/*=false*/)
m_BufferSizes.clear();
bool useDefaultBuffers = true;
// In ASIO Windows, the buffer size is set from the sound device manufacturer's control panel
// In ASIO Windows, the buffer size is set from the sound device manufacturer's control panel
long minSize, maxSize, preferredSize, granularity;
PaError err = PaAsio_GetAvailableBufferSizes(m_DeviceID, &minSize, &maxSize, &preferredSize, &granularity);
@ -486,15 +486,15 @@ PaError WCMRPortAudioDevice::testStateValidness(int sampleRate, int bufferSize)
//**********************************************************************************************
// WCMRPortAudioDevice::CurrentSamplingRate
// WCMRPortAudioDevice::CurrentSamplingRate
//
//! The device's current sampling rate. This may be overridden, if the device needs to
//! The device's current sampling rate. This may be overridden, if the device needs to
//! query the driver for the current rate.
//!
//! \param none
//!
//!
//! \return The device's current sampling rate. -1 on error.
//!
//!
//**********************************************************************************************
int WCMRPortAudioDevice::CurrentSamplingRate ()
{
@ -561,14 +561,14 @@ WTErr WCMRPortAudioDevice::ResetDevice()
//**********************************************************************************************
// WCMRPortAudioDevice::SetCurrentSamplingRate
// WCMRPortAudioDevice::SetCurrentSamplingRate
//
//! Change the sampling rate to be used by the device.
//! Change the sampling rate to be used by the device.
//!
//! \param newRate : The rate to use (samples per sec).
//!
//!
//! \return eNoErr always. The derived classes may return error codes.
//!
//!
//**********************************************************************************************
WTErr WCMRPortAudioDevice::SetCurrentSamplingRate (int newRate)
{
@ -622,13 +622,13 @@ WTErr WCMRPortAudioDevice::SetCurrentSamplingRate (int newRate)
//**********************************************************************************************
// WCMRPortAudioDevice::CurrentBufferSize
//
//! The device's current buffer size in use. This may be overridden, if the device needs to
//! The device's current buffer size in use. This may be overridden, if the device needs to
//! query the driver for the current size.
//!
//! \param none
//!
//!
//! \return The device's current buffer size. 0 on error.
//!
//!
//**********************************************************************************************
int WCMRPortAudioDevice::CurrentBufferSize ()
{
@ -639,13 +639,13 @@ int WCMRPortAudioDevice::CurrentBufferSize ()
//**********************************************************************************************
// WCMRPortAudioDevice::SetCurrentBufferSize
//
//! Change the buffer size to be used by the device. This will most likely be overridden,
//! Change the buffer size to be used by the device. This will most likely be overridden,
//! the base class simply updates the member variable.
//!
//! \param newSize : The buffer size to use (in sample-frames)
//!
//!
//! \return eNoErr always. The derived classes may return error codes.
//!
//!
//**********************************************************************************************
WTErr WCMRPortAudioDevice::SetCurrentBufferSize (int newSize)
{
@ -678,15 +678,15 @@ WTErr WCMRPortAudioDevice::SetCurrentBufferSize (int newSize)
//**********************************************************************************************
// WCMRPortAudioDevice::ConnectionStatus
// WCMRPortAudioDevice::ConnectionStatus
//
//! Retrieves the device's current connection status. This will most likely be overridden,
//! in case some driver communication is required to query the status.
//!
//! \param none
//!
//!
//! \return A ConnectionStates value.
//!
//!
//**********************************************************************************************
WCMRPortAudioDevice::ConnectionStates WCMRPortAudioDevice::ConnectionStatus ()
{
@ -701,7 +701,7 @@ WCMRPortAudioDevice::ConnectionStates WCMRPortAudioDevice::ConnectionStatus ()
// WCMRPortAudioDevice::activateDevice
//
//! IS CALLED BY PROCESS THREAD
//! Sets the device into "active" state. Essentially, opens the PA device.
//! Sets the device into "active" state. Essentially, opens the PA device.
//! If it's an ASIO device it may result in buffer size change in some cases.
//!
//**********************************************************************************************
@ -740,7 +740,7 @@ void WCMRPortAudioDevice::activateDevice (bool callerIsWaiting/*=false*/)
std::cout << "API::Device " << m_DeviceName << " Opening device stream " << std::endl;
std::cout << "Sample rate: " << m_CurrentSamplingRate << " buffer size: " << m_CurrentBufferSize << std::endl;
paErr = Pa_OpenStream(&m_PortAudioStream,
paErr = Pa_OpenStream(&m_PortAudioStream,
pInS,
pOutS,
m_CurrentSamplingRate,
@ -817,7 +817,7 @@ void WCMRPortAudioDevice::activateDevice (bool callerIsWaiting/*=false*/)
// WCMRPortAudioDevice::deactivateDevice
//
//! IS CALLED BY PROCESS THREAD
//! Sets the device into "inactive" state. Essentially, closes the PA device.
//! Sets the device into "inactive" state. Essentially, closes the PA device.
//!
//**********************************************************************************************
void WCMRPortAudioDevice::deactivateDevice (bool callerIsWaiting/*=false*/)
@ -878,7 +878,7 @@ void WCMRPortAudioDevice::deactivateDevice (bool callerIsWaiting/*=false*/)
//
//! Sets the devices into "streaming" state. Calls PA's Start stream routines.
//! This roughly corresponds to calling Start on the lower level interface.
//!
//!
//**********************************************************************************************
void WCMRPortAudioDevice::startStreaming (bool callerIsWaiting/*=false*/)
{
@ -928,7 +928,7 @@ void WCMRPortAudioDevice::startStreaming (bool callerIsWaiting/*=false*/)
//
//! Sets the devices into "not streaming" state. Calls PA's Stop stream routines.
//! This roughly corresponds to calling Stop on the lower level interface.
//!
//!
//**********************************************************************************************
void WCMRPortAudioDevice::stopStreaming (bool callerIsWaiting/*=false*/)
{
@ -963,15 +963,15 @@ void WCMRPortAudioDevice::stopStreaming (bool callerIsWaiting/*=false*/)
//**********************************************************************************************
// WCMRPortAudioDevice::resetDevice
// WCMRPortAudioDevice::resetDevice
//
//! Resets the device, updates device info. Importnat: does PA reinitialization calling
//! Pa_terminate/Pa_initialize functions.
//!
//! \param none
//!
//!
//! \return nothing
//!
//!
//**********************************************************************************************
void WCMRPortAudioDevice::resetDevice (bool callerIsWaiting /*=false*/ )
{
@ -1007,7 +1007,7 @@ void WCMRPortAudioDevice::resetDevice (bool callerIsWaiting /*=false*/ )
if (paErr != paNoError)
{
continue;
}
}
m_CurrentBufferSize = preferredSize;
paErr = testStateValidness(m_CurrentSamplingRate, m_CurrentBufferSize);
@ -1115,22 +1115,22 @@ long WCMRPortAudioDevice::ASIOMessageHook (long selector, long WCUNUSEDPARAM(val
//**********************************************************************************************
// WCMRPortAudioDevice::DoIdle
// WCMRPortAudioDevice::DoIdle
//
//! A place for doing idle time processing. The other derived classes will probably do something
//! meaningful.
//!
//! \param none
//!
//!
//! \return eNoErr always.
//!
//!
//**********************************************************************************************
WTErr WCMRPortAudioDevice::DoIdle ()
{
WTErr retVal = eNoErr;
std::cout << "WCMRPortAudioDevice::DoIdle ()" << std::endl;
HANDLE hEvents[] =
HANDLE hEvents[] =
{
m_hUpdateDeviceInfoRequestedEvent,
m_hActivateRequestedEvent,
@ -1218,15 +1218,15 @@ WTErr WCMRPortAudioDevice::DoIdle ()
//**********************************************************************************************
// WCMRPortAudioDevice::SetMonitorChannels
// WCMRPortAudioDevice::SetMonitorChannels
//
//! Used to set the channels to be used for monitoring.
//!
//! \param leftChannel : Left monitor channel index.
//! \param rightChannel : Right monitor channel index.
//!
//!
//! \return eNoErr always, the derived classes may return appropriate errors.
//!
//!
//**********************************************************************************************
WTErr WCMRPortAudioDevice::SetMonitorChannels (int leftChannel, int rightChannel)
{
@ -1241,14 +1241,14 @@ WTErr WCMRPortAudioDevice::SetMonitorChannels (int leftChannel, int rightChannel
//**********************************************************************************************
// WCMRPortAudioDevice::SetMonitorGain
// WCMRPortAudioDevice::SetMonitorGain
//
//! Used to set monitor gain (or atten).
//!
//! \param newGain : The new gain or atten. value to use. Specified as a linear multiplier (not dB)
//!
//! \param newGain : The new gain or atten. value to use. Specified as a linear multiplier (not dB)
//!
//! \return eNoErr always, the derived classes may return appropriate errors.
//!
//!
//**********************************************************************************************
WTErr WCMRPortAudioDevice::SetMonitorGain (float newGain)
{
@ -1264,15 +1264,15 @@ WTErr WCMRPortAudioDevice::SetMonitorGain (float newGain)
//**********************************************************************************************
// WCMRPortAudioDevice::ShowConfigPanel
// WCMRPortAudioDevice::ShowConfigPanel
//
//! Used to show device specific config/control panel. Some interfaces may not support it.
//! Some interfaces may require the device to be active before it can display a panel.
//!
//! \param pParam : A device/interface specific parameter, should be the app window handle for ASIO.
//!
//!
//! \return eNoErr always, the derived classes may return errors.
//!
//!
//**********************************************************************************************
WTErr WCMRPortAudioDevice::ShowConfigPanel (void *pParam)
{
@ -1315,7 +1315,7 @@ WTErr WCMRPortAudioDevice::ShowConfigPanel (void *pParam)
//*****************************************************************************************************
// WCMRPortAudioDevice::TheCallback
//
//! The (static) Port Audio Callback function. This is a static member. It calls on the AudioCallback in the
//! The (static) Port Audio Callback function. This is a static member. It calls on the AudioCallback in the
//! WCMRPortAudioDevice to do the real work.
//!
//! \param pInputBuffer: pointer to input buffer.
@ -1324,10 +1324,10 @@ WTErr WCMRPortAudioDevice::ShowConfigPanel (void *pParam)
//! \param pTimeInfo: time info for PaStream callback.
//! \param statusFlags:
//! \param pUserData: pointer to user data, in our case the WCMRPortAudioDevice object.
//!
//!
//! \return true to stop streaming else returns false.
//******************************************************************************************************
int WCMRPortAudioDevice::TheCallback (const void *pInputBuffer, void *pOutputBuffer, unsigned long framesPerBuffer,
int WCMRPortAudioDevice::TheCallback (const void *pInputBuffer, void *pOutputBuffer, unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo* /*pTimeInfo*/, PaStreamCallbackFlags statusFlags, void *pUserData )
{
WCMRPortAudioDevice *pMyDevice = (WCMRPortAudioDevice *)pUserData;
@ -1342,10 +1342,10 @@ int WCMRPortAudioDevice::TheCallback (const void *pInputBuffer, void *pOutputBuf
//**********************************************************************************************
// WCMRPortAudioDevice::AudoiCallback
// WCMRPortAudioDevice::AudoiCallback
//
//! Here's where the actual audio processing happens. We call upon all the active connections'
//! sinks to provide data to us which can be put/mixed in the output buffer! Also, we make the
//! Here's where the actual audio processing happens. We call upon all the active connections'
//! sinks to provide data to us which can be put/mixed in the output buffer! Also, we make the
//! input data available to any sources that may call upon us during this time!
//!
//! \param *pInputBuffer : Points to a buffer with recorded data.
@ -1354,9 +1354,9 @@ int WCMRPortAudioDevice::TheCallback (const void *pInputBuffer, void *pOutputBuf
//! which are interleaved, is fixed at Device Open (Active) time. In this implementation,
//! the number of channels are fixed to use the maximum available.
//! \param dropsDetected : True if dropouts were detected in input or output. Can be used to signal the GUI.
//!
//!
//! \return true
//!
//!
//**********************************************************************************************
int WCMRPortAudioDevice::AudioCallback( const float *pInputBuffer, float *pOutputBuffer, unsigned long framesPerBuffer, bool dropsDetected )
{
@ -1382,7 +1382,7 @@ int WCMRPortAudioDevice::AudioCallback( const float *pInputBuffer, float *pOutpu
m_SampleCounter,
theStartTime.MicroSeconds()*1000
};
m_pMyManager->NotifyClient (WCMRAudioDeviceManagerClient::AudioCallback, (void *)&audioCallbackData );
//Don't try to access after this call returns!
@ -1404,11 +1404,11 @@ int WCMRPortAudioDevice::AudioCallback( const float *pInputBuffer, float *pOutpu
//! \param *pTheClient : The manager's client object (which receives notifications).
//! \param interfaceType : The PortAudio interface type to use for this manager - acts as a filter.
//! \param useMultithreading : Whether to use multi-threading for audio processing. Default is true.
//!
//!
//! \return Nothing.
//!
//!
//**********************************************************************************************
WCMRPortAudioDeviceManager::WCMRPortAudioDeviceManager (WCMRAudioDeviceManagerClient *pTheClient,
WCMRPortAudioDeviceManager::WCMRPortAudioDeviceManager (WCMRAudioDeviceManagerClient *pTheClient,
eAudioDeviceFilter eCurAudioDeviceFilter, bool useMultithreading, bool bNocopy)
: WCMRAudioDeviceManager (pTheClient, eCurAudioDeviceFilter)
, m_NoneDevice(0)
@ -1436,9 +1436,9 @@ WCMRPortAudioDeviceManager::WCMRPortAudioDeviceManager (WCMRAudioDeviceManagerCl
//! It clears the device list, releasing each of the device.
//!
//! \param none
//!
//!
//! \return Nothing.
//!
//!
//**********************************************************************************************
WCMRPortAudioDeviceManager::~WCMRPortAudioDeviceManager()
{
@ -1463,7 +1463,7 @@ WCMRPortAudioDeviceManager::~WCMRPortAudioDeviceManager()
WCMRAudioDevice* WCMRPortAudioDeviceManager::initNewCurrentDeviceImpl(const std::string & deviceName)
{
destroyCurrentDeviceImpl();
std::cout << "API::PortAudioDeviceManager::initNewCurrentDevice " << deviceName << std::endl;
if (deviceName == m_NoneDevice->DeviceName() )
{
@ -1687,7 +1687,7 @@ WTErr WCMRPortAudioDeviceManager::generateDeviceListImpl()
m_DeviceInfoVec.push_back(pDevInfo);
break;
}
if(bRejectDevice)
{
TRACE_MSG ("API::PortAudioDeviceManager::Device " << pDevInfo->m_DeviceName << "Rejected. \
@ -1721,9 +1721,9 @@ WTErr WCMRPortAudioDeviceManager::generateDeviceListImpl()
WTErr WCMRPortAudioDeviceManager::getDeviceSampleRatesImpl(const std::string & deviceName, std::vector<int>& sampleRates) const
{
sampleRates.clear ();
WTErr retVal = eNoErr;
if (m_CurrentDevice && deviceName == m_CurrentDevice->DeviceName() )
{
sampleRates=m_CurrentDevice->SamplingRates();
@ -1732,7 +1732,7 @@ WTErr WCMRPortAudioDeviceManager::getDeviceSampleRatesImpl(const std::string & d
DeviceInfo devInfo;
retVal = GetDeviceInfoByName(deviceName, devInfo);
if (eNoErr == retVal)
{
sampleRates=devInfo.m_AvailableSampleRates;
@ -1765,7 +1765,7 @@ WTErr WCMRPortAudioDeviceManager::getDeviceBufferSizesImpl(const std::string & d
return retVal;
}
DeviceInfo devInfo;
DeviceInfo devInfo;
retVal = GetDeviceInfoByName(deviceName, devInfo);
if (eNoErr == retVal)

View File

@ -101,7 +101,7 @@ public:
inline bool is_spp() const { return this->_buf[0] == 0xF2 && this->size() == 1; }
inline bool is_mtc_quarter() const { return this->_buf[0] == 0xF1 && this->size() == 1; }
inline bool is_mtc_full() const {
return this->size() == 10 && this->_buf[0] == 0xf0 && this->_buf[1] == 0x7f &&
return this->size() == 10 && this->_buf[0] == 0xf0 && this->_buf[1] == 0x7f &&
this->_buf[3] == 0x01 && this->_buf[4] == 0x01;
}

View File

@ -288,8 +288,8 @@ ControlList::thin (double thinning_factor)
/* compute the area of the triangle formed by 3 points
*/
double area = fabs ((prevprev->when * (prev->value - cur->value)) +
(prev->when * (cur->value - prevprev->value)) +
double area = fabs ((prevprev->when * (prev->value - cur->value)) +
(prev->when * (cur->value - prevprev->value)) +
(cur->when * (prevprev->value - prev->value)));
if (area < thinning_factor) {
@ -413,11 +413,11 @@ ControlList::add_guard_point (double when)
/* most_recent_insert_iterator points to a control event
already at the insert position, so there is
nothing to do.
... except ...
... except ...
advance most_recent_insert_iterator so that the "real"
insert occurs in the right place, since it
insert occurs in the right place, since it
points to the control event just inserted.
*/
@ -427,13 +427,13 @@ ControlList::add_guard_point (double when)
/* insert a new control event at the right spot
*/
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert eval-value %2 just before iterator @ %3\n",
DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 insert eval-value %2 just before iterator @ %3\n",
this, eval_value, (*most_recent_insert_iterator)->when));
most_recent_insert_iterator = _events.insert (most_recent_insert_iterator, new ControlEvent (when, eval_value));
/* advance most_recent_insert_iterator so that the "real"
* insert occurs in the right place, since it
* insert occurs in the right place, since it
* points to the control event just inserted.
*/

View File

@ -26,13 +26,13 @@ static event_id_t _event_id_counter = 0;
event_id_t
event_id_counter()
{
return g_atomic_int_get (&_event_id_counter);
return g_atomic_int_get (&_event_id_counter);
}
void
init_event_id_counter(event_id_t n)
{
g_atomic_int_set (&_event_id_counter, n);
void
init_event_id_counter(event_id_t n)
{
g_atomic_int_set (&_event_id_counter, n);
}
event_id_t

View File

@ -334,7 +334,7 @@ CurveTest::constrainedCubic ()
f"2(x2) = 2*(2*f'2(x2) + f'2(x1))/(x2 x1) - 6*(y2 y1)/ (x2 x1)^2
= 2*(2*0 + 1.8181)/(30 10) 6*(150 130)/(30 10)^2
= -0.11818
d2 = 1/6 * (f"2(x2) - f"2(x1))/(x2 x1)
= 1/6 * (-0.11818 + 0.063636)/(30 10)
= -0.0004545

View File

@ -172,7 +172,7 @@ MidnamTest::yamaha_PSRS900_patchfile_test()
}
}
void
void
MidnamTest::load_all_midnams_test ()
{
vector<std::string> result;

View File

@ -264,7 +264,7 @@ public:
BOOST_ASSERT(px != 0);
return px;
}
T * get() const // never throws
{
return px;
@ -284,13 +284,13 @@ public:
( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) )
typedef T * (this_type::*unspecified_bool_type)() const;
operator unspecified_bool_type() const // never throws
{
return px == 0? 0: &this_type::get;
}
#else
#else
typedef T * this_type::*unspecified_bool_type;
@ -446,7 +446,7 @@ using std::basic_ostream;
template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, shared_ptr<Y> const & p)
# else
template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, shared_ptr<Y> const & p)
# endif
# endif
{
os << p.get();
return os;
@ -482,7 +482,7 @@ template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif
#endif
#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)

View File

@ -39,7 +39,7 @@ Pitch::getPitchForFrequency(float frequency,
midiPitch = midiPitch + 1;
centsOffset = -(100.0 - centsOffset);
}
if (centsOffsetReturn) *centsOffsetReturn = centsOffset;
return midiPitch;
}

File diff suppressed because it is too large Load Diff

View File

@ -124,7 +124,7 @@ void Chromagram::unityNormalise(double *src)
double* Chromagram::process( const double *data )
{
if (!m_skGenerated) {
// Generate CQ Kernel
// Generate CQ Kernel
m_ConstantQ->sparsekernel();
m_skGenerated = true;
}
@ -148,7 +148,7 @@ double* Chromagram::process( const double *data )
double* Chromagram::process( const double *real, const double *imag )
{
if (!m_skGenerated) {
// Generate CQ Kernel
// Generate CQ Kernel
m_ConstantQ->sparsekernel();
m_skGenerated = true;
}
@ -164,10 +164,10 @@ double* Chromagram::process( const double *real, const double *imag )
// add each octave of cq data into Chromagram
const unsigned octaves = (int)floor(double( m_uK/m_BPO))-1;
for (unsigned octave = 0; octave <= octaves; octave++)
for (unsigned octave = 0; octave <= octaves; octave++)
{
unsigned firstBin = octave*m_BPO;
for (unsigned i = 0; i < m_BPO; i++)
for (unsigned i = 0; i < m_BPO; i++)
{
m_chromadata[i] += kabs( m_CQRe[ firstBin + i ], m_CQIm[ firstBin + i ]);
}

View File

@ -96,7 +96,7 @@ void ConstantQ::sparsekernel()
double* transfHammingWindowRe = new double [ m_FFTLength ];
double* transfHammingWindowIm = new double [ m_FFTLength ];
for (unsigned u=0; u < m_FFTLength; u++)
for (unsigned u=0; u < m_FFTLength; u++)
{
hammingWindowRe[u] = 0;
hammingWindowIm[u] = 0;
@ -111,26 +111,26 @@ void ConstantQ::sparsekernel()
sk->imag.reserve( m_FFTLength*2 );
// for each bin value K, calculate temporal kernel, take its fft to
//calculate the spectral kernel then threshold it to make it sparse and
//calculate the spectral kernel then threshold it to make it sparse and
//add it to the sparse kernels matrix
double squareThreshold = m_CQThresh * m_CQThresh;
FFT m_FFT(m_FFTLength);
for (unsigned k = m_uK; k--; )
for (unsigned k = m_uK; k--; )
{
for (unsigned u=0; u < m_FFTLength; u++)
for (unsigned u=0; u < m_FFTLength; u++)
{
hammingWindowRe[u] = 0;
hammingWindowIm[u] = 0;
}
// Computing a hamming window
const unsigned hammingLength = (int) ceil( m_dQ * m_FS / ( m_FMin * pow(2,((double)(k))/(double)m_BPO)));
unsigned origin = m_FFTLength/2 - hammingLength/2;
for (unsigned i=0; i<hammingLength; i++)
for (unsigned i=0; i<hammingLength; i++)
{
const double angle = 2*PI*m_dQ*i/hammingLength;
const double real = cos(angle);
@ -148,12 +148,12 @@ void ConstantQ::sparsekernel()
hammingWindowIm[i] = hammingWindowIm[i + m_FFTLength/2];
hammingWindowIm[i + m_FFTLength/2] = temp;
}
//do fft of hammingWindow
m_FFT.process( 0, hammingWindowRe, hammingWindowIm, transfHammingWindowRe, transfHammingWindowIm );
for (unsigned j=0; j<( m_FFTLength ); j++)
for (unsigned j=0; j<( m_FFTLength ); j++)
{
// perform thresholding
const double squaredBin = squaredModule( transfHammingWindowRe[ j ], transfHammingWindowIm[ j ]);
@ -241,7 +241,7 @@ void ConstantQ::sparsekernel()
cout << "}" << endl;
*/
// std::cerr << "done\n -> is: " << sk->is.size() << ", js: " << sk->js.size() << ", reals: " << sk->real.size() << ", imags: " << sk->imag.size() << std::endl;
m_sparseKernel = sk;
return;
}
@ -256,7 +256,7 @@ double* ConstantQ::process( const double* fftdata )
SparseKernel *sk = m_sparseKernel;
for (unsigned row=0; row<2*m_uK; row++)
for (unsigned row=0; row<2*m_uK; row++)
{
m_CQdata[ row ] = 0;
m_CQdata[ row+1 ] = 0;
@ -324,7 +324,7 @@ void ConstantQ::process(const double *FFTRe, const double* FFTIm,
SparseKernel *sk = m_sparseKernel;
for (unsigned row=0; row<m_uK; row++)
for (unsigned row=0; row<m_uK; row++)
{
CQRe[ row ] = 0;
CQIm[ row ] = 0;

View File

@ -27,75 +27,75 @@ MFCC::MFCC(MFCCConfig config)
/* Calculate at startup */
double *freqs, *lower, *center, *upper, *triangleHeight, *fftFreqs;
lowestFrequency = 66.6666666;
linearFilters = 13;
linearSpacing = 66.66666666;
logFilters = 27;
logSpacing = 1.0711703;
/* FFT and analysis window sizes */
fftSize = config.fftsize;
fft = new FFTReal(fftSize);
totalFilters = linearFilters + logFilters;
logPower = config.logpower;
samplingRate = config.FS;
/* The number of cepstral componenents */
nceps = config.nceps;
/* Set if user want C0 */
WANT_C0 = (config.want_c0 ? 1 : 0);
/* Allocate space for feature vector */
if (WANT_C0 == 1) {
ceps = (double*)calloc(nceps+1, sizeof(double));
} else {
ceps = (double*)calloc(nceps, sizeof(double));
}
/* Allocate space for local vectors */
mfccDCTMatrix = (double**)calloc(nceps+1, sizeof(double*));
for (i = 0; i < nceps+1; i++) {
mfccDCTMatrix[i]= (double*)calloc(totalFilters, sizeof(double));
mfccDCTMatrix[i]= (double*)calloc(totalFilters, sizeof(double));
}
mfccFilterWeights = (double**)calloc(totalFilters, sizeof(double*));
for (i = 0; i < totalFilters; i++) {
mfccFilterWeights[i] = (double*)calloc(fftSize, sizeof(double));
mfccFilterWeights[i] = (double*)calloc(fftSize, sizeof(double));
}
freqs = (double*)calloc(totalFilters+2,sizeof(double));
lower = (double*)calloc(totalFilters,sizeof(double));
center = (double*)calloc(totalFilters,sizeof(double));
upper = (double*)calloc(totalFilters,sizeof(double));
triangleHeight = (double*)calloc(totalFilters,sizeof(double));
fftFreqs = (double*)calloc(fftSize,sizeof(double));
for (i = 0; i < linearFilters; i++) {
freqs[i] = lowestFrequency + ((double)i) * linearSpacing;
}
for (i = linearFilters; i < totalFilters+2; i++) {
freqs[i] = freqs[linearFilters-1] *
freqs[i] = freqs[linearFilters-1] *
pow(logSpacing, (double)(i-linearFilters+1));
}
/* Define lower, center and upper */
memcpy(lower, freqs,totalFilters*sizeof(double));
memcpy(center, &freqs[1],totalFilters*sizeof(double));
memcpy(upper, &freqs[2],totalFilters*sizeof(double));
for (i=0;i<totalFilters;i++){
triangleHeight[i] = 2./(upper[i]-lower[i]);
}
for (i=0;i<fftSize;i++){
fftFreqs[i] = ((double) i / ((double) fftSize ) *
fftFreqs[i] = ((double) i / ((double) fftSize ) *
(double) samplingRate);
}
@ -103,12 +103,12 @@ MFCC::MFCC(MFCCConfig config)
for (i=0;i<totalFilters;i++){
for (j=0;j<fftSize;j++) {
if ((fftFreqs[j] > lower[i]) && (fftFreqs[j] <= center[i])) {
mfccFilterWeights[i][j] = triangleHeight[i] *
(fftFreqs[j]-lower[i]) / (center[i]-lower[i]);
mfccFilterWeights[i][j] = triangleHeight[i] *
(fftFreqs[j]-lower[i]) / (center[i]-lower[i]);
}
else
{
@ -118,7 +118,7 @@ MFCC::MFCC(MFCCConfig config)
if ((fftFreqs[j]>center[i]) && (fftFreqs[j]<upper[i])) {
mfccFilterWeights[i][j] = mfccFilterWeights[i][j]
+ triangleHeight[i] * (upper[i]-fftFreqs[j])
+ triangleHeight[i] * (upper[i]-fftFreqs[j])
/ (upper[i]-center[i]);
}
else
@ -130,15 +130,15 @@ MFCC::MFCC(MFCCConfig config)
}
/*
* We calculate now mfccDCT matrix
* We calculate now mfccDCT matrix
* NB: +1 because of the DC component
*/
const double pi = 3.14159265358979323846264338327950288;
for (i = 0; i < nceps+1; i++) {
for (j = 0; j < totalFilters; j++) {
mfccDCTMatrix[i][j] = (1./sqrt((double) totalFilters / 2.))
mfccDCTMatrix[i][j] = (1./sqrt((double) totalFilters / 2.))
* cos((double) i * ((double) j + 0.5) / (double) totalFilters * pi);
}
}
@ -146,7 +146,7 @@ MFCC::MFCC(MFCCConfig config)
for (j = 0; j < totalFilters; j++){
mfccDCTMatrix[0][j] = (sqrt(2.)/2.) * mfccDCTMatrix[0][j];
}
/* The analysis window */
window = new Window<double>(config.window, fftSize);
@ -156,7 +156,7 @@ MFCC::MFCC(MFCCConfig config)
earMag = (double*)calloc(totalFilters, sizeof(double));
fftMag = (double*)calloc(fftSize/2, sizeof(double));
free(freqs);
free(lower);
free(center);
@ -168,27 +168,27 @@ MFCC::MFCC(MFCCConfig config)
MFCC::~MFCC()
{
int i;
/* Free the structure */
for (i = 0; i < nceps+1; i++) {
free(mfccDCTMatrix[i]);
}
free(mfccDCTMatrix);
for (i = 0; i < totalFilters; i++) {
free(mfccFilterWeights[i]);
}
free(mfccFilterWeights);
/* Free the feature vector */
free(ceps);
/* The analysis window */
delete window;
free(earMag);
free(fftMag);
/* Free the FFT */
free(realOut);
free(imagOut);
@ -198,17 +198,17 @@ MFCC::~MFCC()
/*
*
* Extract the MFCC on the input frame
*
*/
*
* Extract the MFCC on the input frame
*
*/
int MFCC::process(const double *inframe, double *outceps)
{
double *inputData = (double *)malloc(fftSize * sizeof(double));
for (int i = 0; i < fftSize; ++i) inputData[i] = inframe[i];
window->cut(inputData);
/* Calculate the fft on the input frame */
fft->process(0, inputData, realOut, imagOut);
@ -244,14 +244,14 @@ int MFCC::process(const double *real, const double *imag, double *outceps)
}
/*
*
* Calculate now the cepstral coefficients
*
* Calculate now the cepstral coefficients
* with or without the DC component
*
*/
if (WANT_C0 == 1) {
for (i = 0; i < nceps+1; i++) {
double tmp = 0.;
for (j = 0; j < totalFilters; j++){
@ -260,8 +260,8 @@ int MFCC::process(const double *real, const double *imag, double *outceps)
outceps[i] = tmp;
}
}
else
{
else
{
for (i = 1; i < nceps+1; i++) {
double tmp = 0.;
for (j = 0; j < totalFilters; j++){
@ -270,7 +270,7 @@ int MFCC::process(const double *real, const double *imag, double *outceps)
outceps[i-1] = tmp;
}
}
return nceps;
}

View File

@ -250,7 +250,7 @@ double DetectionFunction::complexSD(unsigned int length, double *srcMagnitude, d
double tmpPhase = 0;
double tmpReal = 0;
double tmpImag = 0;
double dev = 0;
ComplexData meas = ComplexData( 0, 0 );
ComplexData j = ComplexData( 0, 1 );
@ -287,7 +287,7 @@ double DetectionFunction::broadband(unsigned int length, double *src)
m_magHistory[i] = sqrmag;
}
return val;
}
}
double* DetectionFunction::getSpectrumMagnitude()
{

View File

@ -42,12 +42,12 @@ void PeakPicking::initialise( PPickParams Config )
Qfiltb = Config.QuadThresh.b ;
Qfiltc = Config.QuadThresh.c ;
m_DFProcessingParams.length = m_DFLength;
m_DFProcessingParams.LPOrd = Config.LPOrd;
m_DFProcessingParams.LPACoeffs = Config.LPACoeffs;
m_DFProcessingParams.LPBCoeffs = Config.LPBCoeffs;
m_DFProcessingParams.length = m_DFLength;
m_DFProcessingParams.LPOrd = Config.LPOrd;
m_DFProcessingParams.LPACoeffs = Config.LPACoeffs;
m_DFProcessingParams.LPBCoeffs = Config.LPBCoeffs;
m_DFProcessingParams.winPre = Config.WinT.pre;
m_DFProcessingParams.winPost = Config.WinT.post;
m_DFProcessingParams.winPost = Config.WinT.post;
m_DFProcessingParams.AlphaNormParam = Config.alpha;
m_DFProcessingParams.isMedianPositive = false;
@ -70,7 +70,7 @@ void PeakPicking::process( double* src, unsigned int len, vector<int> &onsets )
vector <double> m_maxima;
// Signal conditioning
// Signal conditioning
m_DFSmoothing->process( src, m_workBuffer );
for( unsigned int u = 0; u < len; u++)

View File

@ -70,7 +70,7 @@ void PhaseVocoder::getPhase(unsigned int size, double *theta, double *real, doub
{
unsigned int k;
// Phase Angle "matlab" style
// Phase Angle "matlab" style
//Watch out for quadrant mapping !!!
for( k = 0; k < size; k++)
{

View File

@ -51,7 +51,7 @@ void ClusterMeltSegmenter::initialise(int fs)
if (featureType == FEATURE_TYPE_CONSTQ ||
featureType == FEATURE_TYPE_CHROMA) {
// run internal processing at 11025 or thereabouts
int internalRate = 11025;
int decimationFactor = samplerate / internalRate;
@ -77,11 +77,11 @@ void ClusterMeltSegmenter::initialise(int fs)
constq = new ConstantQ(config);
constq->sparsekernel();
ncoeff = constq->getK();
fft = new FFTReal(constq->getfftlength());
} else if (featureType == FEATURE_TYPE_MFCC) {
// run internal processing at 22050 or thereabouts
@ -110,7 +110,7 @@ void ClusterMeltSegmenter::initialise(int fs)
}
}
ClusterMeltSegmenter::~ClusterMeltSegmenter()
ClusterMeltSegmenter::~ClusterMeltSegmenter()
{
delete window;
delete constq;
@ -164,7 +164,7 @@ void ClusterMeltSegmenter::extractFeaturesConstQ(const double* samples, int nsam
vector<double> cq(ncoeff);
for (int i = 0; i < ncoeff; ++i) cq[i] = 0.0;
const double *psource = samples;
int pcount = nsamples;
@ -174,9 +174,9 @@ void ClusterMeltSegmenter::extractFeaturesConstQ(const double* samples, int nsam
decimator->process(samples, decout);
psource = decout;
}
int origin = 0;
// std::cerr << "nsamples = " << nsamples << ", pcount = " << pcount << std::endl;
int frames = 0;
@ -208,9 +208,9 @@ void ClusterMeltSegmenter::extractFeaturesConstQ(const double* samples, int nsam
}
window->cut(frame);
fft->process(false, frame, real, imag);
constq->process(real, imag, cqre, cqim);
for (int i = 0; i < ncoeff; ++i) {
@ -255,7 +255,7 @@ void ClusterMeltSegmenter::extractFeaturesMFCC(const double* samples, int nsampl
vector<double> cc(ncoeff);
for (int i = 0; i < ncoeff; ++i) cc[i] = 0.0;
const double *psource = samples;
int pcount = nsamples;
@ -330,7 +330,7 @@ void ClusterMeltSegmenter::segment()
decimator = 0;
if (features.size() < histogramLength) return;
/*
/*
std::cerr << "ClusterMeltSegmenter::segment: have " << features.size()
<< " features with " << features[0].size() << " coefficients (ncoeff = " << ncoeff << ", ncomponents = " << ncomponents << ")" << std::endl;
*/
@ -353,10 +353,10 @@ void ClusterMeltSegmenter::segment()
if (featureType == FEATURE_TYPE_UNKNOWN ||
featureType == FEATURE_TYPE_MFCC)
cluster_segment(q, arrFeatures, features.size(), features[0].size(), nHMMStates, histogramLength,
cluster_segment(q, arrFeatures, features.size(), features[0].size(), nHMMStates, histogramLength,
nclusters, neighbourhoodLimit);
else
constq_segment(q, arrFeatures, features.size(), nbins, ncoeff, featureType,
constq_segment(q, arrFeatures, features.size(), nbins, ncoeff, featureType,
nHMMStates, histogramLength, nclusters, neighbourhoodLimit);
// convert the cluster assignment sequence to a segmentation

View File

@ -23,7 +23,7 @@ ostream& operator<<(ostream& os, const Segmentation& s)
for (int i = 0; i < s.segments.size(); i++)
{
Segment seg = s.segments[i];
os << std::fixed << seg.type << ':' << '\t' << std::setprecision(6) << seg.start / static_cast<double>(s.samplerate)
os << std::fixed << seg.type << ':' << '\t' << std::setprecision(6) << seg.start / static_cast<double>(s.samplerate)
<< '\t' << std::setprecision(6) << seg.end / static_cast<double>(s.samplerate) << "\n";
}

View File

@ -115,7 +115,7 @@ void DFProcess::medianFilter(double *src, double *dst)
{
if (index >= m_length) break;
l = 0;
for( j = i; j < ( i + m_winPost + m_winPre + 1); j++)
{
@ -140,7 +140,7 @@ void DFProcess::medianFilter(double *src, double *dst)
l++;
}
scratch[ index++ ] = MathUtilities::median( y, l);
scratch[ index++ ] = MathUtilities::median( y, l);
}
@ -182,6 +182,6 @@ void DFProcess::removeDCNormalize( double *src, double*dst )
for(int i = 0; i< m_length; i++)
{
dst[ i ] = ( src[ i ] - DFMin ) / DFAlphaNorm;
dst[ i ] = ( src[ i ] - DFMin ) / DFAlphaNorm;
}
}

View File

@ -63,7 +63,7 @@ void FiltFilt::process(double *src, double *dst, unsigned int length)
m_filtScratchOut = new double[ nExt ];
for( i = 0; i< nExt; i++ )
for( i = 0; i< nExt; i++ )
{
m_filtScratchIn[ i ] = 0.0;
m_filtScratchOut[ i ] = 0.0;
@ -94,16 +94,16 @@ void FiltFilt::process(double *src, double *dst, unsigned int length)
// Do 0Ph filtering
m_filter->process( m_filtScratchIn, m_filtScratchOut, nExt);
// reverse the series for FILTFILT
// reverse the series for FILTFILT
for ( i = 0; i < nExt; i++)
{
{
m_filtScratchIn[ i ] = m_filtScratchOut[ nExt - i - 1];
}
// do FILTER again
// do FILTER again
m_filter->process( m_filtScratchIn, m_filtScratchOut, nExt);
// reverse the series back
// reverse the series back
for ( i = 0; i < nExt; i++)
{
m_filtScratchIn[ i ] = m_filtScratchOut[ nExt - i - 1 ];

View File

@ -64,7 +64,7 @@ void Framer::getFrame(double *dst)
{
for( unsigned int u = 0; u < m_frameLength; u++)
{
dst[ u ] = m_srcBuffer[ m_ulSrcIndex++ ];
dst[ u ] = m_srcBuffer[ m_ulSrcIndex++ ];
}
m_ulSrcIndex -= ( m_frameLength - m_stepSize );
}

View File

@ -122,7 +122,7 @@ DownBeat::pushAudioBlock(const float *audio)
// std::cerr << "pushAudioBlock: rms in " << sqrt(rmsin) << ", out " << sqrt(rmsout) << std::endl;
m_buffill += m_increment / m_factor;
}
const float *
DownBeat::getBufferedAudio(size_t &length) const
{
@ -192,9 +192,9 @@ DownBeat::findDownBeats(const float *audio,
}
// Now FFT beat frame
m_fft->process(false, m_beatframe, m_fftRealOut, m_fftImagOut);
// Calculate magnitudes
for (size_t j = 0; j < m_beatframesize/2; ++j) {
@ -257,7 +257,7 @@ DownBeat::measureSpecDiff(d_vec_t oldspec, d_vec_t newspec)
{
// JENSEN-SHANNON DIVERGENCE BETWEEN SPECTRAL FRAMES
unsigned int SPECSIZE = 512; // ONLY LOOK AT FIRST 512 SAMPLES OF SPECTRUM.
unsigned int SPECSIZE = 512; // ONLY LOOK AT FIRST 512 SAMPLES OF SPECTRUM.
if (SPECSIZE > oldspec.size()/4) {
SPECSIZE = oldspec.size()/4;
}
@ -266,37 +266,37 @@ DownBeat::measureSpecDiff(d_vec_t oldspec, d_vec_t newspec)
double sumnew = 0.;
double sumold = 0.;
for (unsigned int i = 0;i < SPECSIZE;i++)
{
newspec[i] +=EPS;
oldspec[i] +=EPS;
sumnew+=newspec[i];
sumold+=oldspec[i];
}
}
for (unsigned int i = 0;i < SPECSIZE;i++)
{
newspec[i] /= (sumnew);
oldspec[i] /= (sumold);
// IF ANY SPECTRAL VALUES ARE 0 (SHOULDN'T BE ANY!) SET THEM TO 1
if (newspec[i] == 0)
{
newspec[i] = 1.;
}
if (oldspec[i] == 0)
{
oldspec[i] = 1.;
}
// JENSEN-SHANNON CALCULATION
sd1 = 0.5*oldspec[i] + 0.5*newspec[i];
SD = SD + (-sd1*log(sd1)) + (0.5*(oldspec[i]*log(oldspec[i]))) + (0.5*(newspec[i]*log(newspec[i])));
}
return SD;
}

View File

@ -41,7 +41,7 @@ TempoTrackV2::filter_df(d_vec_t &df)
b[0] = 0.2066;
b[1] = 0.4131;
b[2] = 0.2066;
double inp1 = 0.;
double inp2 = 0.;
double out1 = 0.;
@ -67,7 +67,7 @@ TempoTrackV2::filter_df(d_vec_t &df)
for (unsigned int i = 0;i < df.size();i++)
{
lp_df[i] = 0.;
lp_df[i] = 0.;
}
inp1 = 0.; inp2 = 0.;
@ -130,9 +130,9 @@ TempoTrackV2::calculateBeatPeriod(const vector<double> &df,
dfframe[k] = df[i+k];
}
// get rcf vector for current frame
d_vec_t rcf(wv_len);
d_vec_t rcf(wv_len);
get_rcf(dfframe,wv,rcf);
rcfmat.push_back( d_vec_t() ); // adds a new column
col_counter++;
for (unsigned int j=0; j<rcf.size(); j++)
@ -140,7 +140,7 @@ TempoTrackV2::calculateBeatPeriod(const vector<double> &df,
rcfmat[col_counter].push_back( rcf[j] );
}
}
// now call viterbi decoding function
viterbi_decode(rcfmat,wv,beat_period,tempi);
}
@ -161,7 +161,7 @@ TempoTrackV2::get_rcf(const d_vec_t &dfframe_in, const d_vec_t &wv, d_vec_t &rcf
d_vec_t acf(dfframe.size());
for (unsigned int lag=0; lag<dfframe.size(); lag++)
{
double sum = 0.;
@ -169,7 +169,7 @@ TempoTrackV2::get_rcf(const d_vec_t &dfframe_in, const d_vec_t &wv, d_vec_t &rcf
for (unsigned int n=0; n<(dfframe.size()-lag); n++)
{
tmp = dfframe[n] * dfframe[n+lag];
tmp = dfframe[n] * dfframe[n+lag];
sum += tmp;
}
acf[lag] = static_cast<double> (sum/ (dfframe.size()-lag));
@ -188,10 +188,10 @@ TempoTrackV2::get_rcf(const d_vec_t &dfframe_in, const d_vec_t &wv, d_vec_t &rcf
}
}
}
// apply adaptive threshold to rcf
MathUtilities::adaptiveThreshold(rcf);
double rcfsum =0.;
for (unsigned int i=0; i<rcf.size(); i++)
{
@ -222,7 +222,7 @@ TempoTrackV2::viterbi_decode(const d_mat_t &rcfmat, const d_vec_t &wv, d_vec_t &
tmat[i].push_back(0.); // fill with zeros initially
}
}
// variance of Gaussians in transition matrix
// formed of Gaussians on diagonal - implies slow tempo change
double sigma = 8.;
@ -265,16 +265,16 @@ TempoTrackV2::viterbi_decode(const d_mat_t &rcfmat, const d_vec_t &wv, d_vec_t &
delta[0][j] = wv[j] * rcfmat[0][j];
psi[0][j] = 0;
}
double deltasum = 0.;
for (unsigned int i=0; i<Q; i++)
{
deltasum += delta[0][i];
}
}
for (unsigned int i=0; i<Q; i++)
{
delta[0][i] /= (deltasum + EPS);
}
}
for (unsigned int t=1; t<T; t++)
@ -286,12 +286,12 @@ TempoTrackV2::viterbi_decode(const d_mat_t &rcfmat, const d_vec_t &wv, d_vec_t &
for (unsigned int i=0; i<Q; i++)
{
tmp_vec[i] = delta[t-1][i] * tmat[j][i];
}
delta[t][j] = get_max_val(tmp_vec);
}
delta[t][j] = get_max_val(tmp_vec);
psi[t][j] = get_max_ind(tmp_vec);
delta[t][j] *= rcfmat[t][j];
}
@ -300,23 +300,23 @@ TempoTrackV2::viterbi_decode(const d_mat_t &rcfmat, const d_vec_t &wv, d_vec_t &
for (unsigned int i=0; i<Q; i++)
{
deltasum += delta[t][i];
}
}
for (unsigned int i=0; i<Q; i++)
{
delta[t][i] /= (deltasum + EPS);
}
}
}
i_vec_t bestpath(T);
d_vec_t tmp_vec(Q);
for (unsigned int i=0; i<Q; i++)
{
{
tmp_vec[i] = delta[T-1][i];
}
// find starting point - best beat period for "last" frame
bestpath[T-1] = get_max_ind(tmp_vec);
// backtrace through index of maximum values in psi
for (unsigned int t=T-2; t>0 ;t--)
{
@ -328,7 +328,7 @@ TempoTrackV2::viterbi_decode(const d_mat_t &rcfmat, const d_vec_t &wv, d_vec_t &
unsigned int lastind = 0;
for (unsigned int i=0; i<T; i++)
{
{
unsigned int step = 128;
for (unsigned int j=0; j<step; j++)
{
@ -361,7 +361,7 @@ TempoTrackV2::get_max_val(const d_vec_t &df)
maxval = df[i];
}
}
return maxval;
}
@ -378,7 +378,7 @@ TempoTrackV2::get_max_ind(const d_vec_t &df)
ind = i;
}
}
return ind;
}
@ -390,7 +390,7 @@ TempoTrackV2::normalise_vec(d_vec_t &df)
{
sum += df[i];
}
for (unsigned int i=0; i<df.size(); i++)
{
df[i]/= (sum + EPS);
@ -436,7 +436,7 @@ TempoTrackV2::calculateBeats(const vector<double> &df,
// ELSE LEAVE AT DEFAULT VALUE FROM INITIALISATION: D_VEC_T SCORECANDS (TXWT.SIZE());
int cscore_ind = i+prange_min+j;
if (cscore_ind >= 0)
if (cscore_ind >= 0)
{
scorecands[j] = txwt[j] * cumscore[cscore_ind];
}
@ -457,7 +457,7 @@ TempoTrackV2::calculateBeats(const vector<double> &df,
for (unsigned int i=cumscore.size() - beat_period[beat_period.size()-1] ; i<cumscore.size(); i++)
{
tmp_vec.push_back(cumscore[i]);
}
}
int startpoint = get_max_ind(tmp_vec) + cumscore.size() - beat_period[beat_period.size()-1] ;
@ -476,10 +476,10 @@ TempoTrackV2::calculateBeats(const vector<double> &df,
if (backlink[b] == b) break; // shouldn't happen... haha
ibeats.push_back(backlink[b]);
}
// REVERSE SEQUENCE OF IBEATS AND STORE AS BEATS
for (unsigned int i=0; i<ibeats.size(); i++)
{
{
beats.push_back( static_cast<double>(ibeats[ibeats.size()-i-1]) );
}
}

View File

@ -34,7 +34,7 @@ TCSGram::~TCSGram()
void TCSGram::getTCSVector(int iPosition, TCSVector& rTCSVector) const
{
if (iPosition < 0)
if (iPosition < 0)
rTCSVector = TCSVector();
else if (iPosition >= m_VectorList.size())
rTCSVector = TCSVector();
@ -52,7 +52,7 @@ void TCSGram::addTCSVector(const TCSVector& rTCSVector)
{
size_t uSize = m_VectorList.size();
long lMilliSeconds = static_cast<long>(uSize*m_dFrameDurationMS);
std::pair<long, TCSVector> p;
std::pair<long, TCSVector> p;
p.first = lMilliSeconds;
p.second = rTCSVector;

View File

@ -85,7 +85,7 @@ Wavelet::createDecompositionFilters(Type wavelet,
switch (wavelet) {
case Haar:
case Haar:
lpd.push_back(0.70710678118655);
lpd.push_back(0.70710678118655);
hpd.push_back(-0.70710678118655);

View File

@ -40,7 +40,7 @@ void Correlation::doAutoUnBiased(double *src, double *dst, unsigned int length)
{
for( j = i; j < length; j++)
{
tmp += src[ j-i ] * src[ j ];
tmp += src[ j-i ] * src[ j ];
}

View File

@ -50,7 +50,7 @@ double KLDivergence::distanceDistribution(const vector<double> &d1,
double d = 0;
double small = 1e-20;
for (int i = 0; i < sz; ++i) {
d += d1[i] * log10((d1[i] + small) / (d2[i] + small));
}

View File

@ -76,7 +76,7 @@ double MathUtilities::getAlphaNorm( const std::vector <double> &data, unsigned i
double MathUtilities::round(double x)
{
double val = (double)floor(x + 0.5);
return val;
}
@ -86,7 +86,7 @@ double MathUtilities::median(const double *src, unsigned int len)
double tmp = 0.0;
double tempMedian;
double medianVal;
double* scratch = new double[ len ];//Vector < double > sortedX = Vector < double > ( size );
for ( i = 0; i < len; i++ )

View File

@ -58,9 +58,9 @@ Thread::start()
#endif
m_extant = true;
}
}
}
void
void
Thread::wait()
{
if (m_extant) {
@ -233,7 +233,7 @@ Condition::unlock()
ReleaseMutex(m_mutex);
}
void
void
Condition::wait(int us)
{
if (us == 0) {
@ -248,7 +248,7 @@ Condition::wait(int us)
DWORD ms = us / 1000;
if (us > 0 && ms == 0) ms = 1;
#ifdef DEBUG_CONDITION
cerr << "CONDITION DEBUG: " << (void *)GetCurrentThreadId() << ": Timed waiting on " << &m_condition << " \"" << m_name << "\"" << endl;
#endif
@ -310,9 +310,9 @@ Thread::start()
#endif
m_extant = true;
}
}
}
void
void
Thread::wait()
{
if (m_extant) {
@ -490,7 +490,7 @@ Condition::unlock()
pthread_mutex_unlock(&m_mutex);
}
void
void
Condition::wait(int us)
{
if (us == 0) {
@ -514,7 +514,7 @@ Condition::wait(int us)
struct timespec timeout;
timeout.tv_sec = now.tv_sec;
timeout.tv_nsec = now.tv_usec * 1000;
#ifdef DEBUG_CONDITION
cerr << "CONDITION DEBUG: " << (void *)pthread_self() << ": Timed waiting on " << &m_condition << " \"" << m_name << "\"" << endl;
#endif
@ -551,9 +551,9 @@ void
Thread::start()
{
abort();
}
}
void
void
Thread::wait()
{
abort();
@ -611,7 +611,7 @@ Condition::lock()
abort();
}
void
void
Condition::wait(int us)
{
abort();

View File

@ -7,7 +7,7 @@
Centre for Digital Music, Queen Mary, University of London.
This file copyright 2006 Dan Stowell.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
@ -109,7 +109,7 @@ AmplitudeFollower::initialise(size_t channels, size_t stepSize, size_t blockSize
m_stepSize = std::min(stepSize, blockSize);
// Translate the coefficients
// Translate the coefficients
// from their "convenient" 60dB convergence-time values
// to real coefficients
m_clampcoef = m_clampcoef==0.0 ? 0.0 : exp(log(0.1)/(m_clampcoef * m_inputSampleRate));
@ -158,9 +158,9 @@ AmplitudeFollower::getParameterDescriptors() const
att.maxValue = 1.f;
att.defaultValue = 0.01f;
att.isQuantized = false;
list.push_back(att);
ParameterDescriptor dec;
dec.identifier = "release";
dec.name = "Release time";
@ -170,9 +170,9 @@ AmplitudeFollower::getParameterDescriptors() const
dec.maxValue = 1.f;
dec.defaultValue = 0.01f;
dec.isQuantized = false;
list.push_back(dec);
return list;
}

View File

@ -5,7 +5,7 @@
Centre for Digital Music, Queen Mary, University of London.
This file copyright 2006 Chris Cannam.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
@ -136,7 +136,7 @@ Onset::initialise(size_t channels, size_t stepSize, size_t blockSize)
m_peakpick = new_aubio_peakpicker(m_threshold);
m_onsetdet = new_aubio_onsetdetection(m_onsettype, blockSize, channels);
m_delay = Vamp::RealTime::frame2RealTime(4 * stepSize,
lrintf(m_inputSampleRate));
@ -157,7 +157,7 @@ Onset::reset()
m_blockSize,
m_stepSize,
lrintf(m_inputSampleRate));
aubio_onset_set_threshold(m_onsetdet, m_threshold);
aubio_onset_set_silence(m_onsetdet, m_silence);
aubio_onset_set_minioi(m_onsetdet, m_minioi);
@ -185,7 +185,7 @@ Onset::ParameterList
Onset::getParameterDescriptors() const
{
ParameterList list;
ParameterDescriptor desc;
desc.identifier = "onsettype";
desc.name = "Onset Detection Function Type";

View File

@ -49,7 +49,7 @@ public:
vector<double> dfOutput;
Vamp::RealTime origin;
};
OnsetDetector::OnsetDetector(float inputSampleRate) :
Vamp::Plugin(inputSampleRate),
@ -162,7 +162,7 @@ OnsetDetector::getParameter(std::string name) const
} else if (name == "sensitivity") {
return m_sensitivity;
} else if (name == "whiten") {
return m_whiten ? 1.0 : 0.0;
return m_whiten ? 1.0 : 0.0;
}
return 0.0;
}
@ -265,7 +265,7 @@ OnsetDetector::initialise(size_t channels, size_t stepSize, size_t blockSize)
dfConfig.adaptiveWhitening = m_whiten;
dfConfig.whiteningRelaxCoeff = -1;
dfConfig.whiteningFloor = -1;
m_d = new OnsetDetectorData(dfConfig);
return true;
}
@ -480,7 +480,7 @@ OnsetDetector::getRemainingFeatures()
}
for (unsigned int i = 0; i < ppParams.length; ++i) {
Feature feature;
// feature.hasTimestamp = false;
feature.hasTimestamp = true;

View File

@ -7,7 +7,7 @@
Centre for Digital Music, Queen Mary, University of London.
Copyright 2006 Chris Cannam.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without

View File

@ -7,7 +7,7 @@
Centre for Digital Music, Queen Mary, University of London.
Copyright 2006 Chris Cannam.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without

View File

@ -7,7 +7,7 @@
Centre for Digital Music, Queen Mary, University of London.
Copyright 2006 Chris Cannam.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
@ -165,7 +165,7 @@ ZeroCrossing::process(const float *const *inputBuffers,
}
if (crossing) {
++count;
++count;
Feature feature;
feature.hasTimestamp = true;
feature.timestamp = timestamp +

View File

@ -7,7 +7,7 @@
Centre for Digital Music, Queen Mary, University of London.
Copyright 2006 Chris Cannam.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without

View File

@ -1,12 +1,12 @@
/*
*
* program: sanityCheck
*
* program: sanityCheck
* file: main.c
* author: Todd Naugle
* date: 11/17/2010
*
*
* Desc: Command line version of the sanity check functions found in jack
*/
*/
#include <algorithm>
#include <stdio.h>
@ -262,7 +262,7 @@ ParseSwitches(
}
if (OK) {
// All switches are at least valid, now check to make sure they are all valid to
// All switches are at least valid, now check to make sure they are all valid to
// be used together.
if (gSwitchesReceived.size() > 1) {
@ -291,7 +291,7 @@ ParseSwitches(
}
else {
fprintf(stderr, "\n");
fprintf(stderr, "ERROR - Invalid Option: %s\n", (const char *) argv[--i]);
fprintf(stderr, "ERROR - Invalid Option: %s\n", (const char *) argv[--i]);
fprintf(stderr, "Check syntax\n");
PrintUsage();
return false;

View File

@ -14,7 +14,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Set of functions to gather system information for the jack setup wizard.
*
*
* TODO: Test for rt prio availability
*
* @author Florian Faber, faber@faberman.de
@ -43,7 +43,7 @@
#include "systemtest.h"
/**
* This function checks for the existence of known frequency scaling mechanisms
* This function checks for the existence of known frequency scaling mechanisms
* in this system by testing for the availability of scaling governors/
*
* @returns 0 if the system has no frequency scaling capabilities non-0 otherwise.
@ -73,13 +73,13 @@ static int read_string(char* filename, char* buf, size_t buflen) {
if (-1<fd) {
r = read (fd, buf, buflen-1);
(void) close(fd);
if (-1==r) {
fprintf(stderr, "Error while reading \"%s\": %s\n", filename, strerror(errno));
exit(EXIT_FAILURE);
}
}
return (int) r;
}
@ -96,7 +96,7 @@ static int read_int(char* filename, int* value) {
/**
* This function determines wether any CPU core uses a variable clock speed if frequency
* This function determines wether any CPU core uses a variable clock speed if frequency
* scaling is available. If the governor for all cores is either "powersave" or
* "performance", the CPU frequency can be assumed to be static. This is also the case
* if scaling_min_freq and scaling_max_freq are set to the same value.
@ -110,7 +110,7 @@ int system_uses_frequencyscaling() {
while (!done) {
(void) snprintf(filename, 256, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor", cpu);
if (0<read_string(filename, buf, 256)) {
if ((0!=strncmp("performance", buf, 11)) &&
if ((0!=strncmp("performance", buf, 11)) &&
(0!=strncmp("powersafe", buf, 9))) {
// So it's neither the "performance" nor the "powersafe" governor
(void) snprintf(filename, 256, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_min_freq", cpu);
@ -121,7 +121,7 @@ int system_uses_frequencyscaling() {
// wrong governor AND different frequency limits -> scaling
return 1;
}
}
}
}
}
} else {
@ -130,7 +130,7 @@ int system_uses_frequencyscaling() {
}
cpu++;
}
// couldn't find anything that points to scaling
return 0;
}
@ -172,18 +172,18 @@ int system_user_in_group(const char *name) {
free(list);
return 0;
}
num_groups = getgroups(MAX_GROUPS, list);
while (i<num_groups) {
if (list[i]==gid) {
found = 1;
i = num_groups;
}
i++;
}
free(list);
return found;
@ -254,7 +254,7 @@ int system_user_can_rtprio() {
perror("sched_get_priority");
exit(EXIT_FAILURE);
}
schparam.sched_priority = min_prio;
schparam.sched_priority = min_prio;
if (0 == sched_setscheduler(0, SCHED_FIFO, &schparam)) {
// TODO: restore previous state
@ -264,7 +264,7 @@ int system_user_can_rtprio() {
exit(EXIT_FAILURE);
}
return 1;
}
}
return 0;
}
@ -300,7 +300,7 @@ long long unsigned int system_available_physical_mem() {
if (strncmp (buf, "MemTotal:", 9) == 0) {
if (sscanf (buf, "%*s %llu", &res) != 1) {
perror ("parse error in /proc/meminfo");
}
}
}
} else {
perror("read from /proc/meminfo");