Forum
    • Categories
    • Register
    • Login

    Player and expansion communication......

    Scheduled Pinned Locked Moved General Questions
    15 Posts 3 Posters 65 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.
    • David HealeyD
      David Healey @Lindon
      last edited by

      @Lindon What information does the "state" include?

      Free HISE Bootcamp Full Course for beginners.
      YouTube Channel - Public HISE tutorials
      My Patreon - HISE tutorials

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @David Healey
        last edited by

        @David-Healey state is simply "open" or "closed" (0 or 1) for every library (which has categories in it) and Categories(which have instruments in them)

        State needs to be transferable BOTH ways so we start with all libs closed....

        In the player we open LibA, open CatA and load InstrumentAA

        InstrumentAA opens and displays the LibPanel with all libs closed except LibA, and within that CatA is also open...

        In instrumentAA we close LibA and Open LibB, then we close InstrumentAA,

        The player opens with all libs closed except LibB

        HISE Development for hire.
        www.channelrobot.com

        David HealeyD LindonL 2 Replies Last reply Reply Quote 0
        • David HealeyD
          David Healey @Lindon
          last edited by

          @Lindon How does it need to work between multiple instances of the plugin?

          Free HISE Bootcamp Full Course for beginners.
          YouTube Channel - Public HISE tutorials
          My Patreon - HISE tutorials

          LindonL 1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @David Healey
            last edited by

            @David-Healey --- havent even considered that, any way you want.

            HISE Development for hire.
            www.channelrobot.com

            1 Reply Last reply Reply Quote 0
            • LindonL
              Lindon @Lindon
              last edited by Lindon

              @Lindon said in Player and expansion communication......:

              @David-Healey state is simply "open" or "closed" (0 or 1) for every library (which has categories in it) and Categories(which have instruments in them)

              State needs to be transferable BOTH ways so we start with all libs closed....

              In the player we open LibA, open CatA and load InstrumentAA

              InstrumentAA opens and displays the LibPanel with all libs closed except LibA, and within that CatA is also open...

              In instrumentAA we close LibA and Open LibB, then we close InstrumentAA,

              The player opens with all libs closed except LibB

              The problem(well theres a truck load of problems..) here is I can see how I can save state (in some file) and read it on plugin(player) load...and as soon as the user requests a load of an instrument we write the current states to the file.

              The instrument reads this state file on load and sets the display correctly. On instrument unload (so the instrument is unloading itself) the instrument saves the new state(assuming its changed) and unloads itself.....

              ..but I dont know how the player now reads this new state file in any efficient manner- meaning not running a timer every 0.5 seconds to re-read the state file......???

              The player never knows the instrument is now unloaded does it? Or can it tell from

              ExpansionHandler.getCurrentExpansion() if it == "" then whatever it loaded is now unloaded... ???

              Or how is the player itself loading/unloading whilst a Full Instrument is in play? I guess I need to know the mechanics of player/instrument load/unload ....do we execute init again? ...@Christoph-Hart !!!

              HISE Development for hire.
              www.channelrobot.com

              David HealeyD 1 Reply Last reply Reply Quote 0
              • David HealeyD
                David Healey @Lindon
                last edited by

                @Lindon If you set the current expansion to "" that will trigger the unload action, so you can respond to that. I'm not sure if that reruns the player's on init but you could test.

                I think a timer and polling on the message thread is the way to go, the timer won't run when the interface is minimised anyway.

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

                LindonL 1 Reply Last reply Reply Quote 0
                • LindonL
                  Lindon @David Healey
                  last edited by

                  @David-Healey said in Player and expansion communication......:

                  @Lindon If you set the current expansion to "" that will trigger the unload action, so you can respond to that. I'm not sure if that reruns the player's on init but you could test.

                  I think a timer and polling on the message thread is the way to go, the timer won't run when the interface is minimised anyway.

                  Yeah its the expansion that will be setting the current expansion to "" - so I'm not sure how the player responds to that....I cant see a expansion changed callback or listener...

                  HISE Development for hire.
                  www.channelrobot.com

                  David HealeyD 1 Reply Last reply Reply Quote 0
                  • David HealeyD
                    David Healey @Lindon
                    last edited by

                    @Lindon said in Player and expansion communication......:

                    cant see a expansion changed callback

                    ExpansionHandler.setExpansionCallback() Not sure if it works in this scenario the way you need but give it a try.

                    Free HISE Bootcamp Full Course for beginners.
                    YouTube Channel - Public HISE tutorials
                    My Patreon - HISE tutorials

                    Christoph HartC 1 Reply Last reply Reply Quote 0
                    • Christoph HartC
                      Christoph Hart @David Healey
                      last edited by

                      Long time that I worked on this, but setting an empty expansion in a full player plugin should get you back to the shell - it's onInit callback should be compiled too again.

                      LindonL 1 Reply Last reply Reply Quote 1
                      • LindonL
                        Lindon @Christoph Hart
                        last edited by

                        @Christoph-Hart said in Player and expansion communication......:

                        Long time that I worked on this, but setting an empty expansion in a full player plugin should get you back to the shell - it's onInit callback should be compiled too again.

                        Im not sure I understand what you mean, no actually I clearly dont understand what you mean....

                        I load the player - its init executes,
                        I load an Full instrument expansion from the player - its init executes
                        I unload the instrument, from within the instrument, the player reloads.... does its init execute? Or does it some how magically retain its own state ?

                        HISE Development for hire.
                        www.channelrobot.com

                        David HealeyD 1 Reply Last reply Reply Quote 0
                        • David HealeyD
                          David Healey @Lindon
                          last edited by

                          @Lindon said in Player and expansion communication......:

                          does its init execute?

                          We think yes but try it and see

                          Free HISE Bootcamp Full Course for beginners.
                          YouTube Channel - Public HISE tutorials
                          My Patreon - HISE tutorials

                          LindonL 1 Reply Last reply Reply Quote 0
                          • LindonL
                            Lindon @David Healey
                            last edited by Lindon

                            @David-Healey Ok will do but assuming YES...

                            Problem #2:

                            Just before I unload I save a file....so this:

                            myFile.saveObject(myJSON);
                            myExpansionHandler.getCurrentExpansion("");
                            
                            

                            What happens?
                            Is the file save async? or better still blocking?
                            is it running in a differnt thread?
                            will it even happen?
                            Will it get aborted?
                            How will I know when its finished?

                            HISE Development for hire.
                            www.channelrobot.com

                            LindonL 1 Reply Last reply Reply Quote 0
                            • LindonL
                              Lindon @Lindon
                              last edited by Lindon

                              @Lindon or do I have to do this....

                              myFile.saveObject(myJSON);
                              runSomeShittyTimerToDoTheUnload();
                              
                              

                              As you may surmise - I dont find it "elegant"

                              HISE Development for hire.
                              www.channelrobot.com

                              David HealeyD 1 Reply Last reply Reply Quote 0
                              • David HealeyD
                                David Healey @Lindon
                                last edited by David Healey

                                @Lindon Pretty sure it's synchronous because it's calling JUCE's replaceWithText function and returning a bool.

                                So you could probably do something like

                                if (f.writeObject(myJson))
                                    unloadTheExpansion
                                

                                Free HISE Bootcamp Full Course for beginners.
                                YouTube Channel - Public HISE tutorials
                                My Patreon - HISE tutorials

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

                                18

                                Online

                                2.3k

                                Users

                                13.6k

                                Topics

                                118.3k

                                Posts