MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / setValueGeneric

Method setValueGeneric

Source/Core/CtrlrModulator/CtrlrModulatorProcessor.cpp:165–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void CtrlrModulatorProcessor::setValueGeneric(const CtrlrModulatorValue inValue, const bool force, const bool mute)
166{
167 /* there are 3 sources of value changes
168
169 - gui
170 - midi
171 - host
172
173 - gui should affect the MIDI first and then send the value to host, when it comes back from host
174 and is the same as the value set before sending it to host, nothing should happen, if theyre
175 different it should be set to the MIDI and a async update should be triggered
176
177 - midi should affect the host first
178
179 - host update has to check what's different from the value received, if it is different an update
180 should be triggered (midi sent and/or async update done)
181
182
183 ** problem, when a value comes back from host it needs to be re-mapped to a midi value that lives
184 in the UI component, this will be the audio thread so asking the component will require locking
185 it might be better to keep a copy of value mapping (just the numeric part, we don't need the text, or do we?)
186 internaly in the processor so we can avoid locking at runtime
187 */
188 {
189 /* if the values are already the same, and the force flag is set to false
190 don't do anything the modulator is already in the state it should be */
191
192 const ScopedReadLock sl(processorLock);
193
194 if (currentValue.value == inValue.value && force == false)
195 {
196 return;
197 }
198 }
199
200 {
201 /* set the current value and the midi messages value,
202 send the MIDI out and notify the host about the parameter change */
203 const ScopedWriteLock sl(processorLock);
204
205 /* it's the same value, but it's forced, send out MIDI and triggerAsyncUpdate
206 don't inform the host, it already knows about it
207
208 if mute is true, no midi goes out */
209 if (currentValue.value == inValue.value && force == true)
210 {
211 if (!mute)
212 sendMidiMessage();
213
214 triggerAsyncUpdate();
215
216 return;
217 }
218
219 /* first we se the currentValue to the new value comming from the gui, it's needed for the
220 expressions evaluations to work */
221
222 currentValue = inValue;

Callers 15

setValueMethod · 0.80
setValueNonMappedMethod · 0.80
setModulatorValueMethod · 0.80
setComponentValueMethod · 0.80
setComponentValueMethod · 0.80
setComponentValueMethod · 0.80
setComponentValueMethod · 0.80
setComponentValueMethod · 0.80
setComponentValueMethod · 0.80
setComponentValueMethod · 0.80
setComponentValueMethod · 0.80
setComponentMidiValueMethod · 0.80

Calls 1

sendMidiMessageFunction · 0.85

Tested by

no test coverage detected