# (G) Mixer
# LABELS: master=18

# 

# INPUTS:
#  I2: [Duck]
#  I3: [Duck]

# CONTROLLER 1:
#  B1.1: [Mix] Main mixer
#  B1.2: [Out] Output mix
#  B1.3: [Headph] Headphone mix
#  B1.4: [Ducking]
#  B1.5: [Level out] Level out main mix
#  B1.7: [Load] Load preset
#  B1.8: [Save] Save preset
#  B1.9: [Fade] Fade in / out master
#  B1.10: [Mute all]
#  B1.11: [Mute Duck]
#  B1.12: [Refresh] Resend all MIDI CCs
#  B1.17: [MAG] All voices to Magneto
#  B1.18: [STA] All voices to Starlab
#  B1.19: [PHA] All voices to Phaser
#  B1.20: [REV] All voices to Reverb
#  B1.21: [TB] Tenor bass
#  B1.22: [LD] Lead voice
#  B1.23: [OR] Ornament voice
#  B1.24: [AR] Arpeggio voice
#  B1.25: [LB] Low bass
#  B1.26: [CH] Chords
#  B1.27: [DR] Hi-Drums
#  B1.28: [BD] Bass drumm
#  B1.29: [Effects]
#  B1.30: [Reverb]
#  B1.31: [SOLO] Solo current voice
#  B1.32: [MUTE]

[b32]
[m4]
[m4]

# -------------------------------------------------
# Fader mode
# -------------------------------------------------

[buttongroup]
    button1 = B1.1 # 0: Mix
    button2 = B1.2 # 1: Output
    button3 = B1.21 # 2: TB
    button4 = B1.22 # 3: LD
    button5 = B1.23 # 4: OR
    button6 = B1.24 # 5: AR
    button7 = B1.29 # 6: Effects
    button8 = B1.25 # 7: LB
    button9 = B1.26 # 8: Chords
    button10 = B1.27 # 9: Drums
    button11 = B1.28 # 10: BD
    button12 = B1.30 # 11: Reverb
    button13 = B1.4 # Ducking
    button14 = 0 # 13: LFO Bank (2)
    button15 = B1.3 # Phone mix
    button16 = B1.17 # Phone mix
    button17 = B1.18 # Phone mix
    button18 = B1.19 # Phone mix
    button19 = B1.20 # Phone mix
    select = _NO_MUTE_MODE
    buttonoutput13 = _FADERMODE_DUCKING
    extrapress = _VOICE_EXTRA_PRESS
    led1 = L1.1
    led2 = L1.2
    led3 = _TB_SELECTED
    led4 = _LD_SELECTED
    led5 = _OR_SELECTED
    led6 = _AR_SELECTED
    led7 = _EFFECTS_SELECTED
    led8 = _LB_SELECTED
    led9 = _CH_SELECTED
    led10 = _DR_SELECTED
    led11 = _BD_SELECTED
    led12 = _REVERB_SELECTED
#   led13 = L1.4
    led15 = L1.3
    led16 = L1.17
    led17 = L1.18
    led18 = L1.19
    led19 = L1.20
    output = _FADERMODE

[gatetool]
    inputgate = _VOICE_EXTRA_PRESS
    outputgate = _MUTE_EXTRA_BUTTON
    gatelength = 0.1

[lfo]
    hz = 4
    level = 1
    square = _MUTED_LFO

# Signal current state of channel in the following way:
#
# 1. not selected, not muted -> 0.3
# 2. not selected, muted -> blink (between 0.0 and 0.3)
# 3. selected, not muted -> steady (1.0)
# 4. selected, muted -> blink (between 0 and 1)
[switch]
    input1 = _MUTED_LFO * 0.3
    input2 = 0.3
    input3 = _MUTED_LFO * 1
    input4 = 1
    offset = _TB_SELECTED * 2 + _UNMUTE_TB
    output1 = L1.21

[switch]
    input1 = _MUTED_LFO * 0.3
    input2 = 0.3
    input3 = _MUTED_LFO * 1
    input4 = 1
    offset = _LB_SELECTED * 2 + _UNMUTE_LB
    output1 = L1.25

[switch]
    input1 = _MUTED_LFO * 0.3
    input2 = 0.3
    input3 = _MUTED_LFO * 1
    input4 = 1
    offset = _LD_SELECTED * 2 + _UNMUTE_LD
    output1 = L1.22

[switch]
    input1 = _MUTED_LFO * 0.3
    input2 = 0.3
    input3 = _MUTED_LFO * 1
    input4 = 1
    offset = _CH_SELECTED * 2 + _UNMUTE_CH
    output1 = L1.26

