HISE Logo Forum
    • Categories
    • Register
    • Login

    AudioFile setRange won't increment

    Scheduled Pinned Locked Moved Bug Reports
    9 Posts 4 Posters 246 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.
    • bendursoB
      bendurso
      last edited by

      I was following this post https://forum.hise.audio/topic/10852/audiofile-range-odd-behaviour?_=1732628051201 but was unsolved.

      The setRange function only seems to work to decrement the value, but does not increment it.

      Check: (I was hitting F5 to compile)

      Screen Recording 2024-11-26 at 11.01.11 AM.gif

      bendursoB griffinboyG ulrikU 3 Replies Last reply Reply Quote 0
      • bendursoB
        bendurso @bendurso
        last edited by

        Any ideas? Is it a bug or there is another way to achieve this?

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

          I could be wrong but I think this is because HISE is working on a cached version of the audio file and each time you reduce the length a new cached version is created which is shorter than the original.

          One solution would be to reload the original file before increasing the length, I don't know if this would have any negatives.

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

          bendursoB 2 Replies Last reply Reply Quote 0
          • bendursoB
            bendurso @d.healey
            last edited by

            @d-healey That makes sense. However, I actually want to create a knob with the parameter setRange, so it would overload everything if it loaded the file thousands of times per second.

            1 Reply Last reply Reply Quote 0
            • bendursoB
              bendurso @d.healey
              last edited by

              @d-healey said in AudioFile setRange won't increment:

              One solution would be to reload the original file before increasing the length

              Actually, it didn't crash on my system and worked fine, but it might crash on slower computers. (I first unload the file and then reload it each time the user moves the knob.)

              1 Reply Last reply Reply Quote 0
              • griffinboyG
                griffinboy @bendurso
                last edited by griffinboy

                @bendurso

                A known glitch I believe. (edit: ah, yes you saw my post)
                I wrote a whole new sampler just because it wasn't getting fixed.

                I also created a system to unload and load the audiofile on each change, but it was buggy and weird so I stopped using it.

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

                  @griffinboy said in AudioFile setRange won't increment:

                  I wrote a whole new sampler just because it wasn't getting fixed.

                  Wouldn't it have been easier to modify the source to add a function to refresh the cache with the original file?

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

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

                    @bendurso If you have a component that can store the length of the audio file, you could do like this:

                    This is code from one of my projects
                    the "WFPnl" is a panel that stores the file length when loaded
                    I then can use the length when setting the range to loop

                    looper.gif

                    //	================= LOAD AUDIO FILE ===================
                    inline function loadAudioFile()
                    {
                    	FileSystem.browse(FileSystem.AudioFiles, false, "*", function(file)
                    	{
                    		if (file)
                    		{
                    			ALP.setFile("");
                    			var fileName = file.toString(0);
                    			ALP.setFile(fileName);
                    			
                    			WFPnl.getValue().length = ALP.getSampleLength();
                    			WFPnl.getValue().range = [0, ALP.getSampleLength()];
                    			
                    			setLoopKnbs();
                    			
                    			GridCmb.changed();
                    			TimeSignatureCmb.changed();
                    			SnapToGrid.changed();
                    			updatePnl(WFPnl);
                    		}
                    	});
                    }
                    

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

                    1 Reply Last reply Reply Quote 1
                    • griffinboyG
                      griffinboy @d.healey
                      last edited by

                      @d-healey

                      Yeah I've only just started dipping my toes into modifying the source. It's not gone super well haha

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

                      61

                      Online

                      1.7k

                      Users

                      11.7k

                      Topics

                      101.8k

                      Posts