1 /* 2 * Copyright (C) 2019-2021 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 * This file incorporates work covered by the following copyright and 20 * permission notice: 21 * 22 * Copyright (C) 2017, 2019 Robin Gareus <robin@gareus.org> 23 * 24 * This program is free software: you can redistribute it and/or modify 25 * it under the terms of the GNU General Public License as published by 26 * the Free Software Foundation, either version 3 of the License, or 27 * (at your option) any later version. 28 * 29 * This program is distributed in the hope that it will be useful, 30 * but WITHOUT ANY WARRANTY; without even the implied warranty of 31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 32 * GNU General Public License for more details. 33 * 34 * You should have received a copy of the GNU General Public License 35 * along with this program. If not, see <https://www.gnu.org/licenses/>. 36 */ 37 38 /** 39 * \file 40 * 41 * Routing graph thread. 42 */ 43 44 #ifndef __AUDIO_GRAPH_THREAD_H__ 45 #define __AUDIO_GRAPH_THREAD_H__ 46 47 #include "zrythm-config.h" 48 49 #include <stdbool.h> 50 #include <pthread.h> 51 52 #include "utils/types.h" 53 54 #include <gtk/gtk.h> 55 56 #ifdef HAVE_JACK 57 #include "weak_libjack.h" 58 #endif 59 60 #ifdef HAVE_LSP_DSP 61 #include <lsp-plug.in/dsp/dsp.h> 62 #endif 63 64 typedef struct Graph Graph; 65 66 /** 67 * @addtogroup audio 68 * 69 * @{ 70 */ 71 72 typedef struct GraphThread 73 { 74 #ifdef HAVE_JACK 75 jack_native_thread_t jthread; 76 #endif 77 pthread_t pthread; 78 79 /** 80 * Thread index in zrythm. 81 * 82 * The main thread will be -1 and the rest in 83 * sequence starting from 0. 84 */ 85 int id; 86 87 /** Pointer back to the graph. */ 88 Graph * graph; 89 90 #ifdef HAVE_LSP_DSP 91 /** LSP DSP context. */ 92 lsp_dsp_context_t lsp_ctx; 93 #endif 94 } GraphThread; 95 96 /** 97 * Creates a thread. 98 * 99 * @param id The index of the thread. 100 * @param graph The graph to set to the thread. 101 * @param is_main 1 if main thread. 102 */ 103 GraphThread * 104 graph_thread_new ( 105 const int id, 106 const bool is_main, 107 Graph * graph); 108 109 /** 110 * @} 111 */ 112 113 #endif 114