[switch]
    input1 = _MUTED_LFO * 0.3
    input2 = 0.3
    input3 = _MUTED_LFO * 1
    input4 = 1
    offset = _OR_SELECTED * 2 + _UNMUTE_OR
    output1 = L1.23

[switch]
    input1 = _MUTED_LFO * 0.3
    input2 = 0.3
    input3 = _MUTED_LFO * 1
    input4 = 1
    offset = _DR_SELECTED * 2 + _UNMUTE_DR
    output1 = L1.27

[switch]
    input1 = _MUTED_LFO * 0.3
    input2 = 0.3
    input3 = _MUTED_LFO * 1
    input4 = 1
    offset = _AR_SELECTED * 2 + _UNMUTE_AR
    output1 = L1.24

[switch]
    input1 = _MUTED_LFO * 0.3
    input2 = 0.3
    input3 = _MUTED_LFO * 1
    input4 = 1
    offset = _BD_SELECTED * 2 + _UNMUTE_BD
    output1 = L1.28

[switch]
    input1 = _MUTED_LFO * 0.3
    input2 = 0.3
    input3 = _MUTED_LFO * 1
    input4 = 1
    offset = _EFFECTS_SELECTED * 2 + _UNMUTE_EFFECTS
    output1 = L1.29

[switch]
    input1 = _MUTED_LFO * 0.3
    input2 = 0.3
    input3 = _MUTED_LFO * 1
    input4 = 1
    offset = _REVERB_SELECTED * 2 + _UNMUTE_REVERB
    output1 = L1.30

# -------------------------------------------------
# Mute button
# -------------------------------------------------

[button]
    button = B1.32 + _MUTE_EXTRA_BUTTON
    led = L1.32
    states = 1
    output = _MUTE_MODE
    inverted = _NO_MUTE_MODE

# -------------------------------------------------
# Presets
# -------------------------------------------------

[copy]
    input = 1
    output = _PRESET

[button]
    button = B1.7
    longpress = _LOADPRESET
    led = L1.7

[clocktool]
    clock = _LOADPRESET
    gatelength = 2 # sec
    output = _LOADPRESET_ANIM

[lfo]
    hz = 3
    level = _LOADPRESET_ANIM
    square = L1.7

[button]
    button = B1.8
    longpress = _SAVEPRESET

[clocktool]
    clock = _SAVEPRESET
    gatelength = 2 # sec
    output = _SAVEPRESET_ANIM

[lfo]
    hz = 3
    level = _SAVEPRESET_ANIM
    square = L1.8

# -------------------------------------------------
# Unmute + Solo logic
# -------------------------------------------------

[button]
    button = B1.10
    led = L1.10
    states = 1
    output = _MUTE_ALL

# Hidden buttongroup for selecting solo voice (uses the same
# buttons as the fader mode. That is indendet).
[buttongroup]
    select = _NO_MUTE_MODE
    button3 = B1.21 # 2: TB
    button4 = B1.22 # 3: LD
    button5 = B1.23 # 4: OR
    button6 = B1.24 # 5: AR
    button7 = B1.29 # 6: Effects
    button8 = B1.25 # 7: LB
    button9 = B1.26 # 8: Chords
    button10 = B1.27 # 9: Drums
    button11 = B1.28 # 10: BD
    button12 = B1.30 # 11: Reverb
    led3 = _SOLO_TB
    led4 = _SOLO_LD
    led5 = _SOLO_OR
    led6 = _SOLO_AR
    led7 = _SOLO_EFFECTS
    led8 = _SOLO_LB
    led9 = _SOLO_CH
    led10 = _SOLO_DR
    led11 = _SOLO_BD
    led12 = _SOLO_REVERB

# Toggle button for enabling SOLO
[button]
    button = B1.31
    output = _SOLO

[lfo]
    hz = 3
    level = _SOLO
    square = L1.31

# TB: Mute button sources
[mixer]
    input1 = B1.21 * _MUTE_MODE
    input2 = B1.21 * _MUTE_EXTRA_BUTTON
    input3 = B2.1 * _MIXING_MODE
    output = _TB_TOGGLE_MUTE

# TB: Mute state
[button]
    button = _TB_TOGGLE_MUTE
    clear = _MUTE_ALL
    output = _UNMUTE_BUTTON_TB

# TB: Solo logic
[switch]
    offset = _SOLO
    input1 = _UNMUTE_BUTTON_TB
    input2 = _SOLO_TB
    output1 = _UNMUTE_TB

