HISE Logo Forum
    • Categories
    • Register
    • Login

    Has anyone made a custom PNG based keyboard ?

    Scheduled Pinned Locked Moved General Questions
    22 Posts 7 Posters 969 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.
    • d.healeyD
      d.healey @Christoph Hart
      last edited by

      @christoph-hart said in Has anyone made a custom PNG based keyboard ?:

      Actually I think the best way would be to have a scriptable look and feel for it.

      Oh that's a very good idea

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @d.healey
        last edited by

        @d-healey Ah, I just realized that it won't be of much use unless you can draw images in a look and feel callback which sadly requires my brain skills to implement.

        d.healeyD 1 Reply Last reply Reply Quote 1
        • d.healeyD
          d.healey @Christoph Hart
          last edited by

          @christoph-hart Yeah I see what you mean.

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          Christoph HartC 1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @d.healey
            last edited by

            @d-healey Brain Skills -> Applied.

            Link Preview Image
            - added image drawing to custom look and feel · christophhart/HISE@f4b0b17

            The open source framework for sample based instruments - - added image drawing to custom look and feel · christophhart/HISE@f4b0b17

            favicon

            GitHub (github.com)

            d.healeyD 1 Reply Last reply Reply Quote 2
            • d.healeyD
              d.healey @Christoph Hart
              last edited by d.healey

              @christoph-hart That was quick! :D

              So this can be added to any LAF routine?

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @d.healey
                last edited by

                @d-healey Yup.

                I also noticed that the keyboard look and feel methods are a bit messy, so I'll do it myself. Oh and I'll remove the non-vector default keyboard during the process, I don't think anyone uses them anymore.

                d.healeyD 1 Reply Last reply Reply Quote 1
                • d.healeyD
                  d.healey @Christoph Hart
                  last edited by

                  @christoph-hart Will the Engine.setKeyColour() affect a LAF keyboard or will the LAF override it?

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  Christoph HartC 1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart @d.healey
                    last edited by

                    @d-healey Good call, I'll make sure it will get passed on as property into the call.

                    BTW, I've just pushed a preliminary version. This is a example use case:

                    laf.registerFunction("drawWhiteNote", function(g, obj)
                    {
                    	g.setColour(obj.hover ? Colours.yellow : Colours.white);
                    	
                    	g.fillRect(obj.area);
                    	g.setColour(Colours.brown);
                    	g.drawRect(obj.area, 1.0);
                    	
                    	g.setColour(0x22FF0000);
                    	
                    	if(obj.down)
                    		g.fillRect(obj.area); 
                    });
                    
                    laf.registerFunction("drawBlackNote", function(g, obj)
                    {
                    	g.setColour(obj.hover ? Colours.yellow : Colours.black);
                    	
                    	obj.area[1] += -4.0;
                    	obj.area[3] += 4.0;
                    
                    	g.fillRoundedRectangle(obj.area, 3.0);
                    });
                    
                    1 Reply Last reply Reply Quote 5
                    • Christoph HartC
                      Christoph Hart
                      last edited by

                      And this is how you use it with filmstrips:

                      const var laf = Engine.createGlobalScriptLookAndFeel();
                      
                      for(i = 0; i < 12; i++)
                      {
                      	// use whatever prefix you want
                      	var prefix = "{PROJECT_FOLDER}Oink/";
                      
                      	var d = "down_" + i;
                      	var u = "up_" + i;
                      
                      	laf.loadImage(prefix + d + ".png", d);
                      	laf.loadImage(prefix + u + ".png", u);
                      }
                      
                      laf.registerFunction("drawWhiteNote", function(g, obj)
                      {
                      	g.setColour(Colours.black);
                      	
                      	var x = obj.down ? "down_" : "up_";
                      	x += obj.noteNumber % 12;
                      	g.drawImage(x, obj.area, 0,0);
                      	
                              // fill the key color if it's defined
                      	if(obj.keyColour)
                      	{
                      		g.setColour(Colours.withAlpha(obj.keyColour, 0.2));
                      		g.fillRect(obj.area);	
                      	}
                      	
                              // draw the hover state
                      	if(obj.hover)
                      	{
                      		g.setColour(0x33000000);
                      		g.fillRect(obj.area);	
                      	}
                      	
                              // Add the C octave numbers using the best font available
                      	if(obj.noteNumber % 12 == 0)
                      	{
                      		obj.area[3] -= 4.0;
                      
                      		g.setFont("Comic Sans MS", 14.0);
                      		g.setColour(0x77000000);
                      		g.drawAlignedText("C" + parseInt(obj.noteNumber / 12), obj.area, "centredBottom");
                      	}
                      });
                      
                      laf.registerFunction("drawBlackNote", function(g, obj)
                      {
                      	g.setColour(Colours.black);
                      
                      	var x = obj.down ? "down_" : "up_";
                      	x += obj.noteNumber % 12;
                      	g.drawImage(x, obj.area, 0,0);
                      	
                      	if(obj.keyColour)
                      	{
                      		g.setColour(Colours.withAlpha(obj.keyColour, 0.3));
                      		g.fillRect(obj.area);	
                      	}
                      	
                      	if(obj.hover)
                      	{
                      		g.setColour(0x33FFFFFF);
                      		g.fillRect(obj.area);	
                      	}
                      });
                      
                      for(i = 60; i < 72; i++)
                      	Engine.setKeyColour(i, Colours.green);
                      
                      d.healeyD DabDabD 2 Replies Last reply Reply Quote 2
                      • d.healeyD
                        d.healey @Christoph Hart
                        last edited by

                        @christoph-hart said in Has anyone made a custom PNG based keyboard ?:

                        var x = obj.down ? "down_" : "up_";

                        I had no idea you could assign with the ternary operator in this way. I have some edits to make to my scripts!

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        1 Reply Last reply Reply Quote 0
                        • DabDabD
                          DabDab @Christoph Hart
                          last edited by

                          @christoph-hart Does it only work with New Layout branch or Develop branch ? Or it will work with Master branch as well?

                          Bollywood Music Producer and Trance Producer.

                          Matt_SFM 1 Reply Last reply Reply Quote 0
                          • Matt_SFM
                            Matt_SF @DabDab
                            last edited by Matt_SF

                            @dabdab Only new_layout for now

                            Develop branch
                            Win10 & VS17 / Ventura & Xcode 14. 3

                            DabDabD 1 Reply Last reply Reply Quote 1
                            • DabDabD
                              DabDab @Matt_SF
                              last edited by

                              @matt_sf OK. Thank you :)

                              Bollywood Music Producer and Trance Producer.

                              1 Reply Last reply Reply Quote 0
                              • d.healeyD
                                d.healey
                                last edited by

                                LAF keyboard is great!

                                b74f07af-f225-417c-adc6-734121a67103-image.png

                                Libre Wave - Freedom respecting instruments and effects
                                My Patreon - HISE tutorials
                                YouTube Channel - Public HISE tutorials

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

                                50

                                Online

                                1.7k

                                Users

                                11.7k

                                Topics

                                102.0k

                                Posts