void CHIP_update(SoundPlugin *plugin){ Chip *chip = find_chip_for_plugin(&g_mixer_widget->scene, plugin); int eff1 = plugin->type->num_effects+EFFNUM_INPUT_VOLUME; int eff2 = plugin->type->num_effects+EFFNUM_VOLUME; int val1 = scale(PLUGIN_get_effect_value(plugin, eff1, VALUE_FROM_STORAGE), 0,1,0,10000); int val2 = scale(PLUGIN_get_effect_value(plugin, eff2, VALUE_FROM_STORAGE), 0,1,0,10000); SLIDERPAINTER_setValue(chip->_input_slider, val1); SLIDERPAINTER_setValue(chip->_output_slider, val2); #if 0 { char buf[64]={0}; PLUGIN_get_display_value_string(plugin, eff1, buf, 64); SLIDERPAINTER_set_string(chip->_input_slider, QString(buf)); } { char buf[64]={0}; PLUGIN_get_display_value_string(plugin, eff2, buf, 64); SLIDERPAINTER_set_string(chip->_output_slider, QString(buf)); } #endif chip->update(); }
static void faust_gui_zone_callback(float val, void* arg){ MyUI::Controller *controller = (MyUI::Controller*)arg; float min = controller->min_value; float max = controller->max_value; SoundPlugin *plugin = controller->plugin; int effect_num = controller->effect_num; Data *data = GET_DATA_FROM_PLUGIN(plugin); if (fabs(val - data->automation_values[effect_num]) < fabs((max-min)/100.0)) // approx. return; //printf(" Callback called %f. controller: %p\n val/auto: %f %f", val, controller, val, data->automation_values[effect_num]); float stored_value; stored_value = PLUGIN_get_effect_value(plugin, effect_num, VALUE_FROM_STORAGE); if (val==stored_value) return; // We are now pretty certain that this update was caused by a user interaction in the faust gui, and not a roundtrip from radium. PLAYER_lock();{ PLUGIN_set_native_effect_value(plugin, -1, effect_num, val, PLUGIN_STORED_TYPE, PLUGIN_STORE_VALUE, FX_single); }PLAYER_unlock(); volatile struct Patch *patch = plugin->patch; ATOMIC_SET(patch->widget_needs_to_be_updated, true); }