HISE Logo Forum
    • Categories
    • Register
    • Login

    setFile + index/multiple slots?

    Scheduled Pinned Locked Moved Solved Scripting
    3 Posts 2 Posters 32 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.
    • iamlampreyI
      iamlamprey
      last edited by

      I have a scriptnode network with 2 convolutions, I've setup the external data slots but how do I programmatically access the second one?

      Engine.loadAudioFilesIntoPool();
      
      const pnlCabALoader = Content.getComponent("pnlCabALoader");
      const fxSlots = [Synth.getSlotFX("modularA"), Synth.getSlotFX("modularB"), Synth.getSlotFX("modularC"), Synth.getSlotFX("modularD"), Synth.getSlotFX("modularE"), Synth.getSlotFX("modularF"), Synth.getSlotFX("modularG")];
      	
      // Drop
      inline function pnlCabALoaderDrop(f)
      {
          if(f.drop)
          {
      		local file = FileSystem.fromAbsolutePath(f.fileName);
      		switch (this)
      		{
      			case pnlCabALoader:
      				for (slot in fxSlots)
      				{
      					local effectId = slot.getCurrentEffectId();					
      					if (effectId == "cab")
      					{
      						local id = slot.getCurrentEffect().getId();
      						local ref = Synth.getAudioSampleProcessor(id);
      						ref.setFile(f.fileName); // sets the first slot, but how to set the second one?						
      					}
      				}						
      				break;
      			case pnlCabBLoader:
      				// second file slot logic would go here
      				break;
      		}
      	    this.set("text", file.toString(3));
      	    this.repaint();
          }
      }
      
      pnlCabALoader.setFileDropCallback("All Callbacks", "*.wav", pnlCabALoaderDrop);
      
      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @iamlamprey
        last edited by

        @iamlamprey use getAudioFile(slotIndex). This returns a new object with more or less the same methods but represents one of the slots.

        const var asp = Synth.getAudioSampleProcessor("Script FX1");
        
        
        const var slot1 = asp.getAudioFile(0);
        const var slot2 = asp.getAudioFile(1);
        
        slot1.loadFile("your file goes here.wav");
        slot2.loadFile("your other file goes here.wav");
        
        iamlampreyI 1 Reply Last reply Reply Quote 1
        • iamlampreyI
          iamlamprey @Christoph Hart
          last edited by

          @Christoph-Hart Perfect, thank you!

          1 Reply Last reply Reply Quote 0
          • iamlampreyI iamlamprey marked this topic as a question
          • iamlampreyI iamlamprey has marked this topic as solved
          • First post
            Last post

          12

          Online

          2.0k

          Users

          12.7k

          Topics

          109.9k

          Posts