# LD: Mute button sources
[mixer]
    input1 = B1.22 * _MUTE_MODE
    input2 = B1.22 * _MUTE_EXTRA_BUTTON
    input3 = B2.2 * _MIXING_MODE
    output = _LD_TOGGLE_MUTE

# LD: Mute state
[button]
    button = _LD_TOGGLE_MUTE
    clear = _MUTE_ALL
    output = _UNMUTE_BUTTON_LD

# LD: Solo logic
[switch]
    offset = _SOLO
    input1 = _UNMUTE_BUTTON_LD
    input2 = _SOLO_LD
    output1 = _UNMUTE_LD

# OR: Mute button sources
[mixer]
    input1 = B1.23 * _MUTE_MODE
    input2 = B1.23 * _MUTE_EXTRA_BUTTON
    input3 = B2.3 * _MIXING_MODE
    output = _OR_TOGGLE_MUTE

# OR: Mute state
[button]
    button = _OR_TOGGLE_MUTE
    clear = _MUTE_ALL
    output = _UNMUTE_BUTTON_OR

# OR: Solo logic
[switch]
    offset = _SOLO
    input1 = _UNMUTE_BUTTON_OR
    input2 = _SOLO_OR
    output1 = _UNMUTE_OR

# AR: Mute button sources
[mixer]
    input1 = B1.24 * _MUTE_MODE
    input2 = B1.24 * _MUTE_EXTRA_BUTTON
    input3 = B2.4 * _MIXING_MODE
    output = _AR_TOGGLE_MUTE

# AR: Mute state
[button]
    button = _AR_TOGGLE_MUTE
    clear = _MUTE_ALL
    output = _UNMUTE_BUTTON_AR

# AR: Solo logic
[switch]
    offset = _SOLO
    input1 = _UNMUTE_BUTTON_AR
    input2 = _SOLO_AR
    output1 = _UNMUTE_AR

# LB: Mute button sources
[mixer]
    input1 = B1.25 * _MUTE_MODE
    input2 = B1.25 * _MUTE_EXTRA_BUTTON
    input3 = B3.1 * _MIXING_MODE
    output = _LB_TOGGLE_MUTE

# LB: Mute state
[button]
    button = _LB_TOGGLE_MUTE
    clear = _MUTE_ALL
    output = _UNMUTE_BUTTON_LB

# LB: Solo logic
[switch]
    offset = _SOLO
    input1 = _UNMUTE_BUTTON_LB
    input2 = _SOLO_LB
    output1 = _UNMUTE_LB

# CH: Mute button sources
[mixer]
    input1 = B1.26 * _MUTE_MODE
    input2 = B1.26 * _MUTE_EXTRA_BUTTON
    input3 = B3.2 * _MIXING_MODE
    output = _CH_TOGGLE_MUTE

# CH: Mute state
[button]
    button = _CH_TOGGLE_MUTE
    clear = _MUTE_ALL
    output = _UNMUTE_BUTTON_CH

# CH: Solo logic
[switch]
    offset = _SOLO
    input1 = _UNMUTE_BUTTON_CH
    input2 = _SOLO_CH
    output1 = _UNMUTE_CH

# DR: Mute button sources
[mixer]
    input1 = B1.27 * _MUTE_MODE
    input2 = B1.27 * _MUTE_EXTRA_BUTTON
    input3 = B3.3 * _MIXING_MODE
    output = _DR_TOGGLE_MUTE

# DR: Mute state
[button]
    button = _DR_TOGGLE_MUTE
    clear = _MUTE_ALL
    output = _UNMUTE_BUTTON_DR

# DR: Solo logic
[switch]
    offset = _SOLO
    input1 = _UNMUTE_BUTTON_DR
    input2 = _SOLO_DR
    output1 = _UNMUTE_DR

# DB: Mute button sources
[mixer]
    input1 = B1.28 * _MUTE_MODE
    input2 = B1.28 * _MUTE_EXTRA_BUTTON
    input3 = B3.4 * _MIXING_MODE
    output = _BD_TOGGLE_MUTE

# DB: Mute state
[button]
    button = _BD_TOGGLE_MUTE
    clear = _MUTE_ALL
    output = _UNMUTE_BUTTON_BD

# DB: Solo logic
[switch]
    offset = _SOLO
    input1 = _UNMUTE_BUTTON_BD
    input2 = _SOLO_BD
    output1 = _UNMUTE_BD

