HISE Logo Forum
    • Categories
    • Register
    • Login

    Bulk Convert SampleMaps to WaveTables

    Scheduled Pinned Locked Moved Feature Requests
    25 Posts 4 Posters 1.2k 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.
    • ?
      A Former User
      last edited by A Former User

      Edit

      Okay I think a better way to do it is to iterate through the sampleMap ComboBox at the top of the window, since the conversion process already works on the combobox's currently selected item:

      void bulkConvertSampleMapsToWavetables()
      	{
      
      		auto sampleComboBox = getComboBoxComponent("samplemap");
      		int loopLength = sampleComboBox->getNumItems();
      
      		for (int i = 0; i < loopLength; i++)
      		{
      			sampleComboBox->setSelectedItemIndex(i);
      
      			if (currentMode == FFTResynthesis)
      				converter->renderAllWavetablesFromHarmonicMaps(getProgressCounter());
      			else
      				converter->renderAllWavetablesFromSingleWavetables(getProgressCounter());
      
      			if (threadShouldExit())
      				return;
      
      			auto leftTree = converter->getValueTree(true);
      
      			auto fileL = currentlyLoadedMap + ".hwt";
      
      			auto tfl = GET_PROJECT_HANDLER(chain).getSubDirectory(ProjectHandler::SubDirectories::AudioFiles).getChildFile(fileL);
      
      			PresetHandler::writeValueTreeAsFile(leftTree, tfl.getFullPathName());
      		}
      

      75ef82891d8a206c2b66daf872dcc3f3.gif

      Here you can see it iterating through the combobox properly, but each consecutive wavetable is larger still...

      Is there a JUCE method for control.changed() ? I can't seem to find it

      Edit: okay added sendNotification and tried both setSelectedItemIndex and setSelectedId and still get the same issue

      1 Reply Last reply Reply Quote 0
      • ?
        A Former User
        last edited by

        Hmm okay so I think the renderAllWavetablesFromSingleWavetables is going to keep "stacking" the files as long as the window is open, since manually clicking the confirmation dialog also closes the window...

        Also if I load one of these "stacked" wavetables and hit a note, HISE crashes

        I just need the renderAllWavetablesFromSingleWavetables to reset in between loop iterations and everything should work, I just have no idea how to do that

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User
          last edited by

          WOOOH okay so I can clear the ValueTree (and fix the size-stacking issue) by calling...

          converter->getValueTree(true).removeAllChildren(nullptr);
          

          ...at the end of each Loop iteration. I also think I had to change the comboBox notification to async for it to update properly (it was re-exporting the same wavetable under different names).

          sampleComboBox->setSelectedItemIndex(i, sendNotificationAsync);
          

          For some other weird reason I had to delete the whole HISE build folder and recompile, VS kept saying it was Up-To-Date despite me changing lines of code.

          Anyway here's the "finished" function:

          void bulkConvertSampleMapsToWavetables()
          	{
          		auto sampleComboBox = getComboBoxComponent("samplemap");
          		int loopLength = sampleComboBox->getNumItems();
          
          		for (int i = 0; i < loopLength; i++)
          		{
          			sampleComboBox->setSelectedItemIndex(i, sendNotificationAsync);
          
          			if (currentMode == FFTResynthesis)
          				converter->renderAllWavetablesFromHarmonicMaps(getProgressCounter());
          			else
          				converter->renderAllWavetablesFromSingleWavetables(getProgressCounter());
          
          			if (threadShouldExit())
          				return;
          
          			auto tree = converter->getValueTree(true);
          			auto file = sampleComboBox->getItemText(i) + ".hwt";
          			auto tf = GET_PROJECT_HANDLER(chain).getSubDirectory(ProjectHandler::SubDirectories::AudioFiles).getChildFile(file);
          
          			PresetHandler::writeValueTreeAsFile(tree, tf.getFullPathName());
          
          			converter->getValueTree(true).removeAllChildren(nullptr);
          		}
          	}
          

          There's still some clunkiness to it, mainly the bulkConvert button not being a switch/togglable thing. IDK how to do any of the github push stuff so this is about as far as I'm gonna take it 😂

          d.healeyD 1 Reply Last reply Reply Quote 2
          • d.healeyD
            d.healey @A Former User
            last edited by

            @iamlamprey

            Anyway here's the "finished" function:

            Well done!

            I had to delete the whole HISE build folder and recompile, VS kept saying...

            Sometimes intermediate files get left behind between builds. You can clean the solution folder from within VS too.

            IDK how to do any of the github push stuff

            Time to learn

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

            ? 1 Reply Last reply Reply Quote 0
            • ?
              A Former User @d.healey
              last edited by

              @d-healey said in Bulk Convert SampleMaps to WaveTables:

              Time to learn

              Hahaha tomorrow :) bed time

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

              24

              Online

              1.9k

              Users

              12.5k

              Topics

              108.6k

              Posts