use const
[ardour.git] / scripts / faders_to_trims.lua
index 2d0ed44cae33bb108510951d8723b354154d289e..3fd62833f2619fab422c2d1da45cedab8d65a184 100644 (file)
@@ -19,6 +19,16 @@ function factory (params)
                for t in Session:get_tracks():iter() do
                        
                        fader_value = t:gain_control():get_value()
+                       if fader_value == 1 then
+                               goto skip
+                       end
+                       if t:gain_control():automation_state() ~= ARDOUR.AutoState.Off then
+                               goto skip
+                       end
+
+                       -- TODO: skip MIDI tracks without or with a post-fader synth
+                       -- (fader is MIDI-velocity)
+
                        v = math.log(fader_value, 10)
                        trim_gain = 20*v
                        fader_pos = 0
@@ -53,6 +63,8 @@ function factory (params)
                        --zero the fader gain
                        t:gain_control():set_value(1, PBD.GroupControlDisposition.NoGroup)
 
+                       ::skip::
+
                end --foreach track
 
        end  --function