MCPcopy Create free account
hub / github.com/TheWaveWarden/odin2 / forceValueTreeOntoComponents

Method forceValueTreeOntoComponents

Source/gui/OscComponent.cpp:1325–1404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1323#endif
1324
1325void OscComponent::forceValueTreeOntoComponents(ValueTree p_tree, int p_index, bool p_create_wavetables) {
1326 std::string index = std::to_string(p_index);
1327
1328 // analog waveform
1329 switch ((int)m_value_tree.state.getChildWithName("osc")[m_analog_wave_identifier]) {
1330 case 0:
1331 m_LED_saw.setToggleState(true, sendNotification);
1332 break;
1333 case 1:
1334 m_LED_pulse.setToggleState(true, sendNotification);
1335 break;
1336 case 2:
1337 m_LED_triangle.setToggleState(true, sendNotification);
1338 break;
1339 case 3:
1340 m_LED_sine.setToggleState(true, sendNotification);
1341 break;
1342 default:
1343 break;
1344 }
1345
1346 // wavetable waveselctor
1347 m_wavetable_waveselector.setValue(m_value_tree.state.getChildWithName("osc")[m_wavetable_identifier]);
1348 m_modulation_source.setValue(m_value_tree.state.getChildWithName("osc")[m_modulation_source_identifier]);
1349
1350 // vector
1351 m_vec_a.setSelectedId(m_value_tree.state.getChildWithName("osc")[m_vec_a_identifier]);
1352 m_vec_b.setSelectedId(m_value_tree.state.getChildWithName("osc")[m_vec_b_identifier]);
1353 m_vec_c.setSelectedId(m_value_tree.state.getChildWithName("osc")[m_vec_c_identifier]);
1354 m_vec_d.setSelectedId(m_value_tree.state.getChildWithName("osc")[m_vec_d_identifier]);
1355
1356 m_xy.setX(GETAUDIO("osc" + m_osc_number + "_vec_x"));
1357 m_xy.setY(GETAUDIO("osc" + m_osc_number + "_vec_y"));
1358
1359 // fm
1360 m_carrier_waveselector.setValue(m_value_tree.state.getChildWithName("osc")[m_carrier_wave_identifier]);
1361 m_modulator_waveselector.setValue(m_value_tree.state.getChildWithName("osc")[m_modulator_wave_identifier]);
1362
1363 //m_carrier_ratio.setValue(GETAUDIO(m_carrier_ratio_identifier));
1364 //m_modulator_ratio.setValue(GETAUDIO(m_modulator_ratio_identifier));
1365
1366 m_carrier_ratio.setValue(m_value_tree.state.getChildWithName("osc")[m_carrier_ratio_identifier]);
1367 m_modulator_ratio.setValue(m_value_tree.state.getChildWithName("osc")[m_modulator_ratio_identifier]);
1368
1369 m_fm_exp.setValue(m_value_tree.getParameterAsValue("osc" + m_osc_number + "_exp_fm").getValue());
1370
1371 // chiptune
1372 m_chiptune_waveselector.setValue(m_value_tree.state.getChildWithName("osc")[String("osc" + m_osc_number + "_chipwave")]);
1373 auto node = m_value_tree.state;
1374
1375 node = m_value_tree.state.getChildWithName("draw");
1376
1377 // wavedraw
1378 float wavedraw_values[WAVEDRAW_STEPS_X];
1379 for (int i = 0; i < WAVEDRAW_STEPS_X; ++i) {
1380 wavedraw_values[i] = (float)node[String("osc" + m_osc_number + "_wavedraw_values_" + std::to_string(i))];
1381 }
1382

Callers

nothing calls this directly

Calls 4

setValueMethod · 0.45
setXMethod · 0.45
setYMethod · 0.45
setDrawnTableMethod · 0.45

Tested by

no test coverage detected