HISE Logo Forum
    • Categories
    • Register
    • Login
    1. HISE
    2. civet
    C
    • Profile
    • Following 0
    • Followers 0
    • Topics 10
    • Posts 38
    • Groups 0

    civet

    @civet

    12
    Reputation
    5
    Profile views
    38
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    civet Unfollow Follow

    Best posts made by civet

    • RE: Funny slider?

      @IsoWalle My funny dirty code is here:

      Content.makeFrontInterface(400, 400);
      
      // distance squared
      inline function distance2(p0, p1)
      {
      	local dx = p1.x - p0.x;
      	local dy = p1.y - p0.y;
      	return dx * dx + dy * dy;
      }
      
      // angle between two points
      inline function angleBetween(p0, p1)
      {
      	local dx = p1.x - p0.x;
      	local dy = p1.y - p0.y;
      	// convert atan() to atan2()
      	local a = Math.atan(dy / dx);
      	if(dx > 0)
      	{
      		if(dy < 0) 
      			a += Math.PI;
      		else
      			a -= Math.PI;
      	}
      	return a;
      }
      
      const var points = [
      	{x: 200, y: 102},
      	{x: 100, y: 275},
      	{x: 300, y: 275}
      ];
      const var radius = 200;
      const var radius2 = radius * radius;
      
      reg dragger = {x: 200, y: 217};
      reg draggerRadius = 10;
      reg values = [0.0, 0.0, 0.0];
      reg valueIndex = 0;
      
      const var canvas = Content.addPanel("canvas", 0, 0);
      Content.setPropertiesFromJSON("canvas", {
      	"width": 400,
      	"height": 400,
      	"allowCallbacks": "Clicks, Hover & Dragging"
      });
      
      canvas.setPaintRoutine(function(g) 
      {	
      	// draw guides
      	g.setColour(0x40FFFFFF);
      	for(p in points)
      	{
      		g.drawEllipse([p.x - radius, p.y - radius, radius * 2, radius * 2], 1);
      		
      		g.fillEllipse([p.x - 2, p.y - 2, 4, 4]);
      	}
      	
      	// draw dragger
      	g.setColour(0xFFFFFFFF);
      	g.fillEllipse([dragger.x - draggerRadius, dragger.y - draggerRadius, draggerRadius * 2, draggerRadius * 2]);
      });
      
      canvas.setMouseCallback(function(event)
      {
      	if(event.drag)
      	{
      		dragger.x = event.x;
      		dragger.y = event.y;
      		
      		// limit the drag area
      		for(p in points)
      		{
      			if(distance2(dragger, p) >= radius2)
      			{
      				var a = angleBetween(dragger, p);
      				dragger.x = p.x + Math.cos(a) * radius;
      				dragger.y = p.y + Math.sin(a) * radius;	
      			}
      		}
      		
      		canvas.repaint();
      		
      		// calculate distance between points
      		valueIndex = 0;
      		for(p in points)
      		{
      			var d2 = distance2(dragger, p);
      			values[valueIndex] = Math.round((200.0 - Math.sqrt(d2)) / 2);
      			valueIndex++;
      		}
      		Console.print(values.join(", "));
      	}
      });
      
      posted in General Questions
      C
      civet
    • RE: Animate panel colors

      @dustbro @d-healey I found a simple function here to convert decimal to hex string, but it hasn't been fully tested yet.

      inline function toHex(num, digits) 
      {
      	local hexTable = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"];
      	local n = num;
      	local s = digits;
      	local result = "";
      	while (s--)
      	{
      		result = hexTable[n & 0xF] + result;
      		n = n >> 4;
      	}
      	return result;
      }
      
      Console.print(toHex(4278221567, 8)); 
      // output: FF007AFF
      

      By the way, using HSV or HSL makes it easier to control color variations, just change the value of Hue as you did in the colorpicker.
      You may need to use some functions that convert between RGB and HSV/HSL.

      posted in Scripting
      C
      civet
    • RE: Funny slider?

      @IsoWalle said in Funny slider?:

      @civet I tried messing around a little with your code and I noticed that it takes the value from where the mouse is and not from where the "dragger" is. So if you click and drag and continue outside the "triangle" the value keeps changing.

      Any way to make it stop?

      Sorry, I just wrote some dirty code to prove that it works.

      It takes more work to finish a custom component, such as redraw the appearance, encapsulation with namespace, configure parameters more flexibly, etc.

      And there are many other implementations.

      I just modified the code and added some comments on it, hope this helps.

      posted in General Questions
      C
      civet
    • RE: Export Samples for Installer - hanging at Compressing 100%

      @d-healey Many thanks for your support.
      I have tried another one.
      Now I can reproduce this issue with a .ch1 file (683MB). I can share it later.

      posted in General Questions
      C
      civet
    • Export Samples for Installer - hanging at Compressing 100%

      20220422.PNG

      It's a large .ch1 file about 1.5GB. No error message in the console.
      I have tried to delete same samples from samplemap to reduce the size of monolith file. ~400MB, 600MB is OK, about 800MB hanging again... has it reached the limit?

      posted in General Questions
      C
      civet
    • Engine.getMidiNoteFromName("G8");

      The missing note?

      Console.print(Engine.getMidiNoteFromName("G8")); // -1
      
      Console.print(Engine.getMidiNoteName(127)); // G8
      
      posted in Bug Reports
      C
      civet
    • RE: How to add table points to a UI table?

      @d-healey

      Content.makeFrontInterface(600, 600);
      
      reg tableData = Engine.createAndRegisterTableData(1);
      
      const var table = Content.getComponent("Table1");
      table.set("saveInPreset", false);
      table.referToData(tableData);
      
      tableData.reset(); 
      tableData.addTablePoint(0.5, 0.5);
      
      posted in Scripting
      C
      civet

    Latest posts made by civet

    • RE: ViewPort scrolling

      Is it possible to initialize the scroll position of the viewport or save its position in preset?

      posted in General Questions
      C
      civet
    • Engine.getMidiNoteFromName("G8");

      The missing note?

      Console.print(Engine.getMidiNoteFromName("G8")); // -1
      
      Console.print(Engine.getMidiNoteName(127)); // G8
      
      posted in Bug Reports
      C
      civet
    • RE: Funny slider?

      @IsoWalle said in Funny slider?:

      @civet I tried messing around a little with your code and I noticed that it takes the value from where the mouse is and not from where the "dragger" is. So if you click and drag and continue outside the "triangle" the value keeps changing.

      Any way to make it stop?

      Sorry, I just wrote some dirty code to prove that it works.

      It takes more work to finish a custom component, such as redraw the appearance, encapsulation with namespace, configure parameters more flexibly, etc.

      And there are many other implementations.

      I just modified the code and added some comments on it, hope this helps.

      posted in General Questions
      C
      civet
    • RE: Funny slider?


      origin

      Maybe it’s a kind of XYPad 🤔 um..delta?

      posted in General Questions
      C
      civet
    • RE: Funny slider?

      @IsoWalle My funny dirty code is here:

      Content.makeFrontInterface(400, 400);
      
      // distance squared
      inline function distance2(p0, p1)
      {
      	local dx = p1.x - p0.x;
      	local dy = p1.y - p0.y;
      	return dx * dx + dy * dy;
      }
      
      // angle between two points
      inline function angleBetween(p0, p1)
      {
      	local dx = p1.x - p0.x;
      	local dy = p1.y - p0.y;
      	// convert atan() to atan2()
      	local a = Math.atan(dy / dx);
      	if(dx > 0)
      	{
      		if(dy < 0) 
      			a += Math.PI;
      		else
      			a -= Math.PI;
      	}
      	return a;
      }
      
      const var points = [
      	{x: 200, y: 102},
      	{x: 100, y: 275},
      	{x: 300, y: 275}
      ];
      const var radius = 200;
      const var radius2 = radius * radius;
      
      reg dragger = {x: 200, y: 217};
      reg draggerRadius = 10;
      reg values = [0.0, 0.0, 0.0];
      reg valueIndex = 0;
      
      const var canvas = Content.addPanel("canvas", 0, 0);
      Content.setPropertiesFromJSON("canvas", {
      	"width": 400,
      	"height": 400,
      	"allowCallbacks": "Clicks, Hover & Dragging"
      });
      
      canvas.setPaintRoutine(function(g) 
      {	
      	// draw guides
      	g.setColour(0x40FFFFFF);
      	for(p in points)
      	{
      		g.drawEllipse([p.x - radius, p.y - radius, radius * 2, radius * 2], 1);
      		
      		g.fillEllipse([p.x - 2, p.y - 2, 4, 4]);
      	}
      	
      	// draw dragger
      	g.setColour(0xFFFFFFFF);
      	g.fillEllipse([dragger.x - draggerRadius, dragger.y - draggerRadius, draggerRadius * 2, draggerRadius * 2]);
      });
      
      canvas.setMouseCallback(function(event)
      {
      	if(event.drag)
      	{
      		dragger.x = event.x;
      		dragger.y = event.y;
      		
      		// limit the drag area
      		for(p in points)
      		{
      			if(distance2(dragger, p) >= radius2)
      			{
      				var a = angleBetween(dragger, p);
      				dragger.x = p.x + Math.cos(a) * radius;
      				dragger.y = p.y + Math.sin(a) * radius;	
      			}
      		}
      		
      		canvas.repaint();
      		
      		// calculate distance between points
      		valueIndex = 0;
      		for(p in points)
      		{
      			var d2 = distance2(dragger, p);
      			values[valueIndex] = Math.round((200.0 - Math.sqrt(d2)) / 2);
      			valueIndex++;
      		}
      		Console.print(values.join(", "));
      	}
      });
      
      posted in General Questions
      C
      civet
    • RE: Projucer 6.1.4 warning

      @Matt_SF @d-healey thanks

      Stupid me, I didn't notice that there was an option in the in the sign-in dialog after sign-in button clicked 🤣

      posted in General Questions
      C
      civet
    • Projucer 6.1.4 warning

      commit a54f5d8

      update to Projucer 6.1.4 (MacOS) - a new warning pop-up:

      Incompatible License and Splash Screen Setting
      Save and export is disabled.

      posted in General Questions
      C
      civet
    • Custom Keyboard - ScriptPanel vs FloatingTile with LAF

      Currently, as far as I know, there seem to be these two methods to implement a virtual piano keyboard in HISE:

      • draw custom graphics on a Panel and add the interaction on mouse events, note on/off etc.
      • use a Keyboard FloatingTile and change its LookAndFeel.

      What are the pros and cons between them?

      posted in General Questions
      C
      civet
    • RE: Custom Curve for Synth.addVolumeFade() ?

      @Christoph-Hart Thanks!

      Would it be possible to just link to a Table then convert a Table to an interpolation algorithm internally?

      posted in General Questions
      C
      civet
    • RE: Custom Curve for Synth.addVolumeFade() ?

      Envelopes are not suitable for all situations, even dynamically change their values, because Envelope affects the entire sampler.

      Synth.addVolumeFade() can more precisely control the gain of voices associated with given midi event, without touching the value of Attack or Release.

      But now Synth.addVolumeFade() can only use a hardcoded linear fading. It would be nice if we could bind it to a Table or any other custom function.

      something like this:

      Synth.addVolumeFadeWithFunction(eventId, fadeTime,  customFadingFunc);
      
      inline function customFadingFunc(t)
      {
          return Table1.getTableValue(t);
      }
      
      posted in General Questions
      C
      civet