#pragma once // track_topology — pure folder arithmetic over a project's track list: which tracks // are the DIRECT children of a folder parent, derived from the I_FOLDERDEPTH deltas // alone. NO REAPER types (the shell reads the deltas); unit-tested by // tests/test_track_topology.cpp. #include namespace reasampler::capture { // Indices of `parentIndex`'s DIRECT children, given every track's I_FOLDERDEPTH in // track order. I_FOLDERDEPTH is a DELTA applied AFTER its own track (SDK header // ~2215: 0 = normal, 1 = opens a folder, -n = closes n folders), so the depth walk // below is the only way to recover the tree from the flat list. // // Empty when `parentIndex` is out of range or its track does not open a folder. // Grandchildren are deliberately excluded: their audio reaches the parent only // through the direct child that owns them, so a caller silencing each direct child's // send-to-parent silences the whole subtree. An unterminated folder (no closing // negative delta) treats every remaining track as inside it, matching REAPER. std::vector directChildIndices(const std::vector& folderDepths, int parentIndex); } // namespace reasampler::capture