[button]
    select = _MUTE_MODE
    button = B1.29
    led = L1.29
    output = _UNMUTE_BUTTON_EFFECTS

[switch]
    offset = _SOLO
    input1 = _UNMUTE_BUTTON_EFFECTS
    input2 = _SOLO_EFFECTS
    output1 = _UNMUTE_EFFECTS

[button]
    select = _MUTE_MODE
    button = B1.30
    led = L1.30
    output = _UNMUTE_BUTTON_REVERB

[switch]
    offset = _SOLO
    input1 = _UNMUTE_BUTTON_REVERB
    input2 = _SOLO_REVERB
    output1 = _UNMUTE_REVERB

# -------------------------------------------------
# Calibration of gain via B1.11
# -------------------------------------------------

[copy]
    input = B1.5
    output = _GAIN_RESET

[copy]
    input = 0.7
    output = _NORM_LEVEL

[math]
    input1 = _GAIN_INPUT_TB * _MAIN_INPUT_TB
    input2 = _NORM_LEVEL
    quotient = _CALIBRATE_TB

[math]
    input1 = _GAIN_INPUT_LD * _MAIN_INPUT_LD
    input2 = _NORM_LEVEL
    quotient = _CALIBRATE_LD

[math]
    input1 = _GAIN_INPUT_OR * _MAIN_INPUT_OR
    input2 = _NORM_LEVEL
    quotient = _CALIBRATE_OR

[math]
    input1 = _GAIN_INPUT_AR * _MAIN_INPUT_AR
    input2 = _NORM_LEVEL
    quotient = _CALIBRATE_AR

[math]
    input1 = _GAIN_INPUT_LB * _MAIN_INPUT_LB
    input2 = _NORM_LEVEL
    quotient = _CALIBRATE_LB

[math]
    input1 = _GAIN_INPUT_CH * _MAIN_INPUT_CH
    input2 = _NORM_LEVEL
    quotient = _CALIBRATE_CH

[math]
    input1 = _GAIN_INPUT_DR * _MAIN_INPUT_DR
    input2 = _NORM_LEVEL
    quotient = _CALIBRATE_DR

[math]
    input1 = _GAIN_INPUT_BD * _MAIN_INPUT_BD
    input2 = _NORM_LEVEL
    quotient = _CALIBRATE_BD

# -------------------------------------------------
# Button for fading out the main volume (end of show)
# -------------------------------------------------

[button]
    button = B1.9
    led = _FADE_LED
    output = _FADE_TARGET

[lfo]
    hz = 3
    output = _FADE_BLINK

[logic]
    input1 = _FADE_LED
    input2 = _FADE_BLINK
    or = L1.9

[slew]
    input = _FADE_TARGET
    linear = _FADE_LEVEL
    slewup = 0.1
    slewdown = 1.5 # 15 seconds

# -------------------------------------------------
# Outputs
# -------------------------------------------------

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 1
    output = _OUTPUT_MAIN
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 1
    output = _OUTPUT_PHONES
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 1
    notches = 1

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 1
    notches = 1

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 1
    output = _OUTPUT_MAGNETO
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 1
    output = _OUTPUT_STARLAB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 1
    output = _OUTPUT_ZDSP
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 1
    output = _OUTPUT_REVERB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

# -------------------------------------------------
# Drill down for TB
# -------------------------------------------------

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 0
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _NORM_LEVEL

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 2
    output = _MAIN_INPUT_TB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _NORM_LEVEL

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 14
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 2
    output = _PHONES_INPUT_TB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 2
    notches = 2
    output = _POSTFADER_INPUT_TB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 2
    output = _GAIN_INPUT_TB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _CALIBRATE_TB

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 15
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 2
    output = _MAGNETO_INPUT_TB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 16
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 2
    output = _STARLAB_INPUT_TB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 17
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 2
    output = _PHASER_INPUT_TB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 18
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 2
    output = _REVERB_INPUT_TB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

# -------------------------------------------------
# Drill down for LD
# -------------------------------------------------

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 0
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _NORM_LEVEL

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 3
    output = _MAIN_INPUT_LD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    startvalue = _NORM_LEVEL
    clear = _GAIN_RESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 14
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 3
    output = _PHONES_INPUT_LD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 3
    notches = 2
    output = _POSTFADER_INPUT_LD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 3
    output = _GAIN_INPUT_LD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _CALIBRATE_LD

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 15
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 3
    output = _MAGNETO_INPUT_LD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 16
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 3
    output = _STARLAB_INPUT_LD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 17
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 3
    output = _PHASER_INPUT_LD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 18
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 3
    output = _REVERB_INPUT_LD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

