HISE Logo Forum
    • Categories
    • Register
    • Login

    key colour

    Scheduled Pinned Locked Moved Scripting
    10 Posts 2 Posters 879 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.
    • LevitanusL
      Levitanus
      last edited by

      I'm trying to paint the keyboard, but nothing is happening, where am I wrong?

      /** External Script File interface.js */
      
      Content.makeFrontInterface(633, 300);
      Console.clear();
      var instr = Engine.loadFromJSON("../scripts/CB.json");
      Console.print(instr.name);
      
      const var Keyboard = Content.addFloatingTile("Keyboard", 0, 100);
      // [JSON Keyboard]
      Content.setPropertiesFromJSON("Keyboard", {
        "width": 600,
        "height": 72
      });
      // [/JSON Keyboard]
      Keyboard.setContentData({"Type": "Keyboard"});
      
      reg i;
      
      const key_none = 0xffffff;
      const key_low = 0x00ff00;
      const key_mixed = 0x0000ff;
      const key_heigh = 0x00ffff;
      reg msg;
      
      msg = "LS: " + instr.Playrange.LS[0] + ' ' + instr.Playrange.LS[1];
      msg += "| HS: " + instr.Playrange.HS[0] + ' ' + instr.Playrange.HS[1];
      Console.print(msg);
      
      Engine.setLowestKeyToDisplay(instr.Playrange.LS[0] - 10);
      
      for (i = 0; i < 128; i++){
          if (i < instr.Playrange.LS[0] || i > instr.Playrange.HS[1]){
              Engine.setKeyColour(i, key_none);
              msg = i + " is key_none";
              Console.print(msg);
          } else if (i < instr.Playrange.HS[0]){
              Engine.setKeyColour(i, key_low);
              msg = i + " is key_low";
              Console.print(msg);
          } else if (i < instr.Playrange.LS[1]){
              Engine.setKeyColour(i, key_mixed);
              msg = i + " is key_mixed";
              Console.print(msg);
          } else {
              Engine.setKeyColour(i, key_heigh);
              msg = i + " is key_heigh";
              Console.print(msg);
          }
      }
      const var Label1 = Content.getComponent("Label1");
      
      
      
      function onNoteOn()
      {
          
      }
      function onNoteOff()
      {
          
      }
      function onController()
      {
          
      }
      function onTimer()
      {
          
      }
      function onControl(number, value)
      {
          
      }
      
      1 Reply Last reply Reply Quote 0
      • LevitanusL
        Levitanus
        last edited by

        hmm, in addition: now HISE is falling trying to open script view on this file...

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

          @levitanus What version of HISE are you using?

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

          LevitanusL 1 Reply Last reply Reply Quote 0
          • LevitanusL
            Levitanus @d.healey
            last edited by

            @d-healey 0_1542225311790_2018-11-15_02-55-01.png

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

              @levitanus Your code is for old style HISE 1.5

              // [JSON Keyboard]

              These JSON tags are no longer required.

              Try a minimal example, add a keyboard and set the key colours, nothing else, and see if that works.

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

              LevitanusL 1 Reply Last reply Reply Quote 0
              • LevitanusL
                Levitanus @d.healey
                last edited by

                @d-healey also doesn't work:

                <?xml version="1.0" encoding="UTF-8"?>
                
                <Processor Type="SynthChain" ID="test3" Bypassed="0" Gain="1" Balance="0"
                           VoiceLimit="256" KillFadeTime="20" IconColour="0" packageName=""
                           BuildVersion="650">
                  <ChildProcessors>
                    <Processor Type="MidiProcessorChain" ID="Midi Processor" Bypassed="0">
                      <ChildProcessors>
                        <Processor Type="ScriptProcessor" ID="Interface" Bypassed="0">
                          <ChildProcessors/>
                          <Content/>
                          <UIData>
                            <ContentProperties DeviceType="Desktop">
                              <Component type="ScriptFloatingTile" id="FloatingTile1" x="115" y="108"
                                         bgColour="0" itemColour="436207615" itemColour2="4294967295"
                                         textColour="4294951115" ContentType="Keyboard" Data="{&#13;&#10;  &quot;KeyWidth&quot;: 14,&#13;&#10;  &quot;DisplayOctaveNumber&quot;: false,&#13;&#10;  &quot;LowKey&quot;: 12,&#13;&#10;  &quot;HiKey&quot;: 127,&#13;&#10;  &quot;CustomGraphics&quot;: false,&#13;&#10;  &quot;DefaultAppearance&quot;: true,&#13;&#10;  &quot;BlackKeyRatio&quot;: 0.69999999,&#13;&#10;  &quot;ToggleMode&quot;: false,&#13;&#10;  &quot;MidiChannel&quot;: 1,&#13;&#10;  &quot;MPEKeyboard&quot;: false&#13;&#10;}"
                                         updateAfterInit="0" width="297" height="98"/>
                            </ContentProperties>
                          </UIData>
                        </Processor>
                      </ChildProcessors>
                    </Processor>
                    <Processor Type="ModulatorChain" ID="GainModulation" Bypassed="0" Intensity="1">
                      <ChildProcessors/>
                    </Processor>
                    <Processor Type="ModulatorChain" ID="PitchModulation" Bypassed="1" Intensity="0">
                      <ChildProcessors/>
                    </Processor>
                    <Processor Type="EffectChain" ID="FX" Bypassed="0">
                      <ChildProcessors/>
                    </Processor>
                  </ChildProcessors>
                  <RoutingMatrix NumSourceChannels="2" Channel0="0" Send0="-1" Channel1="1" Send1="-1"/>
                  <macro_controls>
                    <macro name="Macro 1" value="0" midi_cc="-1"/>
                    <macro name="Macro 2" value="0" midi_cc="-1"/>
                    <macro name="Macro 3" value="0" midi_cc="-1"/>
                    <macro name="Macro 4" value="0" midi_cc="-1"/>
                    <macro name="Macro 5" value="0" midi_cc="-1"/>
                    <macro name="Macro 6" value="0" midi_cc="-1"/>
                    <macro name="Macro 7" value="0" midi_cc="-1"/>
                    <macro name="Macro 8" value="0" midi_cc="-1"/>
                  </macro_controls>
                  <MidiAutomation/>
                  <MPEData Enabled="0"/>
                </Processor>
                
                
                1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey
                  last edited by

                  @levitanus

                  Here is a minimal example, showing how to set the colour of a single key. Let me know if this works for you

                  HiseSnippet 950.3ocsV0zaaaDDcWYQiJ0nhFfdI2HxIa.UAIUGmllCQ15iTgDaKDo31aAqIGItvq1kX4R6HDj+a9d+yze.EvcVtThRIJAQEn5Dm2LyxGmOdqFoUAPRhRSnUlrHFHzG3MdgzD0Mhwkjg8Hzev6LVhAz9NnSWDyR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Q2ZABLpeldLk1WxvoprIPx+xaK4NJ
                  

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

                  1 Reply Last reply Reply Quote 1
                  • LevitanusL
                    Levitanus
                    last edited by Levitanus

                    also, I can't understand what is about changing floating panel JSON:

                    neither like this is not working:

                    const var FloatingTile2 = Content.getComponent("FloatingTile2");
                    var ftjson = {
                      "OffImage": "midi.png",
                      "OnImage": "midi.svg",
                      "ShowMidiLabel": false
                    };
                    

                    not in the script, not in the interface designer.
                    only pure XML-preset hacking)


                    @d.healey Yep, it works. Can't understand what the difference to my example...
                    PS. AAgrh, with alpha...

                    This works:

                    Content.makeFrontInterface(600, 500);
                    
                    Content.makeFrontInterface(633, 300);
                    Console.clear();
                    var instr = Engine.loadFromJSON("../scripts/CB.json");
                    Console.print(instr.name);
                    
                    reg i;
                    
                    const var key_none = 0x00;
                    const var key_low = 0x6000ffff;
                    const var key_mixed = 0x6000ff60;
                    const var key_heigh = 0x6000ff00;
                    reg msg;
                    
                    msg = "LS: " + instr.Playrange.LS[0] + ' ' + instr.Playrange.LS[1];
                    msg += "| HS: " + instr.Playrange.HS[0] + ' ' + instr.Playrange.HS[1];
                    Console.print(msg);
                    
                    Engine.setLowestKeyToDisplay(instr.Playrange.LS[0] - 10);
                    
                    for (i = 0; i < 128; i++){
                        if (i < instr.Playrange.LS[0] || i > instr.Playrange.HS[1]){
                            Engine.setKeyColour(i, key_none);
                            msg = i + " is key_none";
                            Console.print(msg);
                        } else if (i < instr.Playrange.HS[0]){
                            Engine.setKeyColour(i, key_low);
                            msg = i + " is key_low";
                            Console.print(msg);
                        } else if (i < instr.Playrange.LS[1]){
                            Engine.setKeyColour(i, key_mixed);
                            msg = i + " is key_mixed";
                            Console.print(msg);
                        } else {
                            Engine.setKeyColour(i, key_heigh);
                            msg = i + " is key_heigh";
                            Console.print(msg);
                        }
                    }
                    
                    d.healeyD 2 Replies Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @Levitanus
                      last edited by

                      @levitanus When you make a change in the interface designer you must press F5 or Compile for the change to be applied.

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

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

                        @levitanus You have this at the top of your script

                        Content.makeFrontInterface(600, 500);
                        
                        Content.makeFrontInterface(633, 300);
                        

                        Pick one :p

                        I don't have scripts/CB.json so I can't do much else to debug.

                        This works for me though

                        Content.makeFrontInterface(600, 500);
                        
                        const var key_low = 0x6000ffff;
                        Engine.setKeyColour(60, key_low);
                        

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

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

                        49

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        101.8k

                        Posts