Forum

    • Register
    • Login
    • Search
    • Categories

    Custom Samples + Expansions

    General Questions
    1
    2
    50
    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.
    • DanH
      DanH last edited by

      I've been using bits of the script from the Custom User Sample tutorial project. When in an expansion and browsing expansion presets the combo box I use to choose sample maps will snap to zero every time a preset is loaded.

      This should normally happen only when a custom sample is imported into the sampler, however something about being in an expansion is causing this to trigger.

      Here's the function below. @Christoph-Hart can you think of any reason this is firing just because of being in an expansion?

      If I comment out the if / else statement below 'HERE !' it's ok (but then the combo box shows a sample map even if the user has imported their own sample).

      // This function will be called whenever a samplemap is loaded (at the end of a preloading task)
      inline function initAfterSampleLoad()
      {
      	local id = Sampler1.getCurrentSampleMapId();
      	
      	isCustomMap = id == "CustomJSON";
      	
      ///// HERE !
      	if(isCustomMap || id.length == 0)
      		SampleMapLoader.setValue(0);
      	else
      		SampleMapLoader.setValue(Sampler.getSampleMapList().indexOf(id) + 1);
      		
      	// fetch the first sound
      	sound = Sampler1.createSelection(".*")[0];
      	totalSamples = 0;
      	
      	// if the sample map is empty, clear everything and abort.
      	if(!isDefined(sound))
      	{
      		LoopPointDragger.updateLoopPoints();
      		storeSampleMapData();
      		return;
      	}
      	
      	// We need this number for the loop point dragger.
      	totalSamples = sound.getRange(Sampler.SampleEnd)[1];
      	
      	local xf = sound.get(Sampler.LoopXFade);
      	local xfr = sound.getRange(Sampler.LoopXFade)[1];
      	
      	// setup the non persistent UI controls
      	local fadeValue = xfr > 0 ? xf / xfr : 0;
      	Content.getComponent("XFade").setValue(fadeValue);
      	Content.getComponent("Loop").setValue(sound.get(Sampler.LoopEnabled));
      	
      	LoopPointDragger.updateLoopPoints();
      	storeSampleMapData();
      }
      
      DanH 1 Reply Last reply Reply Quote 0
      • DanH
        DanH @DanH last edited by

        Hi @Christoph-Hart, I could really use some help with this please 🙂 When I now save a preset in an expansion it saves some sampleDropper data into the preset as though I've loaded my own audio into the sampler. For some reason being in an expansion triggers the custom sample callbacks and I can't see how to stop it... The result is the expansion sample map doesn't load as I think it's trying to load the custom audio in the sampler instead.

        Thanks!

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

        23
        Online

        982
        Users

        6.6k
        Topics

        60.7k
        Posts