HISE Logo Forum
    • Categories
    • Register
    • Login

    Can I manually trigger a Callback function?

    Scheduled Pinned Locked Moved Scripting
    44 Posts 5 Posters 1.2k 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.
    • LindonL
      Lindon @d.healey
      last edited by

      @d-healey said in Can I manually trigger a Callback function?:

      @Lindon said in Can I manually trigger a Callback function?:

      just use the radio buttons..hang on I will do it for you...

      Radio buttons have problems, rolling your own as @Morphoice is doing is usually better, at least you have more control over them. I never use the built in radio group.

      what problems are these?

      HISE Development for hire.
      www.channelrobot.com

      d.healeyD 1 Reply Last reply Reply Quote 0
      • MorphoiceM
        Morphoice @Lindon
        last edited by

        @Lindon thanks. trying to figure out what you did there. I can see the loading function changed, makes sense.and the buttons simply need to be assigned a radio group, correct?

        https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

          @Morphoice correct - you probably want to do something on "empty" - like load an empty sample map, but for this I just jumped out of the callback so the sampler would keep its currently loaded sample

          HISE Development for hire.
          www.channelrobot.com

          MorphoiceM 2 Replies Last reply Reply Quote 0
          • d.healeyD
            d.healey @Lindon
            last edited by

            @Lindon said in Can I manually trigger a Callback function?:

            what problems are these?

            It's been a while since I used it, the only I remember is if you want the option to have no buttons pressed then the radio group won't work. I thought there was some issue with restoring their state from presets too but I might be misremembering.

            Since I'm usually writing callbacks for them anyway though it's not really any extra work to add a couple more lines to get radio group behaviour.

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

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

              @Lindon @d-healey gotcha! seems to work like a charm, and it suddenly is successfully wirtten and recalled to/from a preset. that might - if I'm not overlooking anything - solve all my problems at once.

              only thing I'd love to have is actually hearing the selected sample on selection but if I use the sample loading callback it would trigger upon preset restore aswell

              https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                @d-healey said in Can I manually trigger a Callback function?:

                @Lindon said in Can I manually trigger a Callback function?:

                what problems are these?

                It's been a while since I used it, the only I remember is if you want the option to have no buttons pressed then the radio group won't work. I thought there was some issue with restoring their state from presets too but I might be misremembering.

                Correct about the no-buttons-pressed option, never had an issue with them restoring state in 8 years of using them....slightly frightened now...

                Since I'm usually writing callbacks for them anyway though it's not really any extra work to add a couple more lines to get radio group behaviour.

                Your call....

                HISE Development for hire.
                www.channelrobot.com

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

                  @Lindon said in Can I manually trigger a Callback function?:

                  slightly frightened now...

                  It's more likely me misremembering some issue I ran into years ago.

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

                  MorphoiceM 1 Reply Last reply Reply Quote 1
                  • MorphoiceM
                    Morphoice @Lindon
                    last edited by

                    @Lindon said in Can I manually trigger a Callback function?:

                    you probably want to do something on "empty"

                    they'll all be occupado in the end, I just wanted to focus on the functionality before I create all the sample maps and proceed to sample all my hardware drum machines

                    https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                      @Morphoice said in Can I manually trigger a Callback function?:

                      @Lindon @d-healey gotcha! seems to work like a charm, and it suddenly is successfully wirtten and recalled to/from a preset. that might - if I'm not overlooking anything - solve all my problems at once.

                      only thing I'd love to have is actually hearing the selected sample on selection but if I use the sample loading callback it would trigger upon preset restore aswell

                      I dont really understand what you are saying in this last bit - you select a button and it loads that map - isnt that what you want?

                      HISE Development for hire.
                      www.channelrobot.com

                      MorphoiceM 2 Replies Last reply Reply Quote 0
                      • MorphoiceM
                        Morphoice @Lindon
                        last edited by

                        @Lindon said in Can I manually trigger a Callback function?:

                        you select a button and it loads that map - isnt that what you want?

                        yes. I was just thinking an audible preview of the sample after it's loaded might add some comfort for the user if they switch through the available samples

                        https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                          @Lindon I tried firing a note after the sample is loaded successfully but the problem was this would not work when the button is clicked but fire on recalling a preset, and there we wouldn't need it,

                          https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                            @Morphoice so use the preset manager to set a "loading a preset" flag , and uncheck once the preset is loaded...

                            In your buttons check to see if this flag is set - if not then it really is a user pressing the button(not a preset loading) - so you can play a demo note...

                            https://docs.hise.dev/scripting/scripting-api/userpresethandler/index.html

                            you want setPreCallback (to set the flag ON)
                            and setPostcallback (to turn the flag OFF)

                            HISE Development for hire.
                            www.channelrobot.com

                            MorphoiceM 2 Replies Last reply Reply Quote 0
                            • MorphoiceM
                              Morphoice @d.healey
                              last edited by

                              @d-healey I'm glad I'm not the only benefiting away from from the mess I caused. Unless you want all buttons off radio groups seem to be fine to use.

                              https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                                @Lindon aye! the playing never worked on the button press though. only ever on the preset load. I'll have to revisit the way I fired the note

                                https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

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

                                  @Lindon this was the way I did it before

                                     		Bass.asSampler().loadSampleMap(bassMaps[bassProms.indexOf(control)]);
                                     		Bass.setLoadingCallback(Synth.playNote(36,127));
                                  

                                  and that only seems to fire on preset loading, not on the actual button use

                                  https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

                                  1 Reply Last reply Reply Quote 0
                                  • C
                                    clevername27 @Morphoice
                                    last edited by

                                    @Morphoice You can…

                                    1. Call it by function name (pass in the component as the first argument).

                                    2. If you want the callback after a component value change, call onChanged(). Except if it's during onInit. That won't work.

                                    3. Register the callback for use with a broadcaster. Then, trigger the broadcaster manually.

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

                                    36

                                    Online

                                    2.0k

                                    Users

                                    12.7k

                                    Topics

                                    110.1k

                                    Posts