single action punch in
[ardour.git] / scripts / s_track_props.lua
1 ardour { ["type"] = "Snippet", name = "Track Properties" }
2
3 function factory () return function ()
4         --- iterate over all tracks
5         for t in Session:get_tracks():iter() do
6                 -- t is-a http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Track
7
8                 -- operate one those with "Drum" in the name
9                 if  (t:name ():find ("Drum")) then
10
11                         -- print the name, and number of audio in/out
12                         -- see also http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:ChanCount
13                         print (t:name (), "| Audio In:", t:n_inputs ():n_audio (), "Audio Out:", t:n_outputs ():n_audio ())
14
15                         -- get the track's http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:PresentationInfo
16                         pi = t:presentation_info_ptr ()
17
18                         -- set the track's color to orange - hex RGBA
19                         pi:set_color (0xff8800ff)
20
21                         -- phase invert the 1st channel
22                         t:phase_control():set_phase_invert (1, true)
23
24                         -- solo the track  -- and only the track, 
25                         -- not other tracks grouped with it.
26                         t:solo_control():set_value (1, PBD.GroupControlDisposition.NoGroup)
27
28                         -- unmute the track
29                         t:mute_control():set_value (0, PBD.GroupControlDisposition.NoGroup)
30
31                         -- add a track comment
32                         t:set_comment ("This is a Drum Track", nil)
33
34                         -- and set the fader to -7dB  == 10 ^ (0.05 * -7)
35                         t:gain_control():set_value (10 ^ (0.05 * -7), PBD.GroupControlDisposition.NoGroup)
36                 end
37         end
38 end end