00001
00002
00003
00004
00005
00006
00007 #ifndef __CAUGuiDemoAU_h__
00008 #define __CAUGuiDemoAU_h__
00009
00010 #ifndef PI
00011 #define PI (3.1415926535897932384626433832795)
00012 #endif
00013
00014 #define kProperty_MIDILearn 100000
00015
00016 #include <AudioUnit/AudioUnitCarbonView.h>
00017 #include "AUMIDIEffectBase.h"
00018
00019 #include "CAUGuiDemoCsts.h"
00020 #include "CAUGuiConfig.h"
00021
00022
00023
00024 enum
00025 {
00026 kParam_Knob_1 = 0,
00027 kParam_Knob_2,
00028 kParam_Buttons_1,
00029 kParam_Buttons_2,
00030 kParam_Slider_1,
00031 kParam_Slider_2,
00032 kParam_Slider_3,
00033 kParam_Display_1,
00034
00035
00036
00037 kNumParameters,
00038
00039
00040 kNumAUParameters = kNumParameters,
00041
00042 kNumPresets = 10
00043
00044 };
00045
00046 typedef struct EZ_preset
00047 {
00048 char name[ 32 ];
00049 float values[ kNumParameters ];
00050
00051
00052
00053
00054
00055
00056 } EZ_preset;
00057
00058 class CAUGuiDemoAU : public AUMIDIEffectBase
00059 {
00060
00061 public:
00062
00063 CAUGuiDemoAU(AudioUnit);
00064
00065 ~CAUGuiDemoAU();
00066
00067 ComponentResult Initialize(void);
00068
00069 ComponentResult Reset (AudioUnitScope, AudioUnitElement);
00070
00071 ComponentResult GetParameterList (AudioUnitScope, AudioUnitParameterID*, UInt32&);
00072
00073 UInt32 SupportedNumChannels (const AUChannelInfo**);
00074
00075 ComponentResult GetParameterInfo( AudioUnitScope inScope,
00076 AudioUnitParameterID inParameterID,
00077 AudioUnitParameterInfo &outParameterInfo );
00078
00079 ComponentResult SaveState( CFPropertyListRef * outData);
00080
00081 ComponentResult RestoreState( CFPropertyListRef inData);
00082
00083 ComponentResult GetParameterValueStrings( AudioUnitScope inScope,
00084 AudioUnitParameterID inID,
00085 CFArrayRef* tArrayRef);
00086
00087
00088 ComponentResult GetPresets ( CFArrayRef * outData) const;
00089
00090 OSStatus NewFactoryPresetSet (const AUPreset & inNewFactoryPreset);
00091
00092
00093 ComponentResult GetPropertyInfo( AudioUnitPropertyID inID, AudioUnitScope inScope,
00094 AudioUnitElement inElement, UInt32 & outDataSize,
00095 Boolean & outWritable);
00096
00097 ComponentResult GetProperty( AudioUnitPropertyID inID,
00098 AudioUnitScope inScope,
00099 AudioUnitElement inElement,
00100 void * outData);
00101
00102 ComponentResult SetProperty( AudioUnitPropertyID inID,
00103 AudioUnitScope inScope,
00104 AudioUnitElement inElement,
00105 const void *inData,
00106 UInt32 inDataSize);
00107 void HandleControlChange( int inChannel,
00108 UInt8 inController,
00109 UInt8 inValue,
00110 long inStartFrame);
00111
00112
00113 int GetNumCustomUIComponents ();
00114 void GetUIComponentDescs (ComponentDescription* inDescArray);
00115
00116
00117 ComponentResult GetParameter (AudioUnitParameterID, AudioUnitScope, AudioUnitElement, Float32&);
00118
00119 ComponentResult SetParameter (AudioUnitParameterID, AudioUnitScope, AudioUnitElement, Float32, UInt32);
00120
00121 OSStatus ProcessBufferLists (AudioUnitRenderActionFlags&, const AudioBufferList&, AudioBufferList&, UInt32);
00122
00123 ComponentResult Version()
00124 {
00125 return DEMO_VERSION;
00126 }
00127
00128
00129 private:
00130
00131
00132 void clearBuffers();
00133
00134
00135
00136
00137 const AudioUnitParameterInfo* m_asParInfo;
00138 const AUChannelInfo* m_asChannelInfo;
00139 float* m_arPar;
00140
00141
00142
00143
00144
00145 float internalParameters[ kNumInternalParameters ];
00146
00147
00148
00149 EZ_preset editPreset;
00150
00151
00152
00153 EZ_preset Presets[ kNumPresets ];
00154
00155
00156
00157 AUPreset AU_Presets[ kNumPresets ];
00158
00159
00160
00161 int currentPreset;
00162
00163
00164 short mMIDICC[128];
00165 short mCurrentLearning;
00166 };
00167
00168 #endif // __CAUGuiDemoAU_h__
00169