I was asked (in an PM) by @SirSickSik if it was possible to have multiple modulators on an object.
I have to admit I dont use modulators (I prefer inlets) much so I needed to go have a check..
as always the first step to finding out how something is done, is to check the factory objects.
(something Ive suggested many times as a tip)
in this particular case I could see it was possible since, midi/in/keyb mod does exactly what we are asking
the trick to adding modulators is you need to add a modulator sources section in your object code.
now we have 2 restrictions (which Ive raised github requests on
- the object editor does not feature this, so you will need to add by editing the xml
- embedded objects don't appear to support.
so with this we need to add:
<ModulationSources>
<string>i1</string>
<string>i2</string>
</ModulationSources>
the next part is we need to change the sources value where needed, this is done as follows:
PExModulationSourceChange(
&parent->GetModulationTable()[parent->MODULATOR_attr_name_i1*NMODULATIONTARGETS],
NMODULATIONTARGETS,
&parent->PExch[0],
&parent->PExModulationPrevVal[parent->polyIndex][parent->MODULATOR_attr_name_i1],
inlet_i1);
the interesting part is:
MODULATOR_attr_name_i1
MODULATOR_attr_name_ you always leave the same, as this is substituted with the name of the object instance when the patch is compiled, so you simply add your mod source as the suffix.
note: you can use whatever you like as a mod source name , it doesn't have to match any inlet/outlet etc... its just what you want to call it.
so here is my example:
(ive saved the following object in test/mods.axo)
mods.axo (1.4 KB)
modtest.axp (3.2 KB)
anyway, easy really , as is usually the case with axoloti
enjoy
TB
btw: Id recommend all questions etc are created as forum topics, so that the info is shared widely...
I tend to reserve PMs for personal questions or matters regarding forum moderation