HISE Logo Forum
    • Categories
    • Register
    • Login

    firing a preview note when sampler has loaded new sample map

    Scheduled Pinned Locked Moved Scripting
    11 Posts 4 Posters 295 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.
    • MorphoiceM
      Morphoice
      last edited by

      I'm loading sample maps of one shots like so:

      inline function onSnarePromControl(control, value)
      { 
         if (snareProms.contains(control)) {
      	   for(e in snareProms)
      	  	 e.setValue( e == control);
      	   Snare.asSampler().loadSampleMap(snareMaps[snareProms.indexOf(control)]);
      	   Snare.setLoadingCallback(function(isPreloading)
      	   {
      	   	Synth.playNote(38,127);
      	   });
         }  
      }
      

      if I understand the documentation correctly the loadingCallback should be executed as soon as the sample map is loaded. however nothing happens, no note is played. What am I doing wrong?

      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 Lindon

        @Morphoice said in firing a preview note when sampler has loaded new sample map:

        I'm loading sample maps of one shots like so:

        inline function onSnarePromControl(control, value)
        { 
           if (snareProms.contains(control)) {
        	   for(e in snareProms)
        	  	 e.setValue( e == control);
        	   Snare.asSampler().loadSampleMap(snareMaps[snareProms.indexOf(control)]);
        	   Snare.setLoadingCallback(function(isPreloading)
        	   {
        	   	Synth.playNote(38,127);
        	   });
           }  
        }
        

        if I understand the documentation correctly the loadingCallback should be executed as soon as the sample map is loaded. however nothing happens, no note is played. What am I doing wrong?

        well first DONT put your setLoadingCallback inside another inline function.....
        second check the value of isPreLoading
        third look at the documatition of preLoading callback - it has to be a callback on a panel

        HISE Development for hire.
        www.channelrobot.com

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

          @Lindon wouldn't this simply work?

          Snare.setLoadingCallback(Synth.playNote(38,127));
          

          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 snare is a sampler - so no, it has to be on a panel read the documentation:

            Link Preview Image
            HISE | Scripting | ScriptPanel

            The ScriptPanel API methods

            favicon

            (docs.hise.dev)

            HISE Development for hire.
            www.channelrobot.com

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

              Use this instead:

              Link Preview Image
              HISE | Scripting | Broadcaster

              An object for implementing the Observer software pattern

              favicon

              (docs.hise.dev)

              The loading callback of a panel is more suited towards UI tasks (eg. displaying a loading bar).

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

                @Christoph-Hart said in firing a preview note when sampler has loaded new sample map:

                Use this instead:

                @Morphoice The documentation is a little inaccurate so a couple of threads you might want to read:

                https://forum.hise.audio/topic/9879/code-snippet-new-samplemap-broadcaster-attachment
                https://forum.hise.audio/topic/5644/do-i-not-understand-the-setloadingcallback

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

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

                  @d-healey said in firing a preview note when sampler has loaded new sample map:

                  Link Preview Image
                  Do I not understand the setLoadingCallback?

                  The setLoadingCallback seems to fire sometimes BEFORE all the loading has happened. I understood this to get called once all the loading has happened.... Her...

                  favicon

                  Forum (forum.hise.audio)

                  y'all got me confused talking about a panel when I want a sampler to play something but I'll work through it. Just returned home! thanks for the links and advice!

                  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 said in firing a preview note when sampler has loaded new sample map:

                    @d-healey said in firing a preview note when sampler has loaded new sample map:

                    Link Preview Image
                    Do I not understand the setLoadingCallback?

                    The setLoadingCallback seems to fire sometimes BEFORE all the loading has happened. I understood this to get called once all the loading has happened.... Her...

                    favicon

                    Forum (forum.hise.audio)

                    y'all got me confused talking about a panel when I want a sampler to play something but I'll work through it. Just returned home! thanks for the links and advice!

                    Well its not actually the sampler you care about - but instead the process of loading a sample into a sampler - which happens over on another (background) thread, so you need something to tell you when this process is finished..... looks like the only truly reliable way is still some ways off - but a broadcaster will be your best option so far...

                    HISE Development for hire.
                    www.channelrobot.com

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

                      @Christoph-Hart @Lindon I shall learn about broadcasters then. But on a first readthrough it'll probably take 5 more to grasp what it is about and how I can implement what I want using it. Bear with me as I try

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

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

                        @Morphoice https://youtu.be/ZxkfnfOOr3s

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

                        MorphoiceM 1 Reply Last reply Reply Quote 1
                        • MorphoiceM
                          Morphoice @d.healey
                          last edited by

                          @d-healey 👌 👌 👌
                          that antenna reminds me of the one I have once written a song about!
                          https://www.youtube.com/watch?v=g-bqbd0v70g
                          destiny!

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

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

                          9

                          Online

                          1.8k

                          Users

                          11.9k

                          Topics

                          103.9k

                          Posts