HISE Logo Forum
    • Categories
    • Register
    • Login

    Callback for MidiOverlay?

    Scheduled Pinned Locked Moved Scripting
    8 Posts 2 Posters 287 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.
    • ulrikU
      ulrik
      last edited by

      I sat up the Broadcaster to register a mouse event when the mouse is over the MidiOverlay component, and that is working fine, however if I drag a midi file to the component, the broadcaster doesn't register any events.

      Is there another way to get a callback from the Floatingtile?

      Hise Develop branch
      MacOs 15.3.1, Xcode 16.2
      http://musikboden.se

      Adam_GA 1 Reply Last reply Reply Quote 0
      • Adam_GA
        Adam_G @ulrik
        last edited by Adam_G

        @ulrik hey Ulrik, did you manage to solve this? i have the same issue. my midioverlay panel doesnt repaint when i add a midi file in. it only shows up when i press play

        ulrikU 1 Reply Last reply Reply Quote 0
        • ulrikU
          ulrik @Adam_G
          last edited by

          @Adam_G I skipped the floating tile and used a panel instead.

          Skärmavbild 2023-04-30 kl. 08.00.33.png

          Hise Develop branch
          MacOs 15.3.1, Xcode 16.2
          http://musikboden.se

          Adam_GA 2 Replies Last reply Reply Quote 0
          • Adam_GA
            Adam_G @ulrik
            last edited by

            @ulrik ahh thanks for the tip :)

            1 Reply Last reply Reply Quote 0
            • Adam_GA
              Adam_G @ulrik
              last edited by

              @ulrik said in Callback for MidiOverlay?:

              @Adam_G I skipped the floating tile and used a panel instead.

              Skärmavbild 2023-04-30 kl. 08.00.33.png

              trying to use this but im not sure what goes into callbackLevel and dropFunction. im assuming wildcard is "*.mid" ?

              ulrikU 1 Reply Last reply Reply Quote 0
              • ulrikU
                ulrik @Adam_G
                last edited by

                @Adam_G this is a code I have in one project

                DropPnl.setPaintRoutine(function(g)
                {
                	var a = this.getLocalBounds(0);
                	g.setFont("default", 12);
                	g.fillAll("0xff666666");
                	
                	var text = this.data.text.length > 0 ? this.data.text : "Midi Drop";
                	
                	g.setColour(Colours.white);
                	g.drawFittedText(text + "\n" + this.data.filename, this.getLocalBounds(0), "centred", 2, 0);
                });
                
                
                DropPnl.setFileDropCallback("All Callbacks", "*.mid", function(file)
                {
                    if (file.hover)
                    {
                	    this.data.text = "Drop to load!";
                //        Getting the midi file name from the path string
                this.data.filename = file.fileName.substring(file.fileName.lastIndexOf("/")+1, file.fileName.lastIndexOf("."));
                        this.data.dropped = false;
                        this.changed();
                    }
                    
                    if (file.drop)
                    {
                        var obj = {};
                        obj.fileName = file.fileName;
                        
                        this.setValue(obj);
                        this.data.text = "loaded";
                        this.data.dropped = true;
                        this.changed();
                    }
                });
                
                
                //	Drop Panel Callback
                inline function onDropPnlControl(component, value)
                {
                    if (isDefined(value.fileName) && component.data.dropped == true)
                    {
                        MPlayer.setFile(value.fileName, true, true);
                        
                        //	SET TOPBAR PARAMETERS
                        setParameters();
                    }
                };
                
                Content.getComponent("DropPnl").setControlCallback(onDropPnlControl);
                
                

                Maybe you can get some information from that

                Hise Develop branch
                MacOs 15.3.1, Xcode 16.2
                http://musikboden.se

                Adam_GA 2 Replies Last reply Reply Quote 0
                • Adam_GA
                  Adam_G @ulrik
                  last edited by Adam_G

                  @ulrik very much appreciated! everything looks to be working good until i drop midi file, then i get error:

                  Interface:! Line 37, column 21: Aborting script execution after error occured during changed() callback {SW50ZXJmYWNlfHwxMDA3fDM3fDIx}

                  maybe im missing something?

                  1 Reply Last reply Reply Quote 0
                  • Adam_GA
                    Adam_G @ulrik
                    last edited by

                    @ulrik i started a new thread for this. perhaps you could take a look at the snippet ive shared there and let me know if im on the right track- https://forum.hise.audio/topic/7530/midi-player-drop-panel/4

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

                    46

                    Online

                    1.7k

                    Users

                    11.7k

                    Topics

                    101.9k

                    Posts