HISE Logo Forum
    • Categories
    • Register
    • Login

    Has anyone made a custom PNG based keyboard ?

    Scheduled Pinned Locked Moved General Questions
    22 Posts 7 Posters 1.0k 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.
    • ustkU
      ustk @BWSounds
      last edited by

      @bwsounds Buttons are not recommended, but you can use a panel with an advanced mouseCB/paintRoutine.
      I believe @d-healey made a video about it, but it might come with its own set of issues...

      Maybe a panel overlay would work?

      Can't help pressing F5 in the forum...

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

        It's very limited. You can't do key colours either. I wouldn't use it.

        @d-healey Actually I think the best way would be to have a scriptable look and feel for it. I'm currently pretty busy, but if anyone might want to give it a shot, there's a guide of how to add scriptable look and feels here:

        Link Preview Image
        HISE | Glossary | Add UI customisations

        How to add customizable UI LookAndFeels

        favicon

        (docs.hise.audio)

        The first steps are already done, so you just need to subclass this

        Link Preview Image
        HISE/hi_components/keyboard/CustomKeyboard.h at d503b363fd7e449cf9a587607c6c94c913e90546 · christophhart/HISE

        The open source framework for sample based instruments - HISE/hi_components/keyboard/CustomKeyboard.h at d503b363fd7e449cf9a587607c6c94c913e90546 · christophhart/HISE

        favicon

        GitHub (github.com)

        from the script look and feel and register the methods.

        d.healeyD 1 Reply Last reply Reply Quote 4
        • 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

                                    23

                                    Online

                                    1.8k

                                    Users

                                    12.0k

                                    Topics

                                    104.1k

                                    Posts