MCPcopy Create free account
hub / github.com/VCVRack/Rack / dataFromJson

Method dataFromJson

src/core/MIDI_Gate.cpp:203–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201 }
202
203 void dataFromJson(json_t* rootJ) override {
204 json_t* notesJ = json_object_get(rootJ, "notes");
205 if (notesJ) {
206 for (int i = 0; i < 16; i++) {
207 json_t* noteJ = json_array_get(notesJ, i);
208 if (noteJ)
209 setLearnedNote(i, json_integer_value(noteJ));
210 }
211 }
212
213 json_t* velocityJ = json_object_get(rootJ, "velocity");
214 // Boolean in Rack <=v2.6.4
215 if (json_is_true(velocityJ))
216 velocityMode = VELOCITY_MODE;
217 else if (json_is_integer(velocityJ))
218 velocityMode = VelocityMode(json_integer_value(velocityJ));
219
220 json_t* mpeModeJ = json_object_get(rootJ, "mpeMode");
221 if (mpeModeJ)
222 mpeMode = json_boolean_value(mpeModeJ);
223
224 json_t* trigModeJ = json_object_get(rootJ, "trigMode");
225 if (trigModeJ)
226 trigMode = json_boolean_value(trigModeJ);
227
228 json_t* midiJ = json_object_get(rootJ, "midi");
229 if (midiJ)
230 midiInput.fromJson(midiJ);
231 }
232};
233
234

Callers

nothing calls this directly

Calls 2

VelocityModeEnum · 0.85
fromJsonMethod · 0.45

Tested by

no test coverage detected