comparison examples/AmplitudeFollower.cpp @ 49:aa64a46320d4

* Rename "name" and "description" to "identifier" and "name"; add new "description" that actually contains a description
author cannam
date Mon, 26 Feb 2007 18:08:48 +0000
parents be8fdfe25693
children 933fee59d33a
comparison
equal deleted inserted replaced
48:f46bf5e0fa42 49:aa64a46320d4
64 AmplitudeFollower::~AmplitudeFollower() 64 AmplitudeFollower::~AmplitudeFollower()
65 { 65 {
66 } 66 }
67 67
68 string 68 string
69 AmplitudeFollower::getIdentifier() const
70 {
71 return "amplitudefollower";
72 }
73
74 string
69 AmplitudeFollower::getName() const 75 AmplitudeFollower::getName() const
70 { 76 {
71 return "amplitudefollower"; 77 return "Amplitude Follower";
72 } 78 }
73 79
74 string 80 string
75 AmplitudeFollower::getDescription() const 81 AmplitudeFollower::getDescription() const
76 { 82 {
77 return "Amplitude Follower"; 83 return "Track the amplitude of the audio signal";
78 } 84 }
79 85
80 string 86 string
81 AmplitudeFollower::getMaker() const 87 AmplitudeFollower::getMaker() const
82 { 88 {
122 AmplitudeFollower::getOutputDescriptors() const 128 AmplitudeFollower::getOutputDescriptors() const
123 { 129 {
124 OutputList list; 130 OutputList list;
125 131
126 OutputDescriptor sca; 132 OutputDescriptor sca;
127 sca.name = "amplitude"; 133 sca.identifier = "amplitude";
134 sca.name = "Amplitude";
135 sca.description = "";
128 sca.unit = "V"; 136 sca.unit = "V";
129 sca.description = "Amplitude";
130 sca.hasFixedBinCount = true; 137 sca.hasFixedBinCount = true;
131 sca.binCount = 1; 138 sca.binCount = 1;
132 sca.hasKnownExtents = false; 139 sca.hasKnownExtents = false;
133 sca.isQuantized = false; 140 sca.isQuantized = false;
134 sca.sampleType = OutputDescriptor::OneSamplePerStep; 141 sca.sampleType = OutputDescriptor::OneSamplePerStep;
141 AmplitudeFollower::getParameterDescriptors() const 148 AmplitudeFollower::getParameterDescriptors() const
142 { 149 {
143 ParameterList list; 150 ParameterList list;
144 151
145 ParameterDescriptor att; 152 ParameterDescriptor att;
146 att.name = "attack"; 153 att.identifier = "attack";
147 att.description = "Attack time"; 154 att.name = "Attack time";
155 att.description = "";
148 att.unit = "s"; 156 att.unit = "s";
149 att.minValue = 0.0f; 157 att.minValue = 0.0f;
150 att.maxValue = 1.f; 158 att.maxValue = 1.f;
151 att.defaultValue = 0.01f; 159 att.defaultValue = 0.01f;
152 att.isQuantized = false; 160 att.isQuantized = false;
153 161
154 list.push_back(att); 162 list.push_back(att);
155 163
156 ParameterDescriptor dec; 164 ParameterDescriptor dec;
157 dec.name = "release"; 165 dec.identifier = "release";
158 dec.description = "Release time"; 166 dec.name = "Release time";
167 dec.description = "";
159 dec.unit = "s"; 168 dec.unit = "s";
160 dec.minValue = 0.0f; 169 dec.minValue = 0.0f;
161 dec.maxValue = 1.f; 170 dec.maxValue = 1.f;
162 dec.defaultValue = 0.01f; 171 dec.defaultValue = 0.01f;
163 dec.isQuantized = false; 172 dec.isQuantized = false;
165 list.push_back(dec); 174 list.push_back(dec);
166 175
167 return list; 176 return list;
168 } 177 }
169 178
170 void AmplitudeFollower::setParameter(std::string paramname, float newval) 179 void AmplitudeFollower::setParameter(std::string paramid, float newval)
171 { 180 {
172 if (paramname == "attack") { 181 if (paramid == "attack") {
173 m_clampcoef = newval; 182 m_clampcoef = newval;
174 } else if (paramname == "release") { 183 } else if (paramid == "release") {
175 m_relaxcoef = newval; 184 m_relaxcoef = newval;
176 } 185 }
177 } 186 }
178 187
179 float AmplitudeFollower::getParameter(std::string paramname) const 188 float AmplitudeFollower::getParameter(std::string paramid) const
180 { 189 {
181 if (paramname == "attack") { 190 if (paramid == "attack") {
182 return m_clampcoef; 191 return m_clampcoef;
183 } else if (paramname == "release") { 192 } else if (paramid == "release") {
184 return m_relaxcoef; 193 return m_relaxcoef;
185 } 194 }
186 195
187 return 0.0f; 196 return 0.0f;
188 } 197 }