# -------------------------------------------------
# Drill down for OR
# -------------------------------------------------

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 0
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _NORM_LEVEL

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 4
    output = _MAIN_INPUT_OR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    startvalue = _NORM_LEVEL
    clear = _GAIN_RESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 14
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 4
    output = _PHONES_INPUT_OR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 4
    notches = 2
    output = _POSTFADER_INPUT_OR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 4
    output = _GAIN_INPUT_OR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _CALIBRATE_OR

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 15
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 4
    output = _MAGNETO_INPUT_OR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 16
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 4
    output = _STARLAB_INPUT_OR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 17
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 4
    output = _PHASER_INPUT_OR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 18
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 4
    output = _REVERB_INPUT_OR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

# -------------------------------------------------
# Drill down for AR
# -------------------------------------------------

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 0
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _NORM_LEVEL

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 5
    output = _MAIN_INPUT_AR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _NORM_LEVEL

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 14
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 5
    output = _PHONES_INPUT_AR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 5
    notches = 2
    output = _POSTFADER_INPUT_AR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 5
    output = _GAIN_INPUT_AR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _CALIBRATE_AR

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 15
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 5
    output = _MAGNETO_INPUT_AR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 16
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 5
    output = _STARLAB_INPUT_AR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 17
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 5
    output = _PHASER_INPUT_AR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 18
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 5
    output = _REVERB_INPUT_AR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

# -------------------------------------------------
# Drill down for LB
# -------------------------------------------------

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 0
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _NORM_LEVEL

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 7
    output = _MAIN_INPUT_LB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    startvalue = _NORM_LEVEL
    clear = _GAIN_RESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 14
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 7
    output = _PHONES_INPUT_LB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 7
    notches = 2
    output = _POSTFADER_INPUT_LB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 7
    output = _GAIN_INPUT_LB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    startvalue = _CALIBRATE_LB
    clear = _GAIN_RESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 15
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 7
    output = _MAGNETO_INPUT_LB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 16
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 7
    output = _STARLAB_INPUT_LB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 17
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 7
    output = _PHASER_INPUT_LB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 18
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 7
    output = _REVERB_INPUT_LB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

# -------------------------------------------------
# Drill down for CHORDS
# -------------------------------------------------

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 0
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _NORM_LEVEL

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 8
    output = _MAIN_INPUT_CH
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    startvalue = _NORM_LEVEL
    clear = _GAIN_RESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 14
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 8
    output = _PHONES_INPUT_CH
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 8
    notches = 2
    output = _POSTFADER_INPUT_CH
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 8
    output = _GAIN_INPUT_CH
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _CALIBRATE_CH

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 15
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 8
    output = _MAGNETO_INPUT_CH
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 16
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 8
    output = _STARLAB_INPUT_CH
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 17
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 8
    output = _PHASER_INPUT_CH
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 18
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 8
    output = _REVERB_INPUT_CH
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

# -------------------------------------------------
# Drill down for DRUMS
# -------------------------------------------------

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 0
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _NORM_LEVEL

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 9
    output = _MAIN_INPUT_DR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    startvalue = _NORM_LEVEL
    clear = _GAIN_RESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 14
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 9
    output = _PHONES_INPUT_DR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 9
    notches = 2
    output = _POSTFADER_INPUT_DR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 9
    output = _GAIN_INPUT_DR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _CALIBRATE_DR

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 15
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 9
    output = _MAGNETO_INPUT_DR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 16
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 9
    output = _STARLAB_INPUT_DR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 17
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 9
    output = _PHASER_INPUT_DR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 18
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 9
    output = _REVERB_INPUT_DR
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

# -------------------------------------------------
# Drill down for BD
# -------------------------------------------------

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 0
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _NORM_LEVEL

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 10
    output = _MAIN_INPUT_BD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    startvalue = _NORM_LEVEL
    clear = _GAIN_RESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 14
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 10
    output = _PHONES_INPUT_BD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 10
    notches = 2
    output = _POSTFADER_INPUT_BD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 10
    output = _GAIN_INPUT_BD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET
    clear = _GAIN_RESET
    startvalue = _CALIBRATE_BD

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 15
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 10
    output = _MAGNETO_INPUT_BD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 16
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 10
    output = _STARLAB_INPUT_BD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 17
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 10
    output = _PHASER_INPUT_BD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 18
    sharewithnext = 1
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 10
    output = _REVERB_INPUT_BD
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

