HISE Logo Forum
    • Categories
    • Register
    • Login

    get current position in sample?

    Scheduled Pinned Locked Moved Scripting
    22 Posts 5 Posters 1.3k 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.
    • Christoph HartC
      Christoph Hart
      last edited by

      Next time was just now :)

      Just create a reference to the actual data object, then call getCurrentlyDisplayedIndex(). Works with Tables, SliderPacks and AudioFiles.

      ? ulrikU 3 Replies Last reply Reply Quote 3
      • ?
        A Former User @Christoph Hart
        last edited by

        @Christoph-Hart said in get current position in sample?:

        Next time was just now :)

        Just create a reference to the actual data object, then call getCurrentlyDisplayedIndex(). Works with Tables, SliderPacks and AudioFiles.

        Awesome!

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User @Christoph Hart
          last edited by

          @Christoph-Hart said in get current position in sample?:

          Next time was just now :)

          Just create a reference to the actual data object, then call getCurrentlyDisplayedIndex(). Works with Tables, SliderPacks and AudioFiles.

          But the playhead still isn't visible in my compiled standalone plugin... not sure what is going on...

          1 Reply Last reply Reply Quote 1
          • ulrikU
            ulrik @Christoph Hart
            last edited by

            @Christoph-Hart thank you Christoph, it works great, is it possible to get a

            setPlayhead as well? 😬
            

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

            1 Reply Last reply Reply Quote 0
            • ?
              A Former User @ulrik
              last edited by

              @ulrik Did you get this to work? I am trying to get a custom playhead panel to display the sample position... No luck so far.

              ulrikU 1 Reply Last reply Reply Quote 0
              • ulrikU
                ulrik @A Former User
                last edited by

                @UrsBollhalder yes it works, I use a timer to check current

                Timer.setTimerCallback(function()
                {
                	var current = AudioFile.getCurrentlyDisplayedIndex();
                	Console.print(current);
                });
                

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

                ? 1 Reply Last reply Reply Quote 0
                • ?
                  A Former User @ulrik
                  last edited by

                  @ulrik said in get current position in sample?:

                  @UrsBollhalder yes it works, I use a timer to check current

                  Timer.setTimerCallback(function()
                  {
                  	var current = AudioFile.getCurrentlyDisplayedIndex();
                  	Console.print(current);
                  });
                  

                  Allright... but... I have a Sampler with multiple audio files (5-7)... I suppose on the onNoteOn I have to somehow feed it the right audio file, no? With the AudioSampleProcessor.getAudioFile??

                  ulrikU 1 Reply Last reply Reply Quote 0
                  • ulrikU
                    ulrik @A Former User
                    last edited by

                    @UrsBollhalder Hmm....yes you have to make a reference to that particular audio file, I don't remember how to do that but I guess you'll find it in the documentation
                    If I remember correctly, I think you have to make a "selection" of that file using some of these methods
                    Skärmavbild 2021-09-08 kl. 11.01.22.png

                    and use it when making the reference ... 🤔

                    I've only used the "getCurrentlyDisplayedIndex();" inside the AudioPlayer, not the sampler

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

                    ? 1 Reply Last reply Reply Quote 0
                    • ?
                      A Former User @ulrik
                      last edited by

                      @ulrik ok... That'll be fun... 🤣
                      What is meant by indexes in this case? I also saw this one:
                      Screenshot 2021-09-08 at 11.14.51.png
                      slotIndex?!

                      Thx for the help!

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

                        @Christoph-Hart could we have a small snippet showing how to

                        getCurrentlyDisplayedIndex()
                        

                        from played sample in a sampler?

                        I've fiddled around with

                        createSelection()
                        createSelectionFromIndexes()
                        and
                        createSelectionWithFilter()
                        

                        but I just can't getCurrentlyDisplayedIndex()
                        from any of the selections, I guess I'm doing something stupid 🥺

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

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

                          @Christoph-Hart I guess we need to enable this for creating the proper reference to the sampler, right?

                          Skärmavbild 2021-09-09 kl. 09.55.32.png

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

                          NatanN 1 Reply Last reply Reply Quote 0
                          • NatanN
                            Natan @ulrik
                            last edited by

                            @ulrik Why its Not working?

                            HiseSnippet 1227.3oc0W0saaTDEd1XunZCEQghDWNJvEtRso1kjVDHDNw1AYQbhUbZKWDopI6N1dTlclUyNqaLnJwM7BvSDOB7nvUbKblcVu+j5DkXRpf8BKMmybl4aN+7cNdnR5QihjJjSsilGRQNef6n4B8zNSILApeWjyG5NfDooJrUzNyCIQQTejiSku2HvoVUTx2e9c6P3DgGMWDB8BIyitGKfoykNr8Ov37cI9ziXAE18ls66IEcjbYLfmJtMQgDuSISn6SLaaMWjy60ymokpQZhlFgbptize9noxWKr6+ErH1IbpYQKzH3frh2Ux8MH1HE0YJi6Obw6NBgbbGl6EpX8B22c.ymkIO2a7QIJv4VTze3rVY3UoD7ZUDdMK.uk.ImBPppER2ycjmhEpy0Xvy661W.AmwDvsWDJ18hV6ubb6HgcHzaDPNktqBVjYQim1r4CwvOO3apWGb8QZ7LhBOjHn7V3uEuvxITcGYPnT.KZrtU85fM4lrcrOStmTFNjSlSUFiSRiLllnaDIHjSyvdi0SjhMlfSswbh0sG9FQTsI2P0gv4m.IAMFGK7zLonwCp+y0qYtRuXkBvCbSm+xSvqUKedWVTnQreegO8rFvcTCdVQRNciPECdOomCn3MF.73GigvmRi0SoXsACYXxHNAUMdxVItr5KPEVJ1WpoGjBu5uoN97pFOdo5LtXkjygCcYpsW2kXXCQbvIT0Cgn.OllsQHqobpn6EmJVrRwyFwKrQonufoOHjJtn5GTZZhIsMEUPgpNIo8SSSZSBQujLiNVpBPLeSgTIYsPIOfhTG9DMA47atc95iedDUEcrh9SD5wcoQmpkgG2Yd.Qy7hv1TKHq06znboOBefh3AxKn93ATtzmQW115vgZGlGNYKysIlOCT2Zysv6Lb.t6miGvDa7ZxLjhHlPSRR.+piApIR5I7Mq+UM7Bdd+tFzm5Q.mC3vBoJMyDKb5RmArh1x5ZtoOHffKqHCBeV+2cWTzaRAS7a2w0lNhNKyW0dR64YK9kCZiJbNtW63P9496kN2wsCWDz66aXHe6JXfZ+sns.BSoeLmnKyhZZcjp.xmKQcYnmDQL87hsVtwnVupP7dtCYZuoKGiqsDLBA6aCLl1P5tt8FOl5oyAXU2c+wamtOEu9OYw0mQxRsMdVZ7+hGN3OtpCGDdkGN.Zv3AgGZwzjjX1QPE8oLwjhWkAl8DD386WT7gRo1POWb3DKgQR8Mb7k1McFvCU9D1kwSmO4+fLUAlPfkhJfb1B1INXQI5KdhyIi8xoxkMkUqUbJqp2VSYU8pkme4v6+ALWkFJr1BLNhYRZ5IlAYCfDCF+XnkxXRLWuPZ4ByARgLbpTv7JmaqUrISnphXeoOns0ZHCMWx8aeHkSIQEJh9h16wDTh57kmWCeQqq8.xKMd8YtV3hMrI3+Mws2ooYWZ2mJWotO233c06Dcy.kCkwZfUe.ARTMbY6GGLBZF3QAjHfQhLS45rlYdT65lKn2FQE9IK9a3KUYKyZmTksVn7cxcDP7TxW4YmT1jKemDIv6VjzGoF7Gtg03rQhccatQSfK2m8JOOi69QsPnkaySVAa9xUvlMWAa1ZEr4oqfMOaEr4qtTaLMi1NVKCrkhffg8Rlu2wIalBmJn+Af.LwaW
                            
                            ulrikU 1 Reply Last reply Reply Quote 0
                            • ulrikU
                              ulrik @Natan
                              last edited by ulrik

                              @Natan because you have to make a reference to the loaded audio file like this

                              	var current = AudioLoopPlayer1.getAudioFile(0).getCurrentlyDisplayedIndex(0);
                              

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

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

                              46

                              Online

                              1.7k

                              Users

                              11.7k

                              Topics

                              101.8k

                              Posts