Vu Meter not working on limiter



  • can anyone tells me what I'm doing wrong ? is giving me this error

    "Interface:! Line 25, column 31: API call with undefined parameter 0"

    here is the code if you need to see for yourself

     HiseSnippet 2891.3oc6a0DababElTRTQR1xwwvM0AsvfQnMcMfir1UxJxvHPz5m0VwRVazJY2fhTYtjytKs4xglbnjVq5VCTTffdpWys.zC8bukbSn4ZNDfBTziFoM.8TguTfdy8Mb3OC4xUKWmXWYCuGDDGNuY9deyadu271Yq3f0PttXGAwQ2rsMRP73RUaaQZtXSUCKgUVRP7XRqZzxffbJ+yEVnsspqKRWPTbvqR6f3nCI3+4wyufpopkFJtIAgahMzP9RG2ZEkqaXZVVUGsoQKtdOixJZXqEwlXO.LCJMkfsp1cUaftgJsaCHIHN7x5FDrSUhJA4JHNzBX81Uah20h0+aZ3ZTyDQennPUXfXMWFapSQL8+EVrogodkPk1UPPTpRLELHiBNszZF5FQsGSEmz+ExwRvyGhCbXvqHO7lJS3ULK3IxAugXv6Mjpp4XXSheCaYZEKXQptJrDvCKVeEF3+NjzhXnGVjIaodWTYG3gHIJL2Lydd4KN0Tm6xiO13iYXoY5oiJLwM8VCAcYx63NA6MvRjKQdGUG4Urr8H9uU98kC6mlCBT9fmJLQbel37xybwoNu7z9yPb6S5hHElnIxnQSBzmhECPP3.BudMrtmIpPrLmW12BcxFHxx0qizHASzDmKMFW2izaPx0I.AuWLJ4dQ9gImPYfyfcRgHc7wtvEjkoajj2.o6oQLvVxxW3B75vRssTaYn4BJP2GtT5c7f89xgK5fXKhaYisfGJLQTOlHDIwRS.oV1pggEJfpnaTcVu1cnyIs6Dp9523hpll0fsoEp6Y4ObEN23is+3iMJcb1AFmPzSm9qPHNF07HnBQsFn.QngN5iREOFBffKgzLpgLcKicnbUYUMXaVgcB6bjzTXcSUSOD6cOfoZ.ZIpNL7VX5zV3a4hbp3f.IukgNLWtw159qN+hK7AUW+FxqpB.3ikqicjY81MImsk8BdDhOg24HxXQVartAyaf.f0To4tD7mRveHNdH5bys5CtO5y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erxFHKXq3G5AGwlm2sUVvvFCtry0Zxf4iHxP4GL2FNTUS9EHCc+6ZyKL38TRAq2xg77Q..+ZQ2SPiV1lnqFB1vxrdX6DVBQ+Zl3Z3VICy9QJYbKBEG76K65gdo0NwmXeQBv9K7u3.3SJUQ8nfAwFXOhgUi0Tgjin4wbCHOIHsbMD.UKKjI85MIN.8qoi87Tzmo.pJDQw+gm.eBdYQ5yhAurX3K4ojQBu+.gmYixEwOwSBrpMwWP8fRLyU83vBbvkmcPob3JuI6vxOC19+7l75lixnhu+JOkuxS4q7T9xgmxSvnjiAa1sP9WTae13G3+r7sT2AIeUjExgRVGxF+uNu+LJry8Oih00HvruoipkqM1Mw.WE0xXSrExkuwsbQzrM2ft5w29hXUmLe0imuLniYJSUUhmiuYvUZg8rHGlypbdtsjmrlq+8vK1QueaGO+plvf4Ct83mexngXjEOaYqcPlXnEVbfkXEmJpUdPFetYdCfMPvVyFMPN7POS8IQRBvmSqzQlD+DkUAiPUmjmjtunhh4mJNrkqyD70SIS2XJ+xQQfF7knh.cDKFxyi4nkplCdaM1ENlZKOheKfda4+UFLpzZzmkitZ4TtoE3NbaMMJY+t.6jsDk5aIltukXl9VhK12RLaeKw602RL2gHAM1yU7H3VrsdPCUV1+1cKJF9UUAV4B+OLGC37I
    


  • @jay Can't test your snippet, you're using an external file called VuMeter.js.



  • @d-healey I don't know how to send it as an attachment so here are it is as text:

    ============== VuMeter.js ====================

    namespace VuMeter
    {
    /** Creates a peak meter.
    *
    * Usage: Give it a reference to a module (either synth or effect).
    *
    * It looks best using a width and height with multiple of 4.
    * Customize the colours using the scriptPanel colour Ids
    */
    inline function createVuMeter(name, x, y)
    {
    local widget = Content.addPanel(name, x, y);

    	Content.setPropertiesFromJSON(name, {
    	"width": 32,
    	"height": 100,
    	"itemColour": 0xFF90FFB1,
    	"itemColour2": 4279505940,
    	"bgColour": 4279505940,
    	"textColour": 4283782485,
    	"saveInPreset": false,
    	"opaque": 1
    	});
    	
    	widget.setPaintRoutine(function(g)
    	{
    		g.fillAll(this.get("bgColour"));
    		
    		g.setColour(this.get("itemColour"));
    	
    		var lsize = parseInt(this.data.lvalue * (this.getHeight()-4));
    		var rsize = parseInt(this.data.rvalue * (this.getHeight()-4));
    	
    		g.fillRect([2, this.getHeight() - lsize - 2, (this.getWidth()-4)/2-1, lsize]);
    		g.fillRect([2 + this.getWidth() / 2 - 1, this.getHeight() - rsize - 2, (this.getWidth()-4)/2-1, rsize]);
    	
    		g.setColour(this.get("itemColour2"));
    	
    		for(i = 1; i < this.getHeight()-1; i = i + 3)
    		{
    			g.fillRect([1, i, this.getWidth()-2, 1]);
    		}
    	});
    
    	widget.setTimerCallback(function()
    	{
    		var lvalue;
    		var rvalue;
    		
    		if(this.data.fx)
    		{
    			lvalue = getNormalizedPeakValue(this.data.fx.getCurrentLevel(0));
    			rvalue = getNormalizedPeakValue(this.data.fx.getCurrentLevel(1));
    		}
    		else
    		{
    			lvalue = getNormalizedPeakValue(Engine.getMasterPeakLevel(0));
    			rvalue = getNormalizedPeakValue(Engine.getMasterPeakLevel(1));
    		}
    		
    		
    	
    		this.data.lvalue = Math.max(lvalue, this.data.lvalue - 0.04);
    		this.data.rvalue = Math.max(rvalue, this.data.rvalue - 0.04);
    	
    		this.repaintImmediately();
    	});
    
    	widget.startTimer(30);
    	return widget;
    };
    
    inline function setModule(vuMeter, module)
    {
    	vuMeter.data.fx = module;
    }
    
    inline function getNormalizedPeakValue(gain)
    {
    	return 0.01 * (100.0 + Engine.getDecibelsForGainFactor(gain));
    }
    

    }


 

0
Online

357
Users

1.1k
Topics

7.6k
Posts