TrackClips190neTests.inc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. // Round 190ne (LYNX 0.1.31): track clips, "Clips own their notes" on FL's instrument tracks (core/TrackClips.h; design A
  2. // of round 190nd). The .lynx round trip, the engine's automatic deletion in one undo step and the copy for 0.1.28 are
  3. // checked in the app's --selftest ("trackclips190ne"): they need the engine and ProjectFile.
  4. #include "core/AlsExport.h"
  5. #include "core/AlsImport.h"
  6. #include "core/EditorPolish.h"
  7. #include "core/FlpExport.h"
  8. #include "core/LayoutStyle.h"
  9. #include "core/RackOps.h"
  10. #include "core/SessionOps.h"
  11. #include "core/TrackClips.h"
  12. namespace trackclips190ne
  13. {
  14. // Patterns 0 ("Drums", ordinary) and 1 ("Chords", ordinary); channel 0 "Lead" on instrument track 1 with its clips owning
  15. // their notes; no clip yet
  16. inline lynx::Song song()
  17. {
  18. using namespace lynx;
  19. Song s;
  20. s.mixer = Song::defaultMixer (8);
  21. s.patterns.resize (2);
  22. s.patterns[0].name = "Drums";
  23. s.patterns[1].name = "Chords";
  24. ChannelDef lead;
  25. lead.name = "Lead";
  26. lead.colour = 0xFFE5383Bu;
  27. s.channels.push_back (lead);
  28. trackmodes::makeInstrumentTrack (s, 1, 0);
  29. trackclips::setOwnClips (s, 1, true);
  30. return s;
  31. }
  32. inline lynx::Clip clipOf (int pattern, int track, std::int64_t start, std::int64_t length = 4 * lynx::ppq)
  33. {
  34. lynx::Clip c;
  35. c.pattern = pattern;
  36. c.track = track;
  37. c.start = start;
  38. c.length = length;
  39. return c;
  40. }
  41. inline lynx::Note noteOf (int channel, int key, std::int64_t start)
  42. {
  43. lynx::Note n;
  44. n.channel = channel;
  45. n.key = key;
  46. n.start = start;
  47. n.length = lynx::ppq / 2;
  48. return n;
  49. }
  50. inline int patternsNamed (const lynx::Song& s, const std::string& name)
  51. {
  52. return (int) std::count_if (s.patterns.begin(), s.patterns.end(), [&name] (const lynx::Pattern& p) { return p.name == name; });
  53. }
  54. } // namespace trackclips190ne
  55. // The switch's default follows the layout a new instrument track is made in (owner decision: off in the Pattern layout,
  56. // FL's own instrument track; on in Clip-launch and Simple); an existing instrument track keeps its switch
  57. TEST (trackclips190ne_switch_default_per_layout)
  58. {
  59. using namespace lynx;
  60. const auto before = layoutstyle::current();
  61. Song s;
  62. s.mixer = Song::defaultMixer (8);
  63. for (int c = 0; c < 4; ++c)
  64. s.channels.emplace_back().name = "Synth " + std::to_string (c + 1);
  65. layoutstyle::setCurrent (layoutstyle::Style::pattern);
  66. CHECK (trackmodes::makeInstrumentTrack (s, 0, 0));
  67. CHECK (! s.playlistTracks[0].ownClips && ! trackclips::owns (s, 0));
  68. layoutstyle::setCurrent (layoutstyle::Style::clipLaunch);
  69. CHECK (trackmodes::makeInstrumentTrack (s, 1, 1));
  70. CHECK (s.playlistTracks[1].ownClips && trackclips::owns (s, 1));
  71. layoutstyle::setCurrent (layoutstyle::Style::simple);
  72. CHECK (trackmodes::makeInstrumentTrack (s, 2, 2));
  73. CHECK (trackclips::owns (s, 2));
  74. // another channel on an instrument track: the track keeps its switch (Pattern layout or not)
  75. layoutstyle::setCurrent (layoutstyle::Style::pattern);
  76. CHECK (trackmodes::makeInstrumentTrack (s, 2, 3));
  77. CHECK (trackclips::owns (s, 2));
  78. // only an instrument track owns clips: unassigned, the switch means nothing
  79. trackmodes::unassign (s, 2);
  80. CHECK (! trackclips::owns (s, 2));
  81. layoutstyle::setCurrent (before);
  82. }
  83. // A new clip: an empty track clip named and coloured after the track, as long as asked; out of the pattern selector
  84. // unless shown; F4 / Numpad +/- / the selector's wheel never land on one
  85. TEST (trackclips190ne_new_clip_and_the_pattern_selector)
  86. {
  87. using namespace lynx;
  88. auto s = trackclips190ne::song();
  89. const auto a = trackclips::newClip (s, 1, 2 * s.barTicks());
  90. const auto b = trackclips::newClip (s, 1, s.barTicks());
  91. CHECK (a == 2 && b == 3);
  92. CHECK (s.patterns[2].name == "Lead \xC2\xB7 clip 1" && s.patterns[3].name == "Lead \xC2\xB7 clip 2");
  93. CHECK (s.patterns[2].trackClip && s.patterns[2].colour == 0xFFE5383Bu && s.patterns[2].lengthTicks == 2 * s.barTicks());
  94. CHECK (s.patterns[2].notes.empty() && s.patterns[2].uid == 0);
  95. CHECK (trackclips::count (s) == 2 && trackclips::isTrackClip (s, 3) && ! trackclips::isTrackClip (s, 1) && ! trackclips::isTrackClip (s, 9));
  96. // a track with its own name names its clips
  97. s.playlistTracks[1].name = "Hook";
  98. CHECK (trackclips::newClipName (s, 1) == "Hook \xC2\xB7 clip 1");
  99. CHECK (trackclips::trackLabel (s, 5) == "Track 6");
  100. // the selector lists the ordinary patterns only, unless "shown"
  101. CHECK (trackclips::listedInSelector (s, 0) && trackclips::listedInSelector (s, 1) && ! trackclips::listedInSelector (s, 2));
  102. s.currentPattern = 1;
  103. CHECK (stepPattern (s, 1) == 1 && stepPattern (s, -1) == 0);
  104. trackclips::setShownInSelector (true);
  105. CHECK (trackclips::listedInSelector (s, 2) && stepPattern (s, 1) == 2 && stepPattern (s, 2) == 3);
  106. trackclips::setShownInSelector (false);
  107. // a track clip in the middle of the list is stepped over
  108. s.patterns.push_back ({});
  109. s.patterns.back().name = "Bass";
  110. s.currentPattern = 1;
  111. CHECK (stepPattern (s, 1) == 4);
  112. s.currentPattern = 4;
  113. CHECK (stepPattern (s, -1) == 1);
  114. // the selector's step past the last listed pattern: a new one only when "Bass" has notes (track clips don't count)
  115. CHECK (! stepCreatesPattern (s, 1)); // ("Bass" is empty: it stays)
  116. s.patterns[4].notes.push_back (trackclips190ne::noteOf (0, 60, 0));
  117. CHECK (stepCreatesPattern (s, 1));
  118. // F4 / Shift+F4: empty patterns, never a track's clip
  119. s.currentPattern = 4;
  120. CHECK (findNextEmptyPattern (s, 4) == 0);
  121. s.patterns[0].notes.push_back (trackclips190ne::noteOf (0, 36, 0));
  122. s.patterns[1].notes.push_back (trackclips190ne::noteOf (0, 48, 0));
  123. CHECK (findNextEmptyPattern (s, 4) == -1);
  124. const auto patterns = s.patterns.size();
  125. CHECK (gotoFirstEmptyPattern (s) == (int) patterns && s.patterns.back().name == "Pattern 1" && ! s.patterns.back().trackClip);
  126. }
  127. // Copies of a track clip are unique by default: one new pattern per source (two linked copies stay linked to each other,
  128. // not to the original); ordinary patterns keep FL's sharing; a linked copy is a plain copy of the clip
  129. TEST (trackclips190ne_unique_and_linked_copies)
  130. {
  131. using namespace lynx;
  132. auto s = trackclips190ne::song();
  133. const auto a = trackclips::newClip (s, 1, 4 * ppq);
  134. s.patterns[(std::size_t) a].notes.push_back (trackclips190ne::noteOf (0, 60, 0));
  135. s.playlist = { trackclips190ne::clipOf (a, 1, 0), trackclips190ne::clipOf (a, 1, 4 * ppq), trackclips190ne::clipOf (0, 0, 0) };
  136. // copies of all three (Shift+drag / Ctrl+B / paint: appended, then made unique)
  137. for (int i = 0; i < 3; ++i)
  138. {
  139. auto c = s.playlist[(std::size_t) i];
  140. c.start += 8 * ppq;
  141. s.playlist.push_back (c);
  142. }
  143. CHECK (trackclips::makeCopiesUnique (s, std::vector<int> { 3, 4, 5 }) == 1);
  144. CHECK (s.patterns.size() == 4);
  145. CHECK (s.playlist[3].pattern == 3 && s.playlist[4].pattern == 3 && s.playlist[5].pattern == 0); // (the copies of a share one)
  146. CHECK (s.playlist[0].pattern == a && s.playlist[1].pattern == a);
  147. CHECK (s.patterns[3].trackClip && s.patterns[3].notes == s.patterns[(std::size_t) a].notes && s.patterns[3].name == "Lead \xC2\xB7 clip 2");
  148. // editing the copy leaves the original alone
  149. s.patterns[3].notes.front().key = 72;
  150. CHECK (s.patterns[(std::size_t) a].notes.front().key == 60);
  151. // a linked copy: the same pattern (Ctrl+Alt+B, Shift+L+drag); the uses count it
  152. auto linked = s.playlist[0];
  153. linked.start = 16 * ppq;
  154. s.playlist.push_back (linked);
  155. CHECK (trackclips::uses (s)[(std::size_t) a] == 3 && trackclips::uses (s)[3] == 2 && trackclips::uses (s)[0] == 2);
  156. // FL's Make unique on a track clip: a new clip of its track
  157. polish::makeClipsUnique (s, { (int) s.playlist.size() - 1 });
  158. CHECK (s.patterns.back().trackClip && s.patterns.back().name == "Lead \xC2\xB7 clip 3" && s.patterns.back().uid == 0);
  159. // clips not in a list yet (a paste onto the grid): each track clip gets a copy
  160. std::vector<Clip> loose { trackclips190ne::clipOf (a, 1, 0), trackclips190ne::clipOf (1, 1, 0) };
  161. const auto count = s.patterns.size();
  162. CHECK (trackclips::makeCopiesUnique (s, loose) == 1);
  163. CHECK (s.patterns.size() == count + 1 && loose[0].pattern == (int) count && loose[1].pattern == 1);
  164. }
  165. // The last clip of a track clip goes: the track clip goes with it (in AudioEngine::editSong's step, --selftest); ordinary
  166. // patterns stay (FL); any clip list, a block or a Loop Starter channel counts as a use; the current pattern follows
  167. TEST (trackclips190ne_unused_track_clips_are_deleted)
  168. {
  169. using namespace lynx;
  170. auto s = trackclips190ne::song();
  171. const auto a = trackclips::newClip (s, 1, 4 * ppq); // 2
  172. const auto b = trackclips::newClip (s, 1, 4 * ppq); // 3
  173. const auto c = trackclips::newClip (s, 1, 4 * ppq); // 4
  174. s.patterns.push_back ({});
  175. s.patterns.back().name = "Late"; // 5, ordinary
  176. s.playlist = { trackclips190ne::clipOf (a, 1, 0), trackclips190ne::clipOf (c, 1, 4 * ppq), trackclips190ne::clipOf (5, 2, 0) };
  177. s.currentPattern = 4;
  178. // nothing unused but b (patterns 0 / 1 are ordinary: they stay without clips)
  179. std::vector<int> removed;
  180. CHECK (trackclips::collect (s, &removed) == 1 && removed == std::vector<int> { b });
  181. CHECK (s.patterns.size() == 5 && s.patterns[3].name == "Lead \xC2\xB7 clip 3" && s.patterns[4].name == "Late");
  182. CHECK (s.playlist[1].pattern == 3 && s.playlist[2].pattern == 4 && s.currentPattern == 3); // (indices follow)
  183. // a clip on the grid counts as a use
  184. launcher::setClip (s, 1, 0, trackclips190ne::clipOf (3, 1, 0));
  185. s.playlist.erase (s.playlist.begin() + 1);
  186. CHECK (trackclips::collect (s) == 0);
  187. launcher::clearClip (s, 1, 0);
  188. CHECK (trackclips::collect (s) == 1 && s.patterns.size() == 4);
  189. // the current pattern was the one deleted: it stays in range
  190. CHECK (s.currentPattern >= 0 && s.currentPattern < (int) s.patterns.size());
  191. // a project without track clips: nothing happens
  192. auto plain = trackclips190ne::song();
  193. plain.playlistTracks[1].ownClips = false;
  194. const auto copy = plain;
  195. CHECK (trackclips::collect (plain) == 0 && plain.patterns == copy.patterns && plain.playlist == copy.playlist);
  196. }
  197. // Cut + paste: the clipboard carries the track clip (cutting its last clip deletes it), and a paste brings a unique copy
  198. TEST (trackclips190ne_clipboard_carries_track_clips)
  199. {
  200. using namespace lynx;
  201. auto s = trackclips190ne::song();
  202. const auto a = trackclips::newClip (s, 1, 4 * ppq);
  203. s.patterns[(std::size_t) a].notes.push_back (trackclips190ne::noteOf (0, 64, ppq));
  204. s.playlist = { trackclips190ne::clipOf (a, 1, 0), trackclips190ne::clipOf (0, 0, 0) };
  205. const auto clipboard = s.playlist; // Ctrl+X
  206. const auto carried = trackclips::carry (s, clipboard);
  207. CHECK (carried.patterns.size() == 1 && carried.patterns[0].first == a);
  208. s.playlist.clear();
  209. CHECK (trackclips::collect (s) == 1 && s.patterns.size() == 2);
  210. auto pasted = clipboard; // Ctrl+V
  211. trackclips::materialize (s, pasted, carried);
  212. CHECK (s.patterns.size() == 3 && pasted[0].pattern == 2 && pasted[1].pattern == 0);
  213. CHECK (s.patterns[2].trackClip && s.patterns[2].notes.size() == 1 && s.patterns[2].notes[0].key == 64);
  214. // two clips of one source pasted together share one copy
  215. std::vector<Clip> two { trackclips190ne::clipOf (a, 1, 0), trackclips190ne::clipOf (a, 1, 4 * ppq) };
  216. trackclips::materialize (s, two, carried);
  217. CHECK (two[0].pattern == 3 && two[1].pattern == 3 && s.patterns.size() == 4);
  218. }
  219. // The switch on: the track's patterns that only it plays (all notes its channel's) become its clips; off: they come back
  220. // into the pattern list. A pattern shared with another track, a block, or several instruments stays ordinary.
  221. TEST (trackclips190ne_switch_adopts_and_releases)
  222. {
  223. using namespace lynx;
  224. auto s = trackclips190ne::song();
  225. trackclips::setOwnClips (s, 1, false);
  226. s.channels.emplace_back().name = "Pad";
  227. s.patterns.resize (5);
  228. s.patterns[2].notes = { trackclips190ne::noteOf (0, 60, 0) }; // Lead only, track 1 only
  229. s.patterns[3].notes = { trackclips190ne::noteOf (0, 60, 0), trackclips190ne::noteOf (1, 50, 0) }; // two instruments
  230. s.patterns[4].notes = { trackclips190ne::noteOf (0, 62, 0) }; // also on track 3
  231. s.playlist = { trackclips190ne::clipOf (2, 1, 0), trackclips190ne::clipOf (2, 1, 4 * ppq), trackclips190ne::clipOf (3, 1, 0),
  232. trackclips190ne::clipOf (4, 1, 0), trackclips190ne::clipOf (4, 3, 0), trackclips190ne::clipOf (0, 0, 0) };
  233. trackclips::setOwnClips (s, 1, true);
  234. CHECK (s.playlistTracks[1].ownClips && trackclips::owns (s, 1));
  235. CHECK (s.patterns[2].trackClip && ! s.patterns[3].trackClip && ! s.patterns[4].trackClip && ! s.patterns[0].trackClip);
  236. CHECK (trackclips::ownerTrack (s, 2) == 1 && trackclips::ownerTracks (s)[4] == 1 && trackclips::ownerTracks (s)[1] == -1);
  237. // a pattern block makes a pattern shared
  238. s.patterns[2].trackClip = false;
  239. s.blocks.push_back ({ 2, 0, false });
  240. CHECK (trackclips::adopt (s, 1) == 0);
  241. s.blocks.clear();
  242. CHECK (trackclips::adopt (s, 1) == 1);
  243. trackclips::setOwnClips (s, 1, false);
  244. CHECK (! s.patterns[2].trackClip && trackclips::count (s) == 0);
  245. }
  246. // Export to FL Studio: identical track clips are merged (3 identical + 2 different -> 3 patterns), every clip following;
  247. // ordinary patterns are never merged; more than 999 patterns are reported
  248. TEST (trackclips190ne_flp_export_merges_identical_track_clips)
  249. {
  250. using namespace lynx;
  251. auto s = trackclips190ne::song();
  252. s.patterns[0].notes = { trackclips190ne::noteOf (0, 36, 0) };
  253. s.patterns[1].notes = s.patterns[0].notes; // (ordinary twins: FL keeps both)
  254. std::vector<int> made;
  255. for (int k = 0; k < 5; ++k)
  256. {
  257. made.push_back (trackclips::newClip (s, 1, 4 * ppq));
  258. s.patterns.back().notes = { trackclips190ne::noteOf (0, k < 3 ? 60 : 60 + k, 0) };
  259. s.playlist.push_back (trackclips190ne::clipOf (made.back(), 1, k * 4 * ppq));
  260. }
  261. auto merged = s;
  262. CHECK (trackclips::mergeIdentical (merged) == 2);
  263. CHECK (merged.patterns.size() == 5); // Drums, Chords, clip 1 (x3), clip 4, clip 5
  264. CHECK (merged.playlist[0].pattern == 2 && merged.playlist[1].pattern == 2 && merged.playlist[2].pattern == 2);
  265. CHECK (merged.playlist[3].pattern == 3 && merged.playlist[4].pattern == 4);
  266. CHECK (merged.patterns[0].notes == merged.patterns[1].notes); // (both ordinary twins stay)
  267. // the export writes the merged song: two patterns fewer than without the flags
  268. flpexport::Report report, plainReport;
  269. const auto flp = flp::parseProject (flpexport::exportFlp (s, {}, report));
  270. auto plain = s;
  271. for (auto& p : plain.patterns)
  272. p.trackClip = false;
  273. const auto flpPlain = flp::parseProject (flpexport::exportFlp (plain, {}, plainReport));
  274. CHECK (flp.patterns.size() + 2 == flpPlain.patterns.size());
  275. CHECK (std::none_of (report.notes.begin(), report.notes.end(), [] (const std::string& n) { return n.find ("999") != std::string::npos; }));
  276. // over FL's limit: a warning
  277. auto big = trackclips190ne::song();
  278. for (int k = 0; k < 1000; ++k)
  279. big.patterns.emplace_back().name = "P" + std::to_string (k);
  280. flpexport::Report bigReport;
  281. (void) flpexport::toProject (big, {}, bigReport);
  282. CHECK (std::any_of (bigReport.notes.begin(), bigReport.notes.end(), [] (const std::string& n) { return n.find ("999 FL Studio can hold") != std::string::npos; }));
  283. }
  284. // A Live set: its MIDI tracks become instrument tracks whose clips own their notes, every MIDI clip a track clip, so the
  285. // pattern list stays clean; the export to Live and back keeps it so
  286. TEST (trackclips190ne_als_import_marks_clips_and_round_trips)
  287. {
  288. using namespace lynx;
  289. FlpImportReport report;
  290. std::string error;
  291. const auto song = importAls (als175a::bytesOf (als175a::richSet()), als175a::options (&report), &error);
  292. CHECK (song.has_value());
  293. if (! song)
  294. return;
  295. int keys = -1;
  296. for (int t = 0; t < (int) song->playlistTracks.size(); ++t)
  297. if (song->playlistTracks[(std::size_t) t].mode == PlaylistTrackMode::instrument && ! song->playlistTracks[(std::size_t) t].takeLane)
  298. keys = t;
  299. CHECK (keys >= 0 && trackclips::owns (*song, keys));
  300. int clips = 0;
  301. for (const auto& c : song->playlist)
  302. if (c.kind == ClipKind::pattern)
  303. {
  304. ++clips;
  305. CHECK (trackclips::isTrackClip (*song, c.pattern) && c.track == keys);
  306. }
  307. CHECK (clips >= 2 && trackclips::count (*song) >= 2);
  308. const auto out = exportAls (*song);
  309. const auto back = importAls (out.bytes, als175a::options (&report), &error);
  310. CHECK (back.has_value());
  311. if (! back)
  312. return;
  313. CHECK (trackclips::count (*back) == trackclips::count (*song));
  314. int backKeys = 0;
  315. for (int t = 0; t < (int) back->playlistTracks.size(); ++t)
  316. backKeys += trackclips::owns (*back, t) ? 1 : 0;
  317. CHECK (backKeys >= 1);
  318. }
  319. // The clip grid: a slot's own clip (recorded, empty) is a track clip; a copy of it (paste, duplicate, a drag with the copy
  320. // modifier, to the Playlist) is unique; a drag moves it with its pattern; a cut + paste works after the pattern is gone
  321. TEST (trackclips190ne_grid_slots_own_their_clips)
  322. {
  323. using namespace lynx;
  324. auto s = trackclips190ne::song();
  325. const auto p = session::insertEmptyClip (s, 1, 0);
  326. CHECK (p == 2 && s.patterns[2].trackClip);
  327. s.patterns[2].notes = { trackclips190ne::noteOf (0, 60, 0) };
  328. CHECK (session::duplicate (s, 1, 0) == 1);
  329. const auto* dup = launcher::clipAt (*s.clipGrid, 1, 1);
  330. CHECK (dup != nullptr && dup->pattern == 3 && s.patterns[3].notes == s.patterns[2].notes && s.patterns[3].trackClip);
  331. // a drag moves the clip with its pattern; with the copy modifier the copy is unique
  332. CHECK (session::moveClip (s, 1, 1, 2, 1));
  333. CHECK (launcher::clipAt (*s.clipGrid, 2, 1)->pattern == 3 && s.patterns.size() == 4);
  334. CHECK (session::moveClip (s, 2, 1, 2, 2, true));
  335. CHECK (launcher::clipAt (*s.clipGrid, 2, 2)->pattern == 4 && s.patterns.size() == 5);
  336. // cut: the pattern goes with the slot's clip (collect), the paste brings a copy back
  337. auto cut = session::cut (s, 2, 2);
  338. CHECK (cut.has_value() && cut->trackClip.has_value());
  339. CHECK (trackclips::collect (s) == 1 && s.patterns.size() == 4);
  340. CHECK (session::paste (s, 3, 0, *cut));
  341. const auto* pasted = launcher::clipAt (*s.clipGrid, 3, 0);
  342. CHECK (pasted != nullptr && pasted->pattern == 4 && s.patterns[4].notes == s.patterns[2].notes);
  343. // to the Playlist: a copy of its own; an ordinary pattern placed in a slot stays shared (FL's pattern)
  344. CHECK (session::toPlaylist (s, 1, 0, 1, 0));
  345. CHECK (s.playlist.back().pattern == 5 && s.patterns.size() == 6);
  346. CHECK (session::putPattern (s, 4, 0, 0) && launcher::clipAt (*s.clipGrid, 4, 0)->pattern == 0);
  347. CHECK (session::duplicate (s, 4, 0) == 1 && launcher::clipAt (*s.clipGrid, 4, 1)->pattern == 0);
  348. }
  349. // Bus tracks: an audio track whose insert other inserts send into (the header's bus mark and hint)
  350. TEST (trackclips190ne_bus_tracks)
  351. {
  352. using namespace lynx;
  353. auto s = trackclips190ne::song();
  354. CHECK (trackmodes::linkToMixerTrack (s, 4, 6));
  355. CHECK (! trackclips::isBusTrack (s, 4) && trackclips::busSources (s, 4) == 0);
  356. s.setRoute (2, 6, true);
  357. s.setRoute (3, 6, true);
  358. CHECK (trackclips::isBusTrack (s, 4) && trackclips::busSources (s, 4) == 2);
  359. CHECK (! trackclips::isBusTrack (s, 1)); // (an instrument track is no bus track)
  360. }