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.
    • ulrikU
      ulrik
      last edited by

      Is it possible to get current playing position in a sample, in a Sampler or LoopPlayer?

      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

        @ulrik I'm referring to this:
        Skärmavbild 2021-08-06 kl. 11.48.12.png

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

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

          I don't see a function that gives access to it.

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

          ulrikU 1 Reply Last reply Reply Quote 1
          • ulrikU
            ulrik @d.healey
            last edited by

            @d-healey Hm, it could be useful to have that function.. @Christoph-Hart ?

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

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

              Yes that is actually a good request - also it‘s the same for table ruler positions and highlighted sliders in a slider pack now so you‘ll get these too for free.

              ulrikU 3 Replies Last reply Reply Quote 4
              • ulrikU
                ulrik @Christoph Hart
                last edited by

                @Christoph-Hart Horray!! 🥳

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

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

                  @Christoph-Hart I just noticed your new commit, is this feature in? 🥶

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

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

                    Nope, not yet. I'll try to include it when I work on the complex data types next time.

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

                      @Christoph-Hart Ok, thanks! 👍

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

                      ? 1 Reply Last reply Reply Quote 1
                      • 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
                                            • First post
                                              Last post

                                            58

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.8k

                                            Posts