1 /* 2 * Copyright (C) 2018-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 20 /** 21 * \file 22 * 23 * LV2 UI related code. 24 */ 25 26 #ifndef __PLUGINS_LV2_LV2_UI_H__ 27 #define __PLUGINS_LV2_LV2_UI_H__ 28 29 #include <stdbool.h> 30 31 #include <suil/suil.h> 32 33 typedef struct Lv2Plugin Lv2Plugin; 34 35 /** 36 * @addtogroup lv2 37 * 38 * @{ 39 */ 40 41 /** 42 * Returns if the UI of the plugin is resizable. 43 */ 44 bool 45 lv2_ui_is_resizable ( 46 Lv2Plugin* plugin); 47 48 /** 49 * Inits the LV2 plugin UI. 50 * 51 * To be called for generic, suil-wrapped and 52 * external UIs. 53 */ 54 void 55 lv2_ui_init ( 56 Lv2Plugin* plugin); 57 58 /** 59 * Instantiates the plugin UI. 60 */ 61 void 62 lv2_ui_instantiate ( 63 Lv2Plugin * plugin); 64 65 /** 66 * Read and apply control change events from UI, 67 * for plugins that have their own UIs. 68 * 69 * Called in the real-time audio thread during 70 * plugin processing. 71 * 72 * @param nframes Used for event ports. 73 */ 74 void 75 lv2_ui_read_and_apply_events ( 76 Lv2Plugin * plugin, 77 uint32_t nframes); 78 79 /** 80 * Write events from the plugin's UI to the plugin. 81 */ 82 void 83 lv2_ui_send_event_from_ui_to_plugin ( 84 Lv2Plugin * plugin, 85 uint32_t port_index, 86 uint32_t buffer_size, 87 uint32_t protocol, ///< format 88 const void* buffer); 89 90 /** 91 * Send event to UI, called during the real time 92 * audio thread when processing the plugin. 93 * 94 * @param type Atom type. 95 */ 96 int 97 lv2_ui_send_event_from_plugin_to_ui ( 98 Lv2Plugin * plugin, 99 uint32_t port_index, 100 uint32_t type, 101 uint32_t size, 102 const void * body); 103 104 /** 105 * Similar to lv2_ui_send_event_from_plugin_to_ui 106 * except that it passes a float instead of an 107 * LV2 atom. 108 * 109 * @param lv2_port The port to pass the value of. 110 */ 111 NONNULL 112 void 113 lv2_ui_send_control_val_event_from_plugin_to_ui ( 114 Lv2Plugin * lv2_plugin, 115 Port * port); 116 117 /** 118 * @} 119 */ 120 121 #endif 122