Clean up create drum-tracks script (no global variables)
[ardour.git] / scripts / create_drum_tracks.lua
1 ardour {\r
2         ["type"] = "EditorAction",\r
3         name = "Create Drum Tracks",\r
4         author = "PSmith",\r
5         description = [[Creates 8 new tracks with representative names and colors.]]\r
6 }\r
7 \r
8 function factory () return function ()\r
9 \r
10                 local names = {\r
11                         "Kick",\r
12                         "Snare",\r
13                         "Hat",\r
14                         "Fl Tom",\r
15                         "OH L",\r
16                         "OH R",\r
17                         "Room 1",\r
18                         "Room 2"\r
19                 }\r
20 \r
21                 local color = 0xff8800ff  --orange\r
22 \r
23                 local i = 1\r
24                 while names[i] do\r
25                         local tl = Session:new_audio_track (1, 2, nil, 1, names[i],\r
26                                                             ARDOUR.PresentationInfo.max_order,\r
27                                                             ARDOUR.TrackMode.Normal)\r
28 \r
29                         for track in tl:iter () do\r
30                                 track:presentation_info_ptr ():set_color (color)\r
31                         end\r
32 \r
33                         i = i + 1\r
34                 end --foreach track\r
35 \r
36 end end -- function factory\r