master vu meter
-
hello, I am looking for a way to make a saw meter of the master with 2 buttons, right and left. there is a version on the forum but I can't modify it as I want.
this one>/** Creates a VU-Meter from a filmstrip for the master volume. */
inline function createFilmStripVuMeter(name, x, y, isLeft)
{
local widget = Content.addPanel(name, x, y);Content.setPropertiesFromJSON(name, { "width": 50, // this uses the exact dimensions of one filmstrip "height": 60, "opaque": false // opaque is important in order to increase the drawing performance }); // Put the image in your image folder widget.loadImage("{PROJECT_FOLDER}LED_Output_Meter_V1_128_Frames_127_x_167_pixels.png", "filmstrip"); widget.data.value = 0.0; widget.data.isLeft = isLeft; // Set the initial image widget.setImage("filmstrip", 0, 0); widget.setTimerCallback(function() { // Get the peak value from the master output var newValue = Engine.getMasterPeakLevel(this.data.isLeft ? 0 : 1); if(newValue > this.data.value) this.data.value = newValue; else // Just decay the current value (0.99 controls the decay time) this.data.value = this.data.value * 0.96; // Calculate the filmstrip index // this must be an integer value // 84 is used instead of 128 because 84 is ~0dB which is // more accurate for this example filmstrip var index = parseInt(this.data.value * 150.0); // If you just want to paint one image, // you don't need the paint routine, but // just use this method // the yOffset is index * heightOfFilmstrip this.setImage("filmstrip", 0, index * 167); }); widget.startTimer(30); return widget;
};
const var VuMeterLeft = createFilmStripVuMeter("VuMeterLeft", 60, 150, false);
const var VuMeterRight = createFilmStripVuMeter("VuMeterRight", 60, 110, true);this one is complicated to move, to modify
thank u ;)