1 /* 2 * Copyright (C) 2019 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 #ifndef __GUI_WIDGETS_LIVE_WAVEFORM_H__ 21 #define __GUI_WIDGETS_LIVE_WAVEFORM_H__ 22 23 /** 24 * \file 25 * 26 * Live waveform display like LMMS. 27 */ 28 29 #include <gtk/gtk.h> 30 31 #define LIVE_WAVEFORM_WIDGET_TYPE \ 32 (live_waveform_widget_get_type ()) 33 G_DECLARE_FINAL_TYPE ( 34 LiveWaveformWidget, 35 live_waveform_widget, 36 Z, LIVE_WAVEFORM_WIDGET, 37 GtkDrawingArea) 38 39 typedef struct Port Port; 40 41 /** 42 * @addtogroup widgets 43 * 44 * @{ 45 */ 46 47 typedef enum LiveWaveformType 48 { 49 LIVE_WAVEFORM_ENGINE, 50 LIVE_WAVEFORM_PORT, 51 } LiveWaveformType; 52 53 typedef struct _LiveWaveformWidget 54 { 55 GtkDrawingArea parent_instance; 56 57 LiveWaveformType type; 58 59 /** Draw border or not. */ 60 int draw_border; 61 62 float * bufs[2]; 63 64 /** Current buffer sizes. */ 65 size_t buf_sz[2]; 66 67 /** Used for drawing. */ 68 GdkRGBA color_green; 69 GdkRGBA color_white; 70 71 /** Port, if port. */ 72 Port * port; 73 74 } LiveWaveformWidget; 75 76 /** 77 * Creates a LiveWaveformWidget for the 78 * AudioEngine. 79 */ 80 void 81 live_waveform_widget_setup_engine ( 82 LiveWaveformWidget * self); 83 84 /** 85 * Creates a LiveWaveformWidget for a port. 86 */ 87 LiveWaveformWidget * 88 live_waveform_widget_new_port ( 89 Port * port); 90 91 /** 92 * @} 93 */ 94 95 #endif 96