Fun with Regex
-
Powerful stuff!
-
The sound property indexes no longer seem to be correct, is there an enum we can use?
-
What about
Sampler.Root
? -
@Christoph-Hart Perfect, thank you.
-
I've noticed a discrepency between
getSoundProperty
andsetSoundProperty
that has been confusing me for the last hour or so.The sound index passed
setSoundProperty
relates to the sample selection, while the sound index passed togetSoundProperty
relates to the entire sample map. I think it would make more sense if both related to the sound selection. I can implement this and make a pull request or do you think it would be better as a separate function? -
I've made a pull request, it's a tiny change.
-
Actually I have redesigned that entire system to use a more "modern" approach last year. You can create an array of sample objects and then just iterate over them to avoid all this index mess:
for(sample in Sampler.createSelection(".*")) sample.set(Sampler.RootKey, sample.get(Sampler.RootKey);
There are a bunch of calls that create these arrays (for example you can use
Sampler.createListFromGUISelection()
in order to create custom workflows and macro operations). -
@Christoph-Hart Ooo I shall try this out, thanks!
-
@d-healey Sampler.SampleState always seems to return 0.
const selection = Sampler1.createSelection(".*"); for (s in selection) Console.print(s.get(Sampler.SampleState));
I'm thinking we can use this for a purge all until played type of functionality.
-
Is the point of this Regex stuff to allow end users to modify something like the velocity mapping of a sampler in a compiled plugin?
-
You could do that, but it will be super complex to implement a data model that stores this information as the sample maps will be restored to their original state.
The prime use case for this is to automate tasks while sample editing, but you can also do simple stuff in the end user plugin.
-
@Christoph-Hart Yeh sweet all good, sample start modulator and the note functions can still do what I need :) thanks for clarifying
-