# -------------------------------------------------
# Drill down for Effects return
# -------------------------------------------------

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 6
    output = _MAIN_INPUT_EFFECTS
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 6
    output = _PHONES_INPUT_EFFECTS
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 6
    notches = 1

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 6
    notches = 1

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 6
    notches = 1

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 6
    notches = 1

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 6
    notches = 1

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 6
    output = _REVERB_INPUT_EFFECTS
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

# -------------------------------------------------
# Drill down for Reverb return
# -------------------------------------------------

[motorfader]
    fader = 1
    select = _FADERMODE
    selectat = 11
    output = _MAIN_INPUT_REVERB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 2
    select = _FADERMODE
    selectat = 11
    output = _PHONES_INPUT_REVERB
    preset = _PRESET
    loadpreset = _LOADPRESET
    savepreset = _SAVEPRESET

[motorfader]
    fader = 3
    select = _FADERMODE
    selectat = 11
    notches = 1

[motorfader]
    fader = 4
    select = _FADERMODE
    selectat = 11
    notches = 1

[motorfader]
    fader = 5
    select = _FADERMODE
    selectat = 11
    notches = 1

[motorfader]
    fader = 6
    select = _FADERMODE
    selectat = 11
    notches = 1

[motorfader]
    fader = 7
    select = _FADERMODE
    selectat = 11
    notches = 1

[motorfader]
    fader = 8
    select = _FADERMODE
    selectat = 11
    notches = 1

# -------------------------------------------------
# Ducking
# -------------------------------------------------

[button]
    button = B1.11
    led = L1.11
    inverted = _DUCKING_UNMUTED

[faderbank]
    firstfader = 1
    select = _FADERMODE_DUCKING
    output1 = _DUCK_HOLD
    output2 = _DUCK_RELEASE
    output3 = _DUCK_SHAPE

[contour]
    trigger = I2 * _DUCKING_UNMUTED
    attack = 0
    release = _DUCK_RELEASE * 0.3
    hold = _DUCK_HOLD
    shape = _DUCK_SHAPE
    output = _DUCKING
    level = -1

# The second M4 controls the amount of ducking for four different output channels.
[faderbank]
    select = _FADERMODE_DUCKING
    firstfader = 5
    output1 = _DUCK_BASS
    output2 = _DUCH_CH
    output3 = _DUCK_EFFECTS
    output4 = _DUCK_REVERB

[math]
    input1 = _GAIN_INPUT_TB * _MAIN_INPUT_TB
    input2 = _DUCK_BASS * _DUCKING + 1
    product = _VOLUME_TB

[math]
    input1 = _GAIN_INPUT_LB * _MAIN_INPUT_LB
    input2 = _DUCK_BASS * _DUCKING + 1
    product = _VOLUME_LB

[math]
    input1 = _GAIN_INPUT_CH * _MAIN_INPUT_CH
    input2 = _DUCH_CH * _DUCKING + 1
    product = _VOLUME_CH

[math]
    input1 = _MAIN_INPUT_REVERB
    input2 = _DUCK_REVERB * _DUCKING + 1
    product = _VOLUME_REVERB

[math]
    input1 = _MAIN_INPUT_EFFECTS
    input2 = _DUCK_EFFECTS * _DUCKING + 1
    product = _VOLUME_EFFECTS

[copy]
    input = _DUCKING
    output = L1.4

# [copy]
#   input = _DUCK_BASS * _DUCKING + 1
#   output = L3.1

# [copy]
#   input = _DUCH_CH * _DUCKING + 1
#   output = L3.2

# [copy]
#   input = _DUCK_EFFECTS * _DUCKING + 1
#   output = L3.3

# [copy]
#   input = _DUCK_REVERB * _DUCKING + 1
#   output = L3.4

# -------------------------------------------------
# Fireface MIDI driver
# Output numbers (Stereo outs use two numbers)
# 1: Main
# 3: Magneto
# 5: Starlab
# 7: Z-DSP
# 9: Phones
# 11: Reverb (Bricasti)
# 
# Input numbers (Stereo inputs use two numbers)
# 1: Effects
# 3: LB: Low bass
# 4: BD: Bass drum
# 5: Drums
# 7: Chords
# 9: TB: Tenor bass
# 10: LD: Lead voice
# 11: OR: Ornamental voice
# 12: AR: Arpeggio voice
# 13: Reverb (Bricasti)
# -------------------------------------------------

[copy]
    input = B1.12
    output = _FORCE_UPDATE

[lfo]
    hz = 1
    level = 1 / 126
    square = _FEEDBACK_AVOID_LFO

