1 /* GSequencer - Advanced GTK Sequencer 2 * Copyright (C) 2005-2020 Joël Krähemann 3 * 4 * This file is part of GSequencer. 5 * 6 * GSequencer is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU 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 * GSequencer 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 General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with GSequencer. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __AGS_IPATCH_H__ 21 #define __AGS_IPATCH_H__ 22 23 #include <glib.h> 24 #include <glib-object.h> 25 26 #include <ags/libags.h> 27 #include <ags/ags_api_config.h> 28 29 #ifdef AGS_WITH_LIBINSTPATCH 30 #include <libinstpatch/libinstpatch.h> 31 #endif 32 33 G_BEGIN_DECLS 34 35 #define AGS_TYPE_IPATCH (ags_ipatch_get_type()) 36 #define AGS_IPATCH(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_IPATCH, AgsIpatch)) 37 #define AGS_IPATCH_CLASS(class) (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_IPATCH, AgsIpatchClass)) 38 #define AGS_IS_IPATCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_IPATCH)) 39 #define AGS_IS_IPATCH_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_IPATCH)) 40 #define AGS_IPATCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_IPATCH, AgsIpatchClass)) 41 42 #define AGS_IPATCH_GET_OBJ_MUTEX(obj) (&(((AgsIpatch *) obj)->obj_mutex)) 43 44 #define AGS_IPATCH_DEFAULT_CHANNELS (2) 45 46 #define AGS_IPATCH_READ "r" 47 #define AGS_IPATCH_WRITE "w" 48 49 typedef struct _AgsIpatch AgsIpatch; 50 typedef struct _AgsIpatchClass AgsIpatchClass; 51 52 /** 53 * AgsIpatchFlags: 54 * @AGS_IPATCH_ADDED_TO_REGISTRY: the ipatch was added to registry, see #AgsConnectable::add_to_registry() 55 * @AGS_IPATCH_CONNECTED: indicates the ipatch was connected by calling #AgsConnectable::connect() 56 * @AGS_IPATCH_DLS2: DLS2 format 57 * @AGS_IPATCH_SF2: Soundfont2 format 58 * @AGS_IPATCH_GIG: Gigasampler format 59 * 60 * Enum values to control the behavior or indicate internal state of #AgsFifoout by 61 * enable/disable as flags. 62 */ 63 typedef enum{ 64 AGS_IPATCH_ADDED_TO_REGISTRY = 1, 65 AGS_IPATCH_CONNECTED = 1 << 1, 66 AGS_IPATCH_DLS2 = 1 << 2, 67 AGS_IPATCH_SF2 = 1 << 3, 68 AGS_IPATCH_GIG = 1 << 4, 69 }AgsIpatchFlags; 70 71 struct _AgsIpatch 72 { 73 GObject gobject; 74 75 guint flags; 76 77 GRecMutex obj_mutex; 78 79 AgsUUID *uuid; 80 81 GObject *soundcard; 82 83 char *filename; 84 char *mode; 85 86 #ifdef AGS_WITH_LIBINSTPATCH 87 IpatchFile *file; 88 IpatchFileHandle *handle; 89 #else 90 gpointer file; 91 gpointer handle; 92 #endif 93 94 guint nesting_level; 95 96 gchar *level_id; 97 guint level_index; 98 99 GObject *reader; 100 GObject *writer; 101 102 GList *audio_signal; 103 }; 104 105 struct _AgsIpatchClass 106 { 107 GObjectClass gobject; 108 }; 109 110 GType ags_ipatch_get_type(); 111 112 gboolean ags_ipatch_test_flags(AgsIpatch *ipatch, guint flags); 113 void ags_ipatch_set_flags(AgsIpatch *ipatch, guint flags); 114 void ags_ipatch_unset_flags(AgsIpatch *ipatch, guint flags); 115 116 gboolean ags_ipatch_check_suffix(gchar *filename); 117 118 AgsIpatch* ags_ipatch_new(); 119 120 G_END_DECLS 121 122 #endif /*__AGS_IPATCH_H__*/ 123