HISE Logo Forum
    • Categories
    • Register
    • Login

    old filmstrip VU meter code no longer works...

    Scheduled Pinned Locked Moved Bug Reports
    1 Posts 1 Posters 604 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mwplugs
      last edited by

      @Christoph-Hart had helped me get a working filmstrip VU meter quite a while ago. and while this code works fine within HISE it does not function on compiled plugins. the default paint routine based VU meters do function once compiled but not these here is the code. i have a feeling that it has to do what it is calling from. as the newer VU meters all call from engine normalized peak etc and this draws from get master peak..im not sure why it isnt functioning

      /** Creates a VU-Meter from a filmstrip for the master volume. /
      /
      * 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": 130, // this uses the exact dimensions of one filmstrip
        "height": 65,
        "opaque": true // opaque is important in order to increase the drawing performance
      });
      
      // Put the image in your image folder
      widget.loadImage("{PROJECT_FOLDER}vu_meter_128_frames.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.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;
      

      };

      const var VuMeterLeft = createFilmStripVuMeter("VuMeterLeft", 80, 49, false);

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      52

      Online

      1.7k

      Users

      11.7k

      Topics

      101.8k

      Posts