HISE Logo Forum
    • Categories
    • Register
    • Login

    Get Filename while using Sampler

    Scheduled Pinned Locked Moved General Questions
    filenamesamplername display
    10 Posts 2 Posters 651 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.
    • trillbillyT
      trillbilly
      last edited by

      Hey Gang,

      Im using a modified setup of the CustomSampleImport demo project. It looks as though it brings files in via Absolute Path instead of saving Samplemaps, cool. How do I then display file names via a Label? I see the "getFilename" for the "AudioSampleProcessor" in API. Is this something I can use?

      1 Reply Last reply Reply Quote 0
      • trillbillyT
        trillbilly
        last edited by

        It looks like AudioSampleProcessor can only be used with Loop Player and Convolution Reverb (according to the documentation).

        Does anyone know a way to call back the absolute path/filename?

        1 Reply Last reply Reply Quote 0
        • trillbillyT
          trillbilly
          last edited by

          I think FileSystem is the way to go. Still having some trouble though. Im watching @d-healey filesystem & api video but am having trouble implementing the "FileSystem.Filename" function.

          Here is my code

          const getSampleLoc1 = FileSystem.getFolder(FileSystem.AudioFiles);
          
          const getSampleName1 = getSampleLoc1.getChildFile(getSampleLoc1.Filename);
          
          Console.print(getSampleName1);
          

          It compiles and it does print but it prints "Objxc6f952f8" instead of a list of the file names on the given folder.

          Where am I going wrong and how far off am I?

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

            @trillbilly FileSystem.Filename is a constant not a function. https://docs.hise.audio/scripting/scripting-api/file/index.html#tostring

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

            trillbillyT 1 Reply Last reply Reply Quote 0
            • trillbillyT
              trillbilly @d.healey
              last edited by trillbilly

              @d-healey Ok. Maybe going in the right direction? I am now returning "3" in the console print lol...

              const var SampleNamecmb1 = Content.getComponent("SampleNamecmb1");
              
              const getSampleLoc1 = FileSystem.getFolder(FileSystem.AudioFiles);
              
              const getSampleName1 = getSampleLoc1.Filename;
              
              
              inline function onSampleNamecmb1Control(component, value)
              {
              	File.toString(getSampleName1);
              };
              
              Content.getComponent("SampleNamecmb1").setControlCallback(onSampleNamecmb1Control);
              
              Console.print(getSampleName1); //Console prints "3"
              

              EDIT: Come to think of it, I think Im doing this all wrong. I need to look for the Absolute Path/FileName so that when a custom sample is loaded, it still reads the correct file name.

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

                @trillbilly Filename is a constant (actually it's an enum) with the value of 3, so if you print it to the console you will see 3. You need to use it with the toString function that I linked to previously.

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

                trillbillyT 1 Reply Last reply Reply Quote 0
                • trillbillyT
                  trillbilly @d.healey
                  last edited by

                  @d-healey Thanks. Sorry, I'm away from my studio right now. Do you mean I replace the Filename with the toString function?

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

                    @trillbilly No you need both, don't I do this in the video?

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

                    trillbillyT 1 Reply Last reply Reply Quote 0
                    • trillbillyT
                      trillbilly @d.healey
                      last edited by

                      @d-healey Possibly, I went through it via the titles, I was limited on time. Ill have a bit more time early next week to jump on it again. Thanks.

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

                        @trillbilly I just had a look, timestamp is 17:48, the chapter title is toString

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

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

                        23

                        Online

                        1.7k

                        Users

                        11.8k

                        Topics

                        102.8k

                        Posts