1 /* 2 * Copyright (C) 2020 Alexandros Theodotou <alex at zrythm dot org> 3 * 4 * This file is part of Zrythm 5 * 6 * Zrythm is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Affero General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Zrythm is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Affero General Public License for more details. 15 * 16 * You should have received a copy of the GNU Affero General Public License 17 * along with Zrythm. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20 /** 21 * \file 22 * 23 * Common logic for tracks that can be group targets. 24 */ 25 26 #ifndef __AUDIO_GROUP_TARGET_TRACK_H__ 27 #define __AUDIO_GROUP_TARGET_TRACK_H__ 28 29 #include <stdbool.h> 30 31 typedef struct Track Track; 32 33 #define TRACK_CAN_BE_GROUP_TARGET(tr) \ 34 (IS_TRACK (tr) && \ 35 (tr->type == TRACK_TYPE_AUDIO_GROUP || \ 36 tr->type == TRACK_TYPE_MIDI_GROUP || \ 37 tr->type == TRACK_TYPE_INSTRUMENT || \ 38 tr->type == TRACK_TYPE_MASTER)) 39 40 void 41 group_target_track_init_loaded ( 42 Track * self); 43 44 void 45 group_target_track_init (Track * track); 46 47 /** 48 * Removes a child track from the list of children. 49 */ 50 void 51 group_target_track_remove_child ( 52 Track * self, 53 unsigned int child_name_hash, 54 bool disconnect, 55 bool recalc_graph, 56 bool pub_events); 57 58 /** 59 * Remove all known children. 60 * 61 * @param disconnect Also route the children to "None". 62 */ 63 void 64 group_target_track_remove_all_children ( 65 Track * self, 66 bool disconnect, 67 bool recalc_graph, 68 bool pub_events); 69 70 /** 71 * Adds a child track to the list of children. 72 * 73 * @param connect Connect the child to the group track. 74 */ 75 void 76 group_target_track_add_child ( 77 Track * self, 78 unsigned int child_name_hash, 79 bool connect, 80 bool recalc_graph, 81 bool pub_events); 82 83 bool 84 group_target_track_validate ( 85 Track * self); 86 87 void 88 group_target_track_add_children ( 89 Track * self, 90 unsigned int * children, 91 int num_children, 92 bool connect, 93 bool recalc_graph, 94 bool pub_events); 95 96 /** 97 * Returns the index of the child matching the 98 * given hash. 99 */ 100 int 101 group_target_track_find_child ( 102 Track * self, 103 unsigned int track_name_hash); 104 105 #endif /* __AUDIO_GROUP_TARGET_TRACK_H__ */ 106