common: win32utils - compile fix
[supercollider.git] / platform / mac / SuperColliderAU / Source / ControlSpecs.cpp
blob7ce7cec6df88b5d7015cbe343dc47f07c51b39b2
1 /*
2 SuperColliderAU Copyright (c) 2006 Gerard Roma.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #include "ControlSpecs.h"
22 ControlSpecs::ControlSpecs(CFDictionaryRef dict){
23 if (CFDictionaryContainsKey(dict, kParamsSpecKey)){
24 params = (CFArrayRef) CFDictionaryGetValue(dict, kParamsSpecKey);
25 numberOfParameters = CFArrayGetCount(params);
26 synthName = (CFStringRef)CFDictionaryGetValue(dict, kSynthDefSpecKey);
31 float ControlSpecs::getValue(UInt32 specNum, CFStringRef valueKey)
33 float value = 0;
34 CFDictionaryRef thisParam = (CFDictionaryRef) CFArrayGetValueAtIndex(params, specNum);
35 CFNumberRef cfValue = (CFNumberRef)CFDictionaryGetValue(thisParam, valueKey);
36 if(cfValue) CFNumberGetValue(cfValue,kCFNumberFloat32Type,(void *)&value);
37 return value;
42 void ControlSpecs::setValue(UInt32 specNum, CFStringRef valueKey, float value)
44 CFDictionaryRef thisParam = (CFDictionaryRef) CFArrayGetValueAtIndex(params, specNum);
45 CFDictionarySetValue((CFMutableDictionaryRef)thisParam, (void*)valueKey,(void *)&value);
49 CFStringRef ControlSpecs::getName(UInt32 specNum, CFStringRef nameKey)
51 CFDictionaryRef thisParam = (CFDictionaryRef) CFArrayGetValueAtIndex(params, specNum);
52 return (CFStringRef)CFDictionaryGetValue(thisParam, nameKey);
56 long ControlSpecs::getDisplayFlag(UInt32 specNum)
58 int value = 0;
59 CFDictionaryRef thisParam = (CFDictionaryRef) CFArrayGetValueAtIndex(params, specNum);
60 CFNumberRef cfValue = (CFNumberRef)CFDictionaryGetValue(thisParam, kDisplaySpecKey);
61 if (cfValue)CFNumberGetValue(cfValue,kCFNumberIntType,(void *)&value);
62 switch(value){
63 case 0: return 0;
64 case 1: return kAudioUnitParameterFlag_DisplaySquareRoot;
65 case 2: return kAudioUnitParameterFlag_DisplaySquared;
66 case 3: return kAudioUnitParameterFlag_DisplayCubed;
67 case 4: return kAudioUnitParameterFlag_DisplayCubeRoot;
68 case 5: return kAudioUnitParameterFlag_DisplayExponential;
69 case 6: return kAudioUnitParameterFlag_DisplayLogarithmic;
71 return value;