[firefacecontrol]
    outputlevel1 = _OUTPUT_MAIN * _FADE_LEVEL
    outputlevel3 = _OUTPUT_MAGNETO
    outputlevel5 = _OUTPUT_STARLAB
    outputlevel7 = _OUTPUT_ZDSP
    outputlevel9 = _OUTPUT_PHONES
    outputlevel11 = _OUTPUT_REVERB
    outputmix1in1 = _VOLUME_EFFECTS
    outputmix1in3 = _VOLUME_LB
    outputmix1in4 = _GAIN_INPUT_BD * _MAIN_INPUT_BD
    outputmix1in5 = _GAIN_INPUT_DR * _MAIN_INPUT_DR
    outputmix1in7 = _VOLUME_CH
    outputmix1in9 = _VOLUME_TB
    outputmix1in10 = _GAIN_INPUT_LD * _MAIN_INPUT_LD
    outputmix1in11 = _GAIN_INPUT_OR * _MAIN_INPUT_OR
    outputmix1in12 = _GAIN_INPUT_AR * _MAIN_INPUT_AR
    outputmix1in13 = _VOLUME_REVERB
    outputmix3in1 = 0
    outputmix3in3 = _MAGNETO_INPUT_LB
    outputmix3in4 = _MAGNETO_INPUT_BD
    outputmix3in5 = _MAGNETO_INPUT_DR
    outputmix3in7 = _MAGNETO_INPUT_CH
    outputmix3in9 = _MAGNETO_INPUT_TB
    outputmix3in10 = _MAGNETO_INPUT_LD
    outputmix3in11 = _MAGNETO_INPUT_OR
    outputmix3in12 = _MAGNETO_INPUT_AR
    outputmix3in13 = _FEEDBACK_AVOID_LFO
    outputmix5in1 = 0
    outputmix5in3 = _STARLAB_INPUT_LB
    outputmix5in4 = _STARLAB_INPUT_BD
    outputmix5in5 = _STARLAB_INPUT_DR
    outputmix5in7 = _STARLAB_INPUT_CH
    outputmix5in9 = _STARLAB_INPUT_TB
    outputmix5in10 = _STARLAB_INPUT_LD
    outputmix5in11 = _STARLAB_INPUT_OR
    outputmix5in12 = _STARLAB_INPUT_AR
    outputmix5in13 = _FEEDBACK_AVOID_LFO
    outputmix7in3 = _PHASER_INPUT_LB
    outputmix7in4 = _PHASER_INPUT_BD
    outputmix7in5 = _PHASER_INPUT_DR
    outputmix7in7 = _PHASER_INPUT_CH
    outputmix7in9 = _PHASER_INPUT_TB
    outputmix7in10 = _PHASER_INPUT_LD
    outputmix7in11 = _PHASER_INPUT_OR
    outputmix7in12 = _PHASER_INPUT_AR
    outputmix9in1 = _PHONES_INPUT_EFFECTS
    outputmix9in3 = _GAIN_INPUT_LB * _PHONES_INPUT_LB
    outputmix9in4 = _GAIN_INPUT_DR * _PHONES_INPUT_BD
    outputmix9in5 = _GAIN_INPUT_BD * _PHONES_INPUT_DR
    outputmix9in7 = _GAIN_INPUT_CH * _PHONES_INPUT_CH
    outputmix9in9 = _GAIN_INPUT_TB * _PHONES_INPUT_TB
    outputmix9in10 = _GAIN_INPUT_LD * _PHONES_INPUT_LD
    outputmix9in11 = _GAIN_INPUT_OR * _PHONES_INPUT_OR
    outputmix9in12 = _GAIN_INPUT_AR * _PHONES_INPUT_AR
    outputmix9in13 = _PHONES_INPUT_REVERB
    outputmix11in1 = _REVERB_INPUT_EFFECTS
    outputmix11in3 = _REVERB_INPUT_LB
    outputmix11in4 = _REVERB_INPUT_BD
    outputmix11in5 = _REVERB_INPUT_DR
    outputmix11in7 = _REVERB_INPUT_CH
    outputmix11in9 = _REVERB_INPUT_TB
    outputmix11in10 = _REVERB_INPUT_LD
    outputmix11in11 = _REVERB_INPUT_OR
    outputmix11in12 = _REVERB_INPUT_AR
    outputmix11in13 = _FEEDBACK_AVOID_LFO
    phonesoutput1 = 9
    postfader3 = -1 * _POSTFADER_INPUT_LB + 1
    postfader4 = -1 * _POSTFADER_INPUT_BD + 1
    postfader5 = -1 * _POSTFADER_INPUT_DR + 1
    postfader7 = -1 * _POSTFADER_INPUT_CH + 1
    postfader9 = -1 * _POSTFADER_INPUT_TB + 1
    postfader10 = -1 * _POSTFADER_INPUT_LD + 1
    postfader11 = -1 * _POSTFADER_INPUT_OR + 1
    postfader12 = -1 * _POSTFADER_INPUT_AR + 1
    unmute1 = _UNMUTE_EFFECTS
    unmute3 = _UNMUTE_LB
    unmute4 = _UNMUTE_BD
    unmute5 = _UNMUTE_DR
    unmute7 = _UNMUTE_CH
    unmute9 = _UNMUTE_TB
    unmute10 = _UNMUTE_LD
    unmute11 = _UNMUTE_OR
    unmute12 = _UNMUTE_AR
    unmute13 = _UNMUTE_REVERB
    update = _FORCE_UPDATE

