VU meter issue



  • Hi, im trying to add VU meter but I have some problem.
    I created strip with 128 images but when I changed size and filename in code I've got something like this

    I used this code

    /** 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": 71, // this uses the exact dimensions of one filmstrip
          "height": 559,
          "opaque": true // opaque is important in order to increase the drawing performance
        });
        
        // Put the image in your image folder
        widget.loadImage("{PROJECT_FOLDER}elo.bmp", "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.92 controls the decay time)
        		this.data.value = this.data.value * 0.92;
        	
        	// 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 * 84.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 * 65);	
        });
        
        widget.startTimer(30);
        return widget;
    };


  • On:
    Content.setPropertiesFromJSON(name,

    I think you have to replace name with the name of your item.
    "widget"
    I could be wrong though



  • Shouldn't be png file?



  • @ustk I just saw that too. All the images need to be .png files



  • @dustbro @ustk are you sure guys? Because I see "animation" but it's very glitchy



  • Yeah I saw that issue too. Latest Hise has a bug about image strip vu meter stuff.

    I resized my image strip to smaller size and it solved.



  • @orange ok, so I need tweak my GUI 🙂 Thx 🙂


Log in to reply
 

3
Online

468
Users

1.6k
Topics

11.8k
Posts