ACCESS AUDIO FILES SUB FOLDER:
-
@Chazrox Loop over the
audioFiles
array and only add the items you want to the combo box. You can use.contains()
and.substring()
to get only the text you want. -
@d-healey am I doing this right?
its loading the combobox properly but loading the audio from 'Audio Files' instead of 'Subber' folder.const var cmbSubs = Content.getComponent("cmbSubs"); const var subs = Engine.loadAudioFilesIntoPool(); cmbSubs.set("items",""); for (x in subs) if (x.contains("SUB_")) cmbSubs.addItem(x.replace("{PROJECT_FOLDER}Subber").replace(".wav").replace(".WAV").replace(".aif").replace("/"));
Correct Files:
Wrong Files:
-
@Chazrox Use
{}
with your for loops and if statements.Show me the code that does the loading.
-
const var cmbSubs = Content.getComponent("cmbSubs"); const var subs = Engine.loadAudioFilesIntoPool(); const var audioKickSub = Synth.getAudioSampleProcessor("Kick Sub"); inline function oncmbSubsControl(component, value) { if (value > 0) audioKickSub.setFile(subs[value-1]); }; Content.getComponent("cmbSubs").setControlCallback(oncmbSubsControl); cmbSubs.set("items",""); for (x in subs) if (x.contains("SUB_")) { cmbSubs.addItem(x.replace("{PROJECT_FOLDER}Subber").replace(".wav").replace(".WAV").replace(".aif").replace("/").replace("SUB_")); }
its "subs" thats messing it up isnt it? Its pulling from the entire array and value 1 from that list right?
That just crossed my mind. -
Like this
for (x in subs) { if (x.contains("SUB_")) { cmbSubs.addItem(x.replace("{PROJECT_FOLDER}Subber").replace(".wav").replace(".WAV").replace(".aif").replace("/").replace("SUB_")); } }
@Chazrox said in ACCESS AUDIO FILES SUB FOLDER::
its "subs" thats messing it up isnt it? Its pulling from the entire array and value 1 from that list right?
That just crossed my mind.Yeah I think you're right. So when you loop over the array of audio files and pull out the values for your combo box, you also need to put those audio files (the sub ones) into a separate array.
-
@d-healey can you help me with the loop? I cant figure that one out rn. I've never done a loop inside of a loop before.
-
@Chazrox said in ACCESS AUDIO FILES SUB FOLDER::
I've never done a loop inside of a loop before.
You don't need to.
for (x in audioFiles) { if (x.contains("SUB_")) { cmbSubs.addItem(x.replace("{PROJECT_FOLDER}Subber").replace(".wav").replace(".WAV").replace(".aif").replace("/").replace("SUB_")); subArray.push(x); } }
-
@d-healey Working! Thank you!
const var cmbSubs = Content.getComponent("cmbSubs"); const var subs = Engine.loadAudioFilesIntoPool(); const var audioKickSub = Synth.getAudioSampleProcessor("Kick Sub"); cmbSubs.set("items",""); const var subArray = []; for (x in subs) { if (x.contains("SUB_")) { cmbSubs.addItem(x.replace("{PROJECT_FOLDER}Subber").replace(".wav").replace(".WAV").replace(".aif").replace("/").replace("SUB_")); subArray.push(x); } } inline function oncmbSubsControl(component, value) { if (value > 0) audioKickSub.setFile(subArray[value-1]); }; Content.getComponent("cmbSubs").setControlCallback(oncmbSubsControl);
-
@d-healey Thank you for your time sir! Grateful!
-
@Chazrox I'd rename your
subs
array toaudioFiles
since that's what it contains. And you can renamesubArray
tosubs
-
@d-healey makes sense. Thank you!
I've also learned today that filenames can play a big help in sorting through lists like these. Prefixes!
-
C Chazrox marked this topic as a question
-
C Chazrox has marked this topic as solved