# -------------------------------------------------
# Tuner
# -------------------------------------------------

[vcotuner]
    tuningnote = 0
    ledflat = _FLAT
    ledsharp = _SHARP
    intune = _INTUNE
    vcofound = _VCOFOUND

[copy]
    input = _VCOFOUND * -1 + 1
    output = _NO_VCO_FOUND

[select]
    input = _FLAT
    select = _VCOFOUND
    output = L2.1

[select]
    input = 0.8
    select = _VCOFOUND
    output = R2.1

[select]
    input = _INTUNE
    select = _VCOFOUND
    output = L2.2

[select]
    input = 0.4
    select = _VCOFOUND
    output = R2.2

[select]
    input = _SHARP
    select = _VCOFOUND
    output = L2.3

[select]
    input = 0.8
    select = _VCOFOUND
    output = R2.3

# -------------------------------------------------
# LEDs in mixing mode
# -------------------------------------------------

[mixer]
    input1 = L1.1
    input2 = L1.3
    input3 = L1.17
    input4 = L1.18
    input5 = L1.19
    input6 = L1.20
    output = _SOME_MIX

[copy]
    input = _NO_VCO_FOUND * _SOME_MIX
    output = _MIXING_MODE

[select]
    input = L1.21
    output = L2.1
    select = _MIXING_MODE

[select]
    input = 1.2
    output = R2.1
    select = _MIXING_MODE

[select]
    input = L1.22 + 0.1
    output = L2.2
    select = _MIXING_MODE

[select]
    input = 0.4
    output = R2.2
    select = _MIXING_MODE

[select]
    input = L1.23 + 0.1
    output = L2.3
    select = _MIXING_MODE

[select]
    input = 0.6
    output = R2.3
    select = _MIXING_MODE

[select]
    input = L1.24 + 0.1
    output = L2.4
    select = _MIXING_MODE

[select]
    input = 0.8
    output = R2.4
    select = _MIXING_MODE

[select]
    input = L1.25 + 0.1
    output = L3.1
    select = _MIXING_MODE

[select]
    input = 1.05
    output = R3.1
    select = _MIXING_MODE

[select]
    input = L1.26 + 0.1
    output = L3.2
    select = _MIXING_MODE

[select]
    input = 0.1
    output = R3.2
    select = _MIXING_MODE

[select]
    input = L1.27 * 0.9 + 0.1
    output = L3.3
    select = _MIXING_MODE

[select]
    input = 0.7
    output = R3.3
    select = _MIXING_MODE

[select]
    input = L1.28 * 0.9 + 0.1
    output = L3.4
    select = _MIXING_MODE

[select]
    input = 0.7
    output = R3.4
    select = _MIXING_MODE

# -------------------------------------------------
# LEDs in other modes
# -------------------------------------------------

[logic]
    input1 = _NO_VCO_FOUND
    input2 = _MIXING_MODE * -1 + 1
    and = _OTHER_MODE

[select]
    input = 0
    output = L2.1
    select = _OTHER_MODE

[select]
    input = 0
    output = L2.2
    select = _OTHER_MODE

[select]
    input = 0
    output = L2.3
    select = _OTHER_MODE

[select]
    input = 0
    output = L2.4
    select = _OTHER_MODE

[select]
    input = 0
    output = L3.1
    select = _OTHER_MODE

[select]
    input = 0
    output = L3.2
    select = _OTHER_MODE

[select]
    input = 0
    output = L3.3
    select = _OTHER_MODE

[select]
    input = 0
    output = L3.4
    select = _OTHER_MODE
