41 #include "AUBaseHelper.h"
43 #if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
44 #include <AudioUnit/AudioUnitProperties.h>
46 #include <AudioUnitProperties.h>
49 OSStatus GetFileRefPath (CFDictionaryRef parent, CFStringRef frKey, CFStringRef * fPath)
51 static CFStringRef kFRString = CFSTR (kAUPresetExternalFileRefs);
53 const void* frVal = CFDictionaryGetValue(parent, kFRString);
54 if (!frVal)
return kAudioUnitErr_InvalidPropertyValue;
56 const void* frString = CFDictionaryGetValue ((CFDictionaryRef)frVal, frKey);
57 if (!frString)
return kAudioUnitErr_InvalidPropertyValue;
60 *fPath = (CFStringRef)frString;
67 UInt32 FindInvalidSamples(Float32 *inSource, UInt32 inFramesToProcess,
bool &outHasNonZero,
bool zapInvalidSamples)
69 float *sourceP = inSource;
71 UInt32 badSamplesDetected = 0;
72 bool hasNonZero =
false;
73 for (UInt32 i=0; i < inFramesToProcess; i++)
75 float input = *(sourceP++);
80 float absx = fabs(input);
89 if (zapInvalidSamples)
95 return badSamplesDetected;
99 CFMutableDictionaryRef CreateFileRefDict (CFStringRef fKey, CFStringRef fPath, CFMutableDictionaryRef fileRefDict)
102 fileRefDict = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
104 CFDictionarySetValue (fileRefDict, fKey, fPath);
112 void PrintAUParamEvent (AudioUnitParameterEvent& event, FILE* f)
114 bool isRamp =
event.eventType == kParameterEvent_Ramped;
115 fprintf (f,
"\tParamID=%ld,Scope=%ld,Element=%ld\n", (
long)event.parameter, (
long)event.scope, (
long)event.element);
116 fprintf (f,
"\tEvent Type:%s,", (isRamp ?
"ramp" :
"immediate"));
118 fprintf (f,
"start=%ld,dur=%ld,startValue=%f,endValue=%f\n",
119 (
long)event.eventValues.ramp.startBufferOffset, (
long)event.eventValues.ramp.durationInFrames,
120 event.eventValues.ramp.startValue, event.eventValues.ramp.endValue);
122 fprintf (f,
"start=%ld,value=%f\n",
123 (
long)event.eventValues.immediate.bufferOffset,
124 event.eventValues.immediate.value);
125 fprintf (f,
"- - - - - - - - - - - - - - - -\n");