Only show user-presets in favorite sidebar
[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, not other tracks grouped with it.
25                         --
26                         -- Note that changing solo/mute needs to propagate implicit solo/mute.
27                         -- These changes have to be done atomically, so that all
28                         -- related solo/mute change simultaneously at the same time.
29                         -- This can only be done from realtime-context, so we need to queue a session-rt
30                         -- event using the session realtime-event dispatch mechanism:
31                         Session:set_control (t:solo_control(), 1, PBD.GroupControlDisposition.NoGroup)
32
33                         -- unmute the track, this also examplifies how one could use lists to modify
34                         -- multiple controllables at the same time (they should be of the same
35                         -- paramater type - e.g. mute_control() of multiple tracks, they'll all
36                         -- change simultaneously in rt-context)
37                         local ctrls = ARDOUR.ControlListPtr ()
38                         ctrls:push_back (t:mute_control()) -- we could add more controls to change via push_back
39                         Session:set_controls (ctrls, 0, PBD.GroupControlDisposition.NoGroup)
40
41                         -- add a track comment
42                         t:set_comment ("This is a Drum Track", nil)
43
44                         -- and set the fader to -7dB  == 10 ^ (0.05 * -7)
45                         t:gain_control():set_value (10 ^ (0.05 * -7), PBD.GroupControlDisposition.NoGroup)
46                 end
47         end
48 end end