Page tree
Skip to end of metadata
Go to start of metadata

setSource1(source, sourceInfo1, sourceInfo2)

Description

Function to set the 1st modulation source of a row in the modulation matrix. The row is specified with the Zone object of the zone and the index of the modulation matrix row.

Available in: Controller.

Arguments

sourceThe modulation source. It can be determined via names or indices. See Modulation Source Types for details. Standard modulation sources like the LFOs or the envelopes can be set directly. Special modulation sources like MIDI controllers or MIDI modules can only be set by also specifiying sourceInfo1 and sourceInfo2.enum or number
sourceInfo1Optional argument to specify the MIDI controller number or the MIDI module, for example. See example for details.number or MidiModule, optional
sourceInfo2Optional argument to select the modulation output of a MIDI module, for example. See example for details.number, optional

Example

-- define the modulation sources and infos in an array
modSources = {
    { source = ModulationSource.lfo1, bipolar = 1 },
    { source = ModulationSource.midiControl, bipolar = 0, sourceInfo1 = 1 },
    { source = ModulationSource.quickControl, bipolar = 1, sourceInfo1 = this.program, sourceInfo2 = 1 },
    { source = ModulationSource.modulationModule, bipolar = 0, sourceInfo1 = this, sourceInfo2 = 1 },
    { source = ModulationSource.modulationModule, bipolar = 0, sourceInfo1 = this, sourceInfo2 = 2 },
    { source = ModulationSource.noteExpression, bipolar = 0, sourceInfo1 = 1 }
}

-- define two modulation outputs for the script module
defineModulation("50%", false)
defineModulation("100%", false)

-- calculate the modulation outputs
function calcModulation()
    return 0.5, 1
end

-- get the element object of the first zone
zone = this.program:findZones(true)[1]

-- assign the modulation sources to source 1 in the modulation rows 1 to 6
for i=1, #modSources do
    local modRow = zone:getModulationMatrixRow(i)
    modRow:setSource1(modSources[i].source, modSources[i].sourceInfo1, modSources[i].sourceInfo2)
    modRow:setParameter("Source1.Polarity", modSources[i].bipolar) -- set the default polarity of the source
end

-- assign the sample & hold to source 2 in modulation row 1
modRow = zone:getModulationMatrixRow(1)
modRow:setSource2(ModulationSource.sampleAndHold, 0)

 

1 Comment