HISE Logo Forum
    • Categories
    • Register
    • Login

    LinkOSX oddness

    Scheduled Pinned Locked Moved Solved General Questions
    10 Posts 2 Posters 418 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.
    • M_HollowayM
      M_Holloway
      last edited by M_Holloway

      I have a sample install package that allows users to select the sample location and, in a post install script, write that location to the LinkOSX file.

      This all seems to work fine and when I open the LInkOSX in a text editor, it reads correctly.

      In my plugin/standalone, on initialisation, it grabs the LinkOSX file text, sets this as the sample folder, reloads all samples and sets a label to the current sample location...

      const var linkOSX = FileSystem.fromAbsolutePath("/Library/Application Support/myPlugin/LinkOSX");
      const var linkTxt = linkOSX.loadAsString();
      currentSampleLoc.set("text", linkTxt); //sets label text
      Settings.setSampleFolder(linkTxt);
      Engine.reloadAllSamples();
      

      or at least it should but although the label shows the correct path, no samples play.

      I have a button in my settings UI that allows users to select the sample location from within the plugin and when clicked it opens to the sample folder set in LinkOSX (located using FileSystem.Samples) and then after that is selected it works fine and the samples play as expected.

      inline function oncurrentSampleBtnControl(component, value)
      {
      	if(value)
      		FileSystem.browseForDirectory(startFolder, function(sampleDir)
      		{
      			if (isDefined(sampleDir) && sampleDir.isDirectory())
      				{newLoc = sampleDir.toString(0);
      				Settings.setSampleFolder(newLoc);
      				Engine.reloadAllSamples();
      				currentSampleLoc.set("text", newLoc);
      				linkOSX.writeString(newLoc);}
      		});
      };
      
      Content.getComponent("currentSampleBtn").setControlCallback(oncurrentSampleBtnControl);
      

      Inspecting the LinkOSX file after this has run reveals a new modification timestamp but the text within is identical to before.

      Any ideas anyone?

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

        @M_Holloway said in LinkOSX oddness:

        Inspecting the LinkOSX file after this has run reveals a new modification timestamp but the text within is identical to before.

        Do the permissions change?

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

        M_HollowayM 1 Reply Last reply Reply Quote 0
        • M_HollowayM
          M_Holloway @d.healey
          last edited by M_Holloway

          @d-healey Just tried it again to check this and no, the permissions stay the same.

          I wondered if it was because the LinkOSX was getting overwritten in the manual sample folder location routine so added

          linkOSX.writeString(linkTxt);
          

          to the initialisation routine to see if that made a difference... it didn't

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

            @M_Holloway We can rewrite this, not sure it will help with the issue though. I've added a couple of comments

            if (!value)
                return;
            
            FileSystem.browseForDirectory(startFolder, function(sampleDir)
            {
                if (!isDefined(sampleDir) || !sampleDir.isDirectory())
                    return;
            
                newLoc = sampleDir.toString(0); // Don't use a magic number, use one of the constants - https://docs.hise.audio/scripting/scripting-api/file/index.html#tostring
                Settings.setSampleFolder(newLoc);
                Engine.reloadAllSamples();
                currentSampleLoc.set("text", newLoc);
                linkOSX.writeString(newLoc); // You don't need to do this, the setSampleFolder function takes care of it for you.
            });
            

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

            M_HollowayM 1 Reply Last reply Reply Quote 0
            • M_HollowayM
              M_Holloway @d.healey
              last edited by

              @d-healey

              Thanks for that; your suggestion doesn't break anything, but the problem still persists. It seems odd when the two routines are essentially performing the same operation.

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

                @M_Holloway There's a possibility that your script is adding an invisible character at the end of the line, like a carriage return or something. You'll need a text editor that can display hidden characters in order to check that.

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

                M_HollowayM 1 Reply Last reply Reply Quote 0
                • M_HollowayM
                  M_Holloway @d.healey
                  last edited by

                  @d-healey

                  Is there anywhere else it could be looking at for the sample location? As an experiment, I deleted the LinkOSX file and all of the various locations I'd put samples while testing and on opening the standalone, the text label, - which in theory should have been blank - showed an old sample location.

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

                    @M_Holloway I'm only aware of it looking in appdata. There are two app data folders on Mac though. One in the system Library and one in the user Library.

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

                    M_HollowayM 2 Replies Last reply Reply Quote 0
                    • M_HollowayM
                      M_Holloway @d.healey
                      last edited by

                      @d-healey I already looked in the user Application Support folder and there's nothing there that should be affecting it.

                      1 Reply Last reply Reply Quote 0
                      • M_HollowayM
                        M_Holloway @d.healey
                        last edited by

                        @d-healey Cracked it... it was, as you suggested a sneaky EOL return in the generated file. Some tweaks to the post install script and now it all works.

                        1 Reply Last reply Reply Quote 1
                        • M_HollowayM M_Holloway has marked this topic as solved on
                        • First post
                          Last post

                        53

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        101.9k

                        Posts