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_TRACK_H__ 21 #define __AGS_TRACK_H__ 22 23 #include <glib.h> 24 #include <glib-object.h> 25 26 #include <ags/libags.h> 27 28 G_BEGIN_DECLS 29 30 #define AGS_TYPE_TRACK (ags_track_get_type()) 31 #define AGS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_TRACK, AgsTrack)) 32 #define AGS_TRACK_CLASS(class) (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_TRACK, AgsTrackClass)) 33 #define AGS_IS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_TRACK)) 34 #define AGS_IS_TRACK_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_TRACK)) 35 #define AGS_TRACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_TRACK, AgsTrackClass)) 36 37 #define AGS_TRACK_GET_OBJ_MUTEX(obj) (&(((AgsTrack *) obj)->obj_mutex)) 38 39 #define AGS_TRACK_DEFAULT_TICKS_PER_QUARTER_TRACK (16.0) 40 41 typedef struct _AgsTrack AgsTrack; 42 typedef struct _AgsTrackClass AgsTrackClass; 43 44 /** 45 * AgsTrackFlags: 46 * @AGS_TRACK_IS_SELECTED: is selected 47 * 48 * Enum values to control the behavior or indicate internal state of #AgsTrack by 49 * enable/disable as flags. 50 */ 51 typedef enum{ 52 AGS_TRACK_IS_SELECTED = 1, 53 }AgsTrackFlags; 54 55 struct _AgsTrack 56 { 57 GObject gobject; 58 59 guint flags; 60 61 GRecMutex obj_mutex; 62 63 guint64 x; 64 65 guchar *smf_buffer; 66 guint allocated_smf_buffer_length; 67 guint smf_buffer_length; 68 }; 69 70 struct _AgsTrackClass 71 { 72 GObjectClass gobject; 73 }; 74 75 GType ags_track_get_type(); 76 77 GRecMutex* ags_track_get_obj_mutex(AgsTrack *track); 78 79 void ags_track_lock(AgsTrack *track); 80 void ags_track_unlock(AgsTrack *track); 81 82 gboolean ags_track_test_flags(AgsTrack *track, guint flags); 83 void ags_track_set_flags(AgsTrack *track, guint flags); 84 void ags_track_unset_flags(AgsTrack *track, guint flags); 85 86 gint ags_track_sort_func(gconstpointer a, 87 gconstpointer b); 88 89 guint64 ags_track_get_x(AgsTrack *track); 90 void ags_track_set_x(AgsTrack *track, guint64 x); 91 92 gpointer ags_track_get_smf_buffer(AgsTrack *track, 93 guint *smf_buffer_length); 94 95 gpointer ags_track_alloc_smf_buffer(AgsTrack *track, 96 guint smf_buffer_length); 97 gpointer ags_track_realloc_smf_buffer(AgsTrack *track, 98 guint smf_buffer_length); 99 100 AgsTrack* ags_track_duplicate(AgsTrack *track); 101 102 AgsTrack* ags_track_new(); 103 104 G_END_DECLS 105 106 #endif /*__AGS_TRACK_H__*/ 107