HISE Logo Forum
    • Categories
    • Register
    • Login
    1. HISE
    2. hujackus
    3. Posts
    • Profile
    • Following 0
    • Followers 1
    • Topics 3
    • Posts 36
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: Compiling Just an Empty Clone Container Fails

      @clevername27 said in Compiling Just an Empty Clone Container Fails:

      When you say struct, do you mean class?

      Yeah clone_base is a struct. It has a few methods, but no member named ‘isPolyphonic’. I'm assuming there is a wrapper class somewhere trying to cast a clone_base into a class that has a isPolyphonic() function.

      Setting the default return value of NodeBase::isPolyphonic() from false to true is an interesting lead. Looking for subclasses of NodeBase now to see how it relates to the clone_base struct.

      posted in Bug Reports
      hujackusH
      hujackus
    • RE: Compiling Just an Empty Clone Container Fails

      @d-healey said in Compiling Just an Empty Clone Container Fails:

      /HISE/hi_dsp_library/node_api/nodes/Containers.h:116:49: error: ‘const struct scriptnode::wrap::clone_base<scriptnode::wrap::clone_data<scriptnode::container::chain<scriptnode::parameter::empty, scriptnode::wrap::fix<2, scriptnode::core::empty> >, 0, 1>, scriptnode::CloneProcessType::Copy>’ has no member named ‘isPolyphonic’
      >   116 |     bool isPolyphonic() const { return get<0>().isPolyphonic(); }
      

      I'm trying to parse this error. Basically, some code tried calling isPolyphonic() on a clone_base struct when isPolyphonic() is not defined for that struct. This is probably a runtime error only seen when compiling clone containers. The location of that code seems to be in the Containers.h file within the container_base struct.

      The container_base struct has a protected member std::tuple<Processors...> called elements. This is relevant because the error is referring to get<0>().isPolyphonic() and get<0>() is defined further up in the Containers.h file
      as (i'm not sure which one)

      template <int arg> constexpr auto& get() noexcept { return std::get<arg>(elements).getObject(); }
      template <int arg> constexpr const auto& get() const noexcept { return std::get<arg>(elements).getObject(); }
      

      so get<0>().isPolyphonic() is kind of equivalent to std::get<0>(elements).getObject().isPolyphonic() which breaks down in English to get the first object in the elements tuple and ask if it's polyphonic. The error leads me to believe that there is a clone_base struct in that elements tuple of Processors and clone_base doesn't have function isPolyphonic().

      clone_base is a struct defined in duplicate.h and does not seem to have a polyphonic anything related, so I'm guessing there shouldn't be a clone_base struct in that elements tuple. So I'm thinking where does it get in there? So I'm looking for where clone_base is referenced and I stumble on this alias definition in processors.h

      template <typename T, int NumDuplicates>
      using fix_clonecopy = clone_base<clone_data<T, options::no, NumDuplicates>, CloneProcessType::Copy>;
      

      which means I can cut down the size of the error message to this

      /HISE/hi_dsp_library/node_api/nodes/Containers.h:116:49: error: ‘const struct fix_clonecopy’ has no member named ‘isPolyphonic’
      >   116 |     bool isPolyphonic() const { return get<0>().isPolyphonic(); }
      

      I don't know how all this helps anyone. Does anyone else have a different error message related to this problem that I could look at to look for clues?

      posted in Bug Reports
      hujackusH
      hujackus
    • RE: Circular XY pad

      @hujackus

      An Assortment of Square and Circular XY Pads!

      Ok here it is. I put five XY pads and some fun knobs into one snippet for you all to enjoy. I hope you find the code interesting. It should be possible to cut out the parts you need and put them in your projects. I decided not to use broadcasters to keep things simple, but I did have some difficulty linking the X and Y knobs to processors in the module tree because of this. Let me know what you all think.
      Fun with Circular XY Pads2.png

      // An Assortment of Square and Circular XY Pads
      // By Jack Huppert
      //
      // Helpfull Reading
      // Analytical Methods for Squaring the Disc by Chamberlain Fong
      // 	https://arxiv.org/pdf/1509.06344
      // Elliptification of Rectangular Imagery By Chamberlain Fong
      // 	https://arxiv.org/pdf/1709.07875
      // Square/Disc mappings by Marc B. Reynolds
      // 	https://marc-b-reynolds.github.io/math/2017/01/08/SquareDisc.html 
      
      Content.makeFrontInterface(810, 250);
      
      // init X and Y knobs
      const knbX = Content.getComponent("knbX");
      const knbY = Content.getComponent("knbY");
      knbX.setControlCallback(onknbXYControl);
      knbY.setControlCallback(onknbXYControl);
      
      // button to enable updating all XY pads when one XY pad is changed
      const btnLink = Content.getComponent("btnLink");
      
      reg curRadius = 8;
      const XY_MARGIN = 5;
      const XY_INSET = 5;
      
      
      // init XY pads	
      const var pnlXY = [];
      for(i=0; i<5; i++){
      	pnlXY[i] = Content.getComponent("pnlXY"+i);
      	pnlXY[i].setControlCallback(onpnlXYControl);
      	pnlXY[i].setMouseCallback(pnlXYMouseCallback);
      	pnlXY[i].setPaintRoutine(paintpnlXY);
      	pnlXY[i].data.shape = i;
      	pnlXY[i].data.u = 0;
      	pnlXY[i].data.v = 0;
      	pnlXY[i].data.x = 0;
      	pnlXY[i].data.y = 0;
      }
      
      //just for fun knob to change the cursor size
      inline function onknbCursorSizeControl(component, value)
      {
      	curRadius = value;
      	for(i=0; i<5; i++){
      		pnlXY[i].repaint();
      	}
      };
      Content.getComponent("knbCursorSize").setControlCallback(onknbCursorSizeControl);
      
      //just for fun knob to change the aspect ratio
      inline function onknbAspectRatioControl(component, value)
      {
      	local h = Math.range(150*value,50,150);
      	local w = Math.range(150*(1/value),50,150);
      	for(i=0; i<5; i++){
      		pnlXY[i].set("height",h);
      		pnlXY[i].set("width",w);
      		pnlXY[i].repaint();
      	}
      };
      Content.getComponent("knbAspectRatio").setControlCallback(onknbAspectRatioControl);
      
      
      
      // Update knobs and repaint the panel on control
      inline function onpnlXYControl(component, value)
      {
      	local x = component.data.x;
      	local y = component.data.y;
      	knbX.setValue(x);
      	knbY.setValue(y);
      };
      
      
      
      // Mouse handling
      inline function pnlXYMouseCallback(event)
      {
      	if (!event.drag && !event.clicked){
      		return;
      	}
      
      	// get the mouse position in the right coordnate system	
      	local b = this.getLocalBounds(0);
      	local m = XY_MARGIN+XY_INSET+curRadius;
      	this.data.u = (event.x-m)/(b[2]-2*m);
      	this.data.v = (b[3]-event.y-m)/(b[3]-2*m);
      	
      	// clamp u and v to the bounds
      	if(this.data.shape<=0||this.data.shape>4){//bounds = square
      		this.data.u = Math.range(this.data.u,0,1);
      		this.data.v = Math.range(this.data.v,0,1);
      		// square needs no further calculations so just return
      		this.data.x = this.data.u;
      		this.data.y = this.data.v;
      		if(btnLink.getValue()){ //
      			squareToCircle(this.data.x,this.data.y);
      		}else{
      			this.changed();
      		}
      		return;
      	}// else bounds = circle
      	
      	local uN = this.data.u-.5; //uN is -.5 to .5 if within the circle
      	local vN = this.data.v-.5; //vN is -.5 to .5 if within the circle
      	local dist = Math.sqrt(uN*uN + vN*vN); 
      	if(dist>.5){ 
      		this.data.u = uN *.5 / dist + .5;
      		this.data.v = vN *.5 / dist + .5;
      		dist=.5;	
      	}//dist is now 0 to .5
      	
      	// now convert (u,v) --> (x,y) depending on the transformation
      	if(this.data.shape==1){ // radial stretching (2017 Marc B. Reynolds)
      		//[x,y] = sqrt(u^2 +v^2)/max(|u|,|v|) * [u,v]
      		//we can cheat and use uN, vN, and dist again from above.
      		this.data.x = (uN * dist/Math.max(Math.abs(uN),Math.abs(vN)+.00000001))+.5;
      		this.data.y = (vN * dist/Math.max(Math.abs(uN),Math.abs(vN)+.00000001))+.5;
      		
      	}else if(this.data.shape==2){ // elliptic grid (2005 Philip Nowell)
      		//x = .5*(sqrt(|2+u^2-v^2+sqrt(8)u|)-sqrt(|2+u^2-v^2-sqrt(8)u|))
      		//y = .5*(sqrt(|2-u^2+v^2+sqrt(8)v|)-sqrt(|2-u^2+v^2-sqrt(8)v|))
      		uN = this.data.u*2-1; //uN is now -1 to 1
      		vN = this.data.v*2-1; //vN is now -1 to 1
      		
      		local SQRT8 = Math.sqrt(8);
      		local temp1 = Math.abs(2 + (uN+SQRT8)*uN - vN*vN);
      		local temp2 = Math.abs(2 + (uN-SQRT8)*uN - vN*vN);
      		this.data.x = .25*(Math.sqrt(temp1) - Math.sqrt(temp2))+.5;
      		temp1 = Math.abs(2 - uN*uN + (vN+SQRT8)*vN);
      		temp2 = Math.abs(2 - uN*uN + (vN-SQRT8)*vN);
      		this.data.y = .25*(Math.sqrt(temp1) - Math.sqrt(temp2))+.5;
      		
      	}else if(this.data.shape==3){ //FG-Squircle (2014 Chamberlain Fong)
      		//x = sgn(uv)/(v*sqrt(2)*sqrt(u^2+v^2-sqrt((u^2+v^2)(u^2+v^2-4u^2v^2)))
      		//y = sgn(uv)/(u*sqrt(2)*sqrt(u^2+v^2-sqrt((u^2+v^2)(u^2+v^2-4u^2v^2)))
      		uN = this.data.u*2-1; //uN is now -1 to 1
      		vN = this.data.v*2-1; //vN is now -1 to 1
      		
      		local temp1 = uN*uN + vN*vN;
      		local temp2 = Math.sqrt(temp1*(temp1 - 4*uN*uN*vN*vN));
      		temp2 = Math.sign(uN*vN) * Math.sqrt(temp1 - temp2)/Math.sqrt(2);
      		this.data.x = vN==0 ? this.data.u : .5*temp2/vN + .5;
      		this.data.y = uN==0 ? this.data.v : .5*temp2/uN + .5;
      		
      	}else if(this.data.shape==4){ //Concentric (1997 Peter Shirley and Kenneth Chiu)
      		//x = u^2>v^2 ? sgn(u)sqrt(u^2+v^2) : 4/PI*sqrt(u^2+v^2)atan(u/|v|)
      		//y = u^2>v^2 ? 4/PI*sqrt(u^2+v^2)atan(v/|u|) : sgn(v)sqrt(u^2+v^2)
      		uN = this.data.u*2-1; //uN is now -1 to 1
      		vN = this.data.v*2-1; //vN is now -1 to 1
      		
      		local temp = Math.sqrt(uN*uN + vN*vN);
      		if(uN*uN>vN*vN){
      			this.data.x = .5*temp*Math.sign(uN) + .5;
      			this.data.y = 2/Math.PI*temp*Math.atan(vN/(Math.abs(uN)+.00000001)) + .5;
      		}else{
      			this.data.x = 2/Math.PI*temp*Math.atan(uN/(Math.abs(vN)+.00000001)) + .5;
      			this.data.y = .5*temp*Math.sign(vN) + .5;
      		}
      	}
      	
      	if(btnLink.getValue()){
      		squareToCircle(this.data.x,this.data.y);
      	}else{
      		this.changed();
      	}	
      	return;
      }		
      
      // on paint function for all XY pads
      inline function paintpnlXY(g)
      {	
      	g.fillAll(this.get("bgColour"));
      	
      	// Calculate and store the cursor's XY position 
      	local b = this.getLocalBounds(XY_MARGIN);
      	local u = this.data.u * (b[2]-2*(curRadius+XY_INSET)) + XY_MARGIN + XY_INSET;
      	local v = (1-this.data.v) * (b[3]-2*(curRadius+XY_INSET)) + XY_MARGIN + XY_INSET;
      
      	// draw the xy area outline
      	g.setColour(this.get("itemColour"));
      	local bs = this.get("borderSize");
      	if(this.data.shape==0){
      		g.drawRect(b, bs);
      	}else{
      		b = this.getLocalBounds(XY_MARGIN+bs/2);
      		g.drawEllipse(b, bs);
      	}
      	
      	// draw the XY pad cursor
      	g.setColour(this.get("itemColour2"));
      	g.fillEllipse([u,v,curRadius*2,curRadius*2]);
      }
      
      // update all the XY pads when the knobs are changed
      inline function onknbXYControl(component, value)
      {
      	local x = knbX.getValue();
      	local y = knbY.getValue();
      
      	squareToCircle(x,y);
      }
      
      // helper function to convert (x,y) --> (u,v) for all XY Panels
      inline function squareToCircle(x,y){
      	//square
      	pnlXY[0].data.u = x;
      	pnlXY[0].data.v = y;
      	
      	//radial stretching inverse  (2017 Marc B. Reynolds)
      	local xN = (x*2-1); //xN is -1 to 1
      	local yN = (y*2-1); //yN is -1 to 1
      	local temp = Math.max(Math.abs(xN),Math.abs(yN));
      	local dist = Math.sqrt(xN*xN + yN*yN +.00000001); //dist is (0,sqrt(2)]
      	pnlXY[1].data.u = .5*xN*temp/dist +.5;
      	pnlXY[1].data.v = .5*yN*temp/dist +.5;
      	
      	//elliptic grid inverse  (2005 Philip Nowell)
      	//u = x*sqrt(1-.5*y^2)
      	//v = y*sqrt(1-.5*x^2)
      	//use xN and yN from above
      	pnlXY[2].data.u = .5*(xN * Math.sqrt(1-yN*yN*.5))+.5;
      	pnlXY[2].data.v = .5*(yN * Math.sqrt(1-xN*xN*.5))+.5;
      	
      	//FG-Squircle (2014 Chamberlain Fong)
      	//u = x*sqrt(x^2+y^2-x^2*y^2)/sqrt(x^2+y^2)
      	//v = y*sqrt(x^2+y^2-x^2*y^2)/sqrt(x^2+y^2)
      	//use xN, yN, and dist from above
      	temp = Math.sqrt(xN*xN + yN*yN - xN*xN*yN*yN)/dist;
      	pnlXY[3].data.u = .5*xN*temp + .5;
      	pnlXY[3].data.v = .5*yN*temp + .5;
      	
      	//Concentric (1997 Peter Shirley and Kenneth Chiu)
      	//u = |x|>=|y| ? x*cos(PI/4*y/x) : y*sin(PI/4*x/y)
      	//v = |x|>=|y| ? x*sin(PI/4*y/x) : y*cos(PI/4*x/y)
      	//use xN and yN from above
      	temp = Math.PI/4;
      	if(Math.abs(xN)>=Math.abs(yN)){
      		pnlXY[4].data.u = .5*xN*Math.cos(temp*yN/xN) + .5;
      		pnlXY[4].data.v = .5*xN*Math.sin(temp*yN/xN) + .5;
      	}else{
      		pnlXY[4].data.u = .5*yN*Math.sin(temp*xN/yN) + .5;
      		pnlXY[4].data.v = .5*yN*Math.cos(temp*xN/yN) + .5;
      	}
      	
      	//set x and y as well
      	for(i=0; i<5; i++){
      		pnlXY[i].data.x = x;
      		pnlXY[i].data.y = y;
      		pnlXY[i].changed();
      	}
      }
      
      HiseSnippet 3686.3oc2ZszbabbDdgjfKQ32U4bMdBqTN6h2.DTjxzTlRTR1LVDFVT1EYoh10hcG.rQK1EdeQrQjw9fSk+F4d9Cji9OPNlS4RtjS4R9G3z8L6iYwtfuRbpJ1UhM2Y5tmt+5tmo6Ay.GaMpqqsiToJOKbFUpzqU9fPKuI6NQ0vRZuGhCrqgiluopygGI8fvYpttTcoRkt4GgTTZkaIw9m+0G9.USUKMZ5PRRegsgF8IFSM7RGcvNehgo4iU0oOyXp.081YOMaqcsMs8As4lkaKMSU6Epio8UQxtQYoOV0chTopk06zqynM0Tuylc50USq6laz8tanQUGMhdmNquQuMG0ajpV6tRkdkGoa3Y6bfmpG0Upzsdfsd3ASrOwhu.eggqwPSJ9QGoCfUlO7isM0QSDGUZ2IFl5ChgIWIPJCRAsaxAs2o79F5FIimBduEaBRJGh.XoajU8tYF0qin50VP8JPkJInR2hqRuc4CzbLl4kNCpOuZ48r7nN.7PynJbZktwe5cK2pE49Vj6ir3MkZ4QrGQN3q8UcnDUKcRbv.4viHCT0cq.z+fPxuF7UjO1e1LpiGLDN5GSMmMx2zj7Tpptg03JLIqZF5YnoZR1m5MwV2kLx1gKefDh2DJ4gFtZjggD.EmNj5XBXI4w1b9WYhm2L22uUKUm4FAMscF2Zl9nVcVu8ca19Nq0qGRziLM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znBmK5jNSpSgSiOCBmyiQYKeLgV77QjPoR2J66Gn7xe+.hOuAM9ORh.g1V6YY38oynVK6QOHE8KqHAqRjVAj5wdoAuQzKM3Are4VICcoRqTNpvZIlJK9JQjVF6GXZ.0VwX+UJim5mg2uc9e3eb448nL798+ke1e6Rw6aUN6OBz0S6eyxY9c7VTHjcj978dHD5guaiHXEfZ7gSXfdwROjFXnQ4uhiUJ+Pp6K7rmAhM4WzRpzqxW7WO9Mdf0nvV6aWlEF2VZN3nJUAVtvzU9WtC6mQKYfue3N7eyMwQfxdrOI9m9wEsFnUCR5.oEQhOMndcuau6dmM5d20ElnaxLs6rd6tRoUMmpK2dm3dVfwdke3G9g2gM7UvF6f1Xj31gtyOYsytB14ez6mt14Zh14u6mt1YOA6bv28+u1Y4r14STGlXmr+VL+TpmncpuiGctGRH+cNckDqX5v2NpHw9ZkOHoKpqjnEi.2wuHQWobzaKS6JIXQW9NeSQB9MKmTGO9F0tRRecwDmuqXDIsD3hD84dB9x7hFQB+MJydnUQOGvyS74Ogetn3Rk82ONIB4PxmXYO7pH0iVlWTPpGkWp29xWUvRxeSj+qWVj5o7WI6696+me1e9m+W+PnwZwrroF55lzAQWD2BkZjnbqboK1HU3+8uIqtsrUhriqGcFO6ub4NMaGqwwJRFMtWZHU5hJk+4m9Vk22VGu+wruFV7MCGMApDhOAU7AMZAJWn3Z+esmH6kUEe6xCLfsNJVGuQA5HTE2OF5XzCK90K+nQifPoTE7Vke7g+37Jhk3u3uwPSXNFX8i88md.b.fFEVcK7VvvZJuAdJ.+6132HBb.0Rm8AbNwODMYG76RQS1IdRoopZN1eUz6jBe5x2lMBnSVrm48Jk2G+lzYwxlkfvRciuRSKqnxwX2qKiqccYr20kw0utLdmqKiabcYbyKlQ7gteeeOa9C+.HX+AOh0lSoROh8RdYQqR+aPONMfL
      
      posted in Scripting
      hujackusH
      hujackus
    • RE: Circular XY pad

      @mmprod said in Circular XY pad:

      Just tested it, and it works perfectly! Thanks so much. I really appreciate the extra resources too—I still need to wrap my head around the math.

      I've spent the day coding a more polished version of the XY pad for each of the different transformations. I downloaded the destruqtor plugin and determined that it uses the an elliptic transformation, so I'm excited to see how that looks.
      elliptical.png

      posted in Scripting
      hujackusH
      hujackus
    • RE: Circular XY pad

      @hujackus said in Circular XY pad:

      It's the only transformation that I could think of that I knew how to code.

      Is there any interest in trying a different transformation? There are others out there that have different pros and cons.
      Some equations on stack overflow
      Schwarz-Christoffel transformation
      squircular.blogspot.com<- I think this is the transformation I wrote from scratch. Not sure.
      Square/Disc mappings Includes an interactive demo!

      posted in Scripting
      hujackusH
      hujackus
    • RE: Circular XY pad

      @mmprod said in Circular XY pad:

      Conceptually, how is the distance and angle used to calculate the x and y knob values?

      It's the only transformation that I could think of that I knew how to code. Here's a picture comparing a square XY pad to the circular one I made.
      Circular XY Pad.png

      Basically, I calculate the angle the XY cursor pad makes with the center of the circle relative to the x-axis. Then I calculate the distance between that point from the center. The tricky part is that I multiply this distance by a scaling factor so that every point on the boundary of the circle corresponds to a point on the boundary on the square. Doing it this way allows a one-to-one mapping from XY pad to the knobs and vise versa. The angle relative to the center is also preserved with this transformation.

      posted in Scripting
      hujackusH
      hujackus
    • RE: Circular XY pad

      @mmprod I had some fun working on your Circular XY pad (for a few hours🤣). The solution to your problem is that you need to define a transformation from Knobspace (x,y) to Circlespace (angle, distance) and back. The pixel coordinates of the XY cursor can't be transformed into the knob values in a linear way so I used some trigonometry to make it work.

      HiseSnippet 2356.3oc4Y80TiibDWFv2sVIWt6pJOe0D+RjwFijMdWtkkk+SBUB6Qsr2dPQn1LHM1dJj03SRFrtb7X9NkGy2gT4o7ddNeC1z8LRVi.afPkKuDphBOS+ueS28zc6giBEtrnHQnQIy2kLjYT5mW93jf396zmxCLNXWiR+rx646yGFwN4TisSFRihXdFkJM+uAYnTkELj+7u1XapOMvkkukgw6EbW1umOfGmu6Qa963996S8XuiOPi6U17.WQvNBewH.LyW11XH08RZO1anHayU132Ri5aTZwxdNq3zcUW5yW0Yk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UvnAWvB0u3hLZTZghO8P4Y+zC5uLhq5qDpwnH3.3q08Mv2RXVuWhQ52izvnzbonBXMV9HE+hzGo3XeXVmPCtmQomUVVuv1PhX82Wx3wKsSAo+i+ku5uugw2dvtP3DerjT.AfbHKLlim+R6xth6xTOcRkx6xhtLVLDrzju4K3xdXLOdBd2bzlI4f+caZ7ehhbloh7JnnJJE8YYO0CNbVpdT4iZ5w305540adM2Kte9FAa1mw60OVeGnAg35r1DfS5yKukuOIei7dsfTehgwG+HJmVGX41ez3ip286NOQ0WT9PgGNGUwWLCeWwTBPtbgmoBeJp.XtpD87h+q8LZOVH9kkOhG61e5XbtofQL0+m.Ll93ieVY0LB4.bgx6exOQuz3bZ1+SU1+YkUylHMckzENEr+aAypGx9Nsju+5W8m+GarOi4gIUo6sY61+sM1k4SKFnm+QeJbtemnZ19dPejPNbEo7aFM3XHg0kA9v.3RDVQrzbXsK0ZabMBhiYAdxEeD9IknCttTJQmLhFORGUqY4njUs9+AG0+Krw.pan3CouGHlG+L4Nv4NP9eWnR4Cw0Dma21wvX.2i+AW2hp5NB15oJX6mpfq7TErySUvm+TE7EOUAW8gED++qr0nXw.UkXCiCOZOYi9Rk1KfBY4x6UF+a+In0rA
      
      Content.makeFrontInterface(500, 300);
      
      // knbXy
      const knbXy = [];
      for (i = 0; i < 2; i++)
      {
      	knbXy[i] = Content.getComponent("knbXy" + i);
      	knbXy[i].setControlCallback(onknbXyControl);
      }
      
      const var XY_RADIUS = 120;
      
      // Create XY pad, and cursor
      const var xyPath = Content.createPath();
      const var xyArea = [5,5,230,230];
      xyPath.addEllipse(xyArea); // xy area path
      
      const var cursor = Content.createPath();
      cursor.addEllipse([115,115,20,20]);// Cursor path
      const var cursorArea = cursor.getBounds(1.0);
      
      const var pnlXY2 = Content.getComponent("pnlXY2");
      pnlXY2.setControlCallback(onpnlXY2Control);
      
      // init the angle and dist to something;
      pnlXY2.data.angle = 0.5;	
      pnlXY2.data.dist = 100;
      
      
      // Repaint the panel on control
      inline function onpnlXY2Control(component, value)
      {
      	local x = component.data.x; // x is 0 to 100
      	local y = component.data.y; // y is 0 to 100
      	
      	mods[0].setAttribute(0, x/100); 
      	mods[1].setAttribute(0, y/100);
      
      	knbXy[0].setValue(x/100);  //not sure if you want 0 to 1 or 0 to 100
      	knbXy[1].setValue(y/100);  //depends on the knob mode
      
      	component.repaint();
      };
      
      // Mouse handling
      pnlXY2.setMouseCallback(function(event)
      {
      	if (event.drag || event.clicked)
      	{
      		var rawX = event.x-XY_RADIUS;
      		var rawY = XY_RADIUS-event.y; // flip y sign to make y axis point up
      		
      		var dist = Math.min(100,Math.sqrt(rawX*rawX + rawY*rawY));
      		var angle = 0; // angle is counter clockwise from x axis.
      		if(rawX!=0){
      			angle = Math.atan(rawY/rawX) + (rawX<0? 3.14159265:0);
      		}else{
      			angle = rawY>0 ? 3.14159265/2 : -3.14159265/2;
      		}
      		
      		this.data.angle = angle; //this is a value between 3PI/2 and -PI/2	
      		this.data.dist = dist; //this is a value between 0-100
      		
      		//Console.print(rawX+","+rawY + "->a=" + angle);
      		
      		var dist2 = Math.abs(Math.cos(angle));
      		var dist3 = Math.abs(Math.sin(angle));
      		dist2 = dist2==0 ? 1000: dist/dist2; //avoid divide by zero
      		dist3 = dist3==0 ? 1000: dist/dist3; //avoid divide by zero
      		dist2 = Math.min(dist2,dist3); // this is the normalized distance
      		
      		// data.x and data.y are normalized as if it were a square xy panel
      		this.data.x = Math.cos(angle)*dist2*.5 + 50; // 0 <= x <=100
      		this.data.y = Math.sin(angle)*dist2*.5 + 50; // 0 <= y <=100
      		//Console.print( "x="+this.data.x +"y="+this.data.y );	
      		
      		this.changed();	
      	}
      });
      
      pnlXY2.setPaintRoutine(function(g)
      {	
      	// Calculate and store the cursor's XY position 
      	var x = this.data.x - cursorArea[2]/2;
      	var y = this.data.y - cursorArea[3]/2;
      	var a = this.data.angle;
      	var r = this.data.dist;
      	
      	// draw the xy area outline
      	g.setColour(this.get("itemColour"));
      	g.drawEllipse(xyArea, 3);
      
      	// set the location of the pad using rotation
      	g.rotate(-a, [XY_RADIUS,XY_RADIUS]);
      	
      	// draw the XY pad cursor
      	g.setColour(this.get("itemColour2"));
      
      	g.fillPath(cursor,[XY_RADIUS + r - cursorArea[2]/2,
      		XY_RADIUS-cursorArea[3]/2,cursorArea[2],cursorArea[3]]);
      });
      
      
      // MIDI Controllers
      const mods = [
      	Synth.getEffect("Chorus1"),
      	Synth.getEffect("Chorus2")
      ];
      
      // before understanding this, please try looking at pnlXY2.setMouseCallback()
      inline function onknbXyControl(component, value)
      {
      	local x = knbXy[0].getValue();
      	local y = knbXy[1].getValue();
      
      	pnlXY2.data.x = x*100;
      	pnlXY2.data.y = y*100;
      	
      	x = x*200-100; // x range is -100 to 100
      	y = y*200-100; // y range is -100 to 100
      	
      	local angle = 0; // angle is counter clockwise from x axis.
      	if(x!=0){
      		angle = Math.atan(y/x) + (x<0? 3.14159265:0);
      	}else{
      		angle = y>0 ? 3.14159265/2 : -3.14159265/2;
      	}
      	pnlXY2.data.angle = angle; //this is a value between 3PI/2 and -PI/2	
      
      	local dist2 = Math.sqrt(x*x + y*y);// this is the normalized distance
      	local distA = Math.abs(Math.sin(angle))*dist2;
      	local distB = Math.abs(Math.cos(angle))*dist2;
      	pnlXY2.data.dist = Math.max(distA,distB); //the actual distance from center (0 to 100)
      	
      	//Console.print("dist=" + pnlXY2.data.dist + ",\t" +distA +",\t"+distB);
      	
      	pnlXY2.changed();	
      }
      
      

      Feel free to ask for more details about how it works. I know the comments are not completely understandable.

      posted in Scripting
      hujackusH
      hujackus
    • RE: Issue with simply playing a file, and question about introspection

      @thrice801 said in Issue with simply playing a file, and question about introspection:

      it's saying player.loadFile function not found.

      Why is player local? Is this code within a callback or a helper function? My first thought was that it wasn't finding the AudioSampleProcessor at runtime, but that usually throws a different error like "Audio Loop Player1 was not found."

      But I think the main issue is that loadFile() is not a function of AudioSampleProcessor, it is a function of AudioFile. You might want to try AudioSampleProcessor.setFile()

      posted in Scripting
      hujackusH
      hujackus
    • RE: How to use Modulator.exists?

      @d-healey said in How to use Modulator.exists?:

      Did you try it? I get an error.

      That's very interesting. I spent so much time in the C++ i failed to consider if it even compiles in HISE. I assumed it did, but it doesn't in the onInit() callback. It will compile if you call exists() in any of the other callbacks, but will throw an error at runtime.

      Perhaps exists() is not supposed to be visible in the API and was accidentally added into the documentation?

      posted in Scripting
      hujackusH
      hujackus
    • RE: How to use Modulator.exists?

      @d-healey said in How to use Modulator.exists?:

      What I want is to know how to use Modulator.exists().

      So far I've been looking into this file: hi_scripting/scripting/api/ScriptingApiObjects.h

      • AudioSampleProcessor (class ScriptingAudioSampleProcessor)
      • ChildSynth (class ScriptingSynth)
      • Effect (class ScriptingEffect)
      • MidiProcessor (class ScriptingMidiProcessor)
      • Modulator (class ScriptingModulator)
      • TableProcessor (class ScriptingTableProcessor)
      • SlotFX (class ScriptingSlotFX)

      All the above script objects have the exists() function because they inherit it from class ConstScriptingObject (in ScriptingBaseObjects.h) In addition to shared functions, each of these classes have an internal reference ( WeakReference<Processor>) to the actual processor. Because this reference can be null or be deleted at anytime, the script object constantly has to verify that the reference is still there by calling checkValidObject() every time a method is called. (This function never returns false*, it only returns true or throws an error.)

      bool ConstScriptingObject::checkValidObject() const
      {
      	if (!objectExists())
      	{
      		reportScriptError(getObjectName().toString() + " " + getInstanceName() + " does not exist.");
      		RETURN_IF_NO_THROW(false)
      	}
      
      	if (objectDeleted())
      	{
      		reportScriptError(getObjectName().toString() + " " + getInstanceName() + " was deleted");
      		RETURN_IF_NO_THROW(false)
      	}
      
      	return true;
      }
      

      Basically exists() is defined to do exactly the same thing as checkValidObject(). It is literally defined that way.

      /** Checks if the Object exists and prints a error message on the console if not. */
      bool exists() { return checkValidObject(); };
      

      This leads me to believe that Modulator.exists() should only be used in a fail-fast check before calling Modulator API functions. However, all of the standard functions already call checkValidObject() making it basically useless to call exits() at all. Nonetheless, an example of how to use the function is...

      const modulator = Synth.getModulator("myDodgyModulator");
      // I suspect modulator's state is out of sync because reasons
      if(modulator.exists()){
          //call a few functions on modulator that might not already call checkValidObject
      }
      
      posted in Scripting
      hujackusH
      hujackus
    • RE: How to use Modulator.exists?

      @d-healey Good, I was thinking you had a reference somehow and calling exists() wasn't working properly.

      So what we are looking for is a simple way to traverse the Synth tree, grab all the modulators and check to see if one of those is the one you have a script for?

      posted in Scripting
      hujackusH
      hujackus
    • RE: How to use Modulator.exists?

      @d-healey So you have a reference to something (lets say modulator1) and when you call modulator1.exists(); it throws an error?

      Does modulator1.getGlobalModulatorId(); throw an error in the same way? That could be a workaround.

      Does checking modulator1==undefined ahead of time make sense in your situation? How do you get the reference to modulator1 in the first place?

      posted in Scripting
      hujackusH
      hujackus
    • RE: Help with this noob error please.

      @Chazrox said in Help with this noob error please.:

      Im not sure how to apply this.

      That's ok. I just made a code example that would have helped me a month ago when I started learning "HISEscript". By uncommenting each line, you can see the differences in behavior for each combination of keywords used.

      posted in Newbie League
      hujackusH
      hujackus
    • Engine.intToHexString() does not appear int the API List

      System Details:Win 11 / HISE Version 4.1.0 / Standalone / 64bit

      STR (Steps to reproduce):

      • Open HISE and type "Engine" into the API search field.
      • Take note that "intToHexString" is not between "getZoomLevel" and "isControllerUsedByAutomation".
      • Type the following code into onInit() and compile.
      Console.print(Engine.intToHexString(0xff123456));
      

      Result:

      • ff123456 is printed out to the console.
      • No compile errors.

      ER (Expected result):

      • Engine.intToHexString() should appear in the API list.
      • The pull request went through Aug 2022 so there might be something missing from that, or missing documentation.
      • see Added Engine.intToHexString #312
      posted in Bug Reports
      hujackusH
      hujackus
    • RE: Help with this noob error please.

      @mmprod said in Help with this noob error please.:

      how do they increase performance? Is there a big difference in cpu usage?

      There is a difference when you have a lot of variables. If you use the var keyword for all your variables, when your program references a variable at runtime the program has to search for the location in memory that variable refers to using a dictionary/hash lookup table.

      If you use const or reg, these variables are optimized at compile time to work more like indexing an array, which is much quicker. If I'm wrong, I would like to know a better explanation.

      posted in Newbie League
      hujackusH
      hujackus
    • RE: Help with this noob error please.

      @Chazrox @d-healey There are a surprising amount of cases to consider when choosing variables and functions. I made a test to show some of the problems that occur when the wrong keywords are used or used at the wrong time.

      Console.clear();
      //testGlobal = undefined; //uncomment to explore what happens
      //testGlobal2 = undefined; //uncomment out to explore what happens
      
      //test(); //doesn't compile (This expression is not a function!)
      testInline();
      
      const TEST_ARRAY = [5];
      const TEST_CONST = 6;
      global testGlobal = 7;
      reg testReg = 8;
      var testVar = 9;
      
      function test(){
      	var t = "";
      	t += TEST_ARRAY[0];
      	t += TEST_ARRAY_2[0];
      	t += TEST_CONST;
      	t += TEST_CONST_2;
      	t += testGlobal;
      	t += testGlobal2;
      	t += testReg;
      	t += testReg2;
      	t += testVar;
      	t += testVar2;
      	Console.print("test():"+t);
      	
      	Console.print(TEST_ARRAY[0]);
      //	Console.print(TEST_ARRAY_2[0]);//doesn't compile (API call with undefined parameter 0)
      	Console.print(TEST_CONST);
      //	Console.print(TEST_CONST_2);//only compiles if TEST_CONST_2 was defined in a prev compile
      	Console.print(testGlobal);
      //	Console.print(testGlobal2); //only compiles if testGlobal2 was defined in a prev compile
       	Console.print(testReg);
      //	Console.print(testReg2);    //doesn't compile (API call with undefined parameter 0)
      	Console.print(testVar);
      //	Console.print(testVar2);    //doesn't compile (API call with undefined parameter 0)
      };
      inline function testInline(){
      	local t = "";
      	t += TEST_ARRAY[0];
      	t += TEST_ARRAY_2[0];
      	t += TEST_CONST;
      	t += TEST_CONST_2;
      	t += testGlobal;
      	t += testGlobal2;
      	t += testReg;
      	t += testReg2;
      	t += testVar;
      	t += testVar2;
      	Console.print("testInline():"+t);
      
      //	Console.print(TEST_ARRAY[0]);  //doesn't compile (API call with undefined parameter 0)
      //	Console.print(TEST_ARRAY_2[0]);//doesn't compile (API call with undefined parameter 0)
      	Console.print(TEST_CONST);
      	Console.print(TEST_CONST_2);
      //	Console.print(testGlobal); //only compiles if testGlobal was defined in a prev compile
      //	Console.print(testGlobal2);//only compiles if testGlobal2 was defined in a prev compile
      //	Console.print(testReg);    //doesn't compile (API call with undefined parameter 0)
      //	Console.print(testReg2);   //doesn't compile (API call with undefined parameter 0)
      //	Console.print(testVar);    //doesn't compile (API call with undefined parameter 0)
      //	Console.print(testVar2);   //doesn't compile (API call with undefined parameter 0)
      };
      
      test();
      testInline();
      
      const TEST_ARRAY_2 = [25];
      const TEST_CONST_2 = 26;
      global testGlobal2 = 27;
      reg testReg2 = 28;
      var testVar2 = 29;
      
      test();
      testInline();
      

      or in snippet form

      HiseSnippet 1126.3oc2W01ahbCD1KIaUg9h5I0OzO5luTnWUOfRBjFE0KgPthZSBJPiZUzIjiWSv5L1q10jbnS4+b+GzN1KaX2vB4DjnJ08KKddwyiGOOKyzIPQYggp.jSgdS7YHmO2s6DodXygDtD09HjyW5dBITyBvQhNbhOILj4gbb13MFAN42DYe96e4PhfHorYhPnKTbJ624i35YR675eiKDGS7X83iRXcsW2lpjMUB0X.Oa3VF4SnuibM6ThwrbtnekDND478tdUpUYPCJYmFUpUkRq1nd0cqSYjACX6TY650ZLn1.BsbUjymzxiqUAc0DMKD4r4gJuIcGptUFEfK3g7qDLyhJntPjiDerR3YNhFonlC4BuNwIpPDrKclk11HJs80tmv832KeV56qrJvy7HYBzIWZ3sQJ3UII7Jm.dY.ImDPZyHH8B2tz.tudlFCd9L21R31DROrTPIxVTtuofKtoRFpDrejJXjfhk1q.9UuBvm9MB0UDAde7XoGa.Wx71CzLVRUiFwjZrVgYu2WnBX3aGRz3gDeelLLs6UWr+pwKYOh2E.Ovu7TrP42owfq9bACWr2Pdnwy.3nxURLrRpzXBd.r+ZPx2Vp.13eao.hr8TU.bWFpw8Z0sW+CN+7C9K.aWt8a2KkhlmcZ2dfhc.wWGkARkLpCxCXWaEdN7debCPxMj.qjKf26i20FsXnfiNGen.Nu0Lvfs1BrHuF+x8SflKK+1Lj1u5bxsPLCQ8qduvYPNCQoMCNDObcZCfyzCWaMHttwOfK0E2J5T9ya8RsIYmeNCRcPipxVnE1Cco8x3h+fNswThPfukqGNqxB6SBfOaX9vU4RYGZaJZwwcZFzDTkTLINhgX9fToX7sjPbbT4RnjCJBuI174B8rrdlgNwkhsPetPmjI8HQNqPCWlKLtlKZHnvySUddZ0wBinoxYMi3cvdysb5z7qXdtgkITTCq8+w7r3SaLaaojIKUZMR4+WwSWJKcoboGiJ8XLokSSWOV5hnhqIuX4L7m1s0RwwOGa6Zh16rTgosM7Q7++8McmbY0LaAvpqZlcAX07f9.rxdPm.VY6tTLc+2vTxSUZ1YxhkJ7gB4Kb27pFLHScPdTGnDBVPlpM8bGrLGKJGO5JVvO..WLlcugPekoaV0cwMqlrWZHMpgl6RXnR1Vx0mAs0snNrQMibB90ez9HhlX5vcpLvNeVflaffyQraf4Kh52Mu6Qrv2oU9vDFy0LLzFtxarfnS2atYBloJfbPpFhMsIKC45IImv4Iqg8OVH9B2NbMcX1XLWFXDxTOGXb5XNegaKXFKpdF.2z83+74YlFz4v7.b40mPzA72C0amNdTWXzPJChtTxDlZPmblpkn0kMqMYftLomcw+.OSUVwr1YpxJwJQiHz.UeZTkuYPpO0JAvjzNzYdX5WXMtBxxFRlmGAy00mRSuUy4X0U0weZUcr1p531qpi6rpNVeUcrwi6nYr6CFqUihnMHzIcZY+ThiSKIAp.sUqn+Eg0SCJA
      
      posted in Newbie League
      hujackusH
      hujackus
    • RE: Help with this noob error please.

      @Chazrox said in Help with this noob error please.:

      Is there a hierarchy in placement of 'var's and const's in respect to functions? Can I declare those anywhere in the script as long as its not inside of a block of code (with the exception of locals's)?

      inline functions, const and vars can be declared before or after they are referenced. But regular functions need to be declared before they are referenced.

      Note that you should try to use const and reg instead of var whenever possible to increase performance.

      posted in Newbie League
      hujackusH
      hujackus
    • RE: Sounds like Vangelis?

      @Morphoice I might have to get a bigger monitor. Great job on this synth! I tried out Unstable just now, hooked it up to my VST and made some "music".
      Your browser does not support the audio element.
      Screenshot 2025-02-04 003423C.png

      I had one question, is Unstable sized geared for touch screens or visibility? I would be interested to know if anyone thinks the 16x16 grid on SimpleConway is too small for a touch screen use. Thanks :)

      posted in General Questions
      hujackusH
      hujackus
    • RE: Rounding error?

      @VirtualVirgin Another workaround could be this inline function.

      // a more accuate rounding function for -2.1474836485e9<=value<=2.1474836465e9
      inline function roundBetter(value){
      	local r = Math.round(value);
      	return (r+.5==value)?r+1:r;
      }
      
      const testArray = [0.,128.,-128., 32767., -32767. , 65535., -65535., 16777215., -16777215.,  2147483646., -2147483646.];
      for(v in testArray){
      	for(i=-11;i<11;i++){
      	Console.print("round("+(v+i+.5) + ")=" +Math.round(v+i+.5)+" ?=" + roundBetter(v+i+.5));
      	}
      }
      
      posted in Bug Reports
      hujackusH
      hujackus
    • RE: I Need Help with scripting... pls :)

      @Davide8075 said in I Need Help with scripting... pls :):

       const var FXContainerModern = Synth.getChild("Master Chain.FXContainer_Modern");
       const var FXContainerHipHop = Synth.getChild("Master Chain.FXContainer_HipHop");
       const var FXContainerVintage = Synth.getChild("Master Chain.FXContainer_Vintage");
      

      For starters, Synth.getChild should be Synth.getChildSynth.

      const var FXContainerModern = Synth.getChildSynth("Master Chain.FXContainer_Modern");
      const var FXContainerHipHop = Synth.getChildSynth("Master Chain.FXContainer_HipHop");
      const var FXContainerVintage = Synth.getChildSynth("Master Chain.FXContainer_Vintage");
      
      posted in Scripting
      hujackusH
      hujackus