1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2019 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_PATTERN_ENVELOPE_H__
21 #define __AGS_PATTERN_ENVELOPE_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <gtk/gtk.h>
27 
28 #include <ags/libags.h>
29 #include <ags/libags-audio.h>
30 #include <ags/libags-gui.h>
31 
32 G_BEGIN_DECLS
33 
34 #define AGS_TYPE_PATTERN_ENVELOPE                (ags_pattern_envelope_get_type())
35 #define AGS_PATTERN_ENVELOPE(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_PATTERN_ENVELOPE, AgsPatternEnvelope))
36 #define AGS_PATTERN_ENVELOPE_CLASS(class)        (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_PATTERN_ENVELOPE, AgsPatternEnvelopeClass))
37 #define AGS_IS_PATTERN_ENVELOPE(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_PATTERN_ENVELOPE))
38 #define AGS_IS_PATTERN_ENVELOPE_CLASS(class)     (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_PATTERN_ENVELOPE))
39 #define AGS_PATTERN_ENVELOPE_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_PATTERN_ENVELOPE, AgsPatternEnvelopeClass))
40 
41 #define AGS_PATTERN_ENVELOPE_DEFAULT_VERSION "0.8.5"
42 #define AGS_PATTERN_ENVELOPE_DEFAULT_BUILD_ID "CEST 16-06-2017 11:29"
43 
44 typedef struct _AgsPatternEnvelope AgsPatternEnvelope;
45 typedef struct _AgsPatternEnvelopeClass AgsPatternEnvelopeClass;
46 
47 typedef enum{
48   AGS_PATTERN_ENVELOPE_CONNECTED      = 1,
49   AGS_PATTERN_ENVELOPE_NO_UPDATE      = 1 <<  1,
50 }AgsPatternEnvelopeFlags;
51 
52 typedef enum{
53   AGS_PATTERN_ENVELOPE_COLUMN_EDIT,
54   AGS_PATTERN_ENVELOPE_COLUMN_PLOT,
55   AGS_PATTERN_ENVELOPE_COLUMN_PRESET_NAME,
56   AGS_PATTERN_ENVELOPE_COLUMN_AUDIO_CHANNEL_START,
57   AGS_PATTERN_ENVELOPE_COLUMN_AUDIO_CHANNEL_END,
58   AGS_PATTERN_ENVELOPE_COLUMN_PAD_START,
59   AGS_PATTERN_ENVELOPE_COLUMN_PAD_END,
60   AGS_PATTERN_ENVELOPE_COLUMN_X_START,
61   AGS_PATTERN_ENVELOPE_COLUMN_X_END,
62   AGS_PATTERN_ENVELOPE_COLUMN_LAST,
63 }AgsPatternEnvelopeColumn;
64 
65 struct _AgsPatternEnvelope
66 {
67   GtkVBox vbox;
68 
69   guint flags;
70 
71   gchar *version;
72   gchar *build_id;
73 
74   GtkCheckButton *enabled;
75 
76   AgsCartesian *cartesian;
77 
78   GtkTreeView *tree_view;
79 
80   GtkSpinButton *audio_channel_start;
81   GtkSpinButton *audio_channel_end;
82 
83   GtkSpinButton *pad_start;
84   GtkSpinButton *pad_end;
85 
86   GtkSpinButton *x_start;
87   GtkSpinButton *x_end;
88 
89   GtkHScale *attack_x;
90   GtkHScale *attack_y;
91 
92   GtkHScale *decay_x;
93   GtkHScale *decay_y;
94 
95   GtkHScale *sustain_x;
96   GtkHScale *sustain_y;
97 
98   GtkHScale *release_x;
99   GtkHScale *release_y;
100 
101   GtkHScale *ratio;
102 
103   GtkDialog *rename;
104 
105   GtkButton *move_up;
106   GtkButton *move_down;
107   GtkButton *add;
108   GtkButton *remove;
109 };
110 
111 struct _AgsPatternEnvelopeClass
112 {
113   GtkVBoxClass vbox;
114 };
115 
116 GType ags_pattern_envelope_get_type(void);
117 
118 void ags_pattern_envelope_set_preset_property(AgsPatternEnvelope *pattern_envelope,
119 					      AgsPreset *preset,
120 					      gchar *property_name, GValue *value);
121 
122 AgsPreset* ags_pattern_envelope_get_active_preset(AgsPatternEnvelope *pattern_envelope);
123 
124 void ags_pattern_envelope_load_preset(AgsPatternEnvelope *pattern_envelope);
125 void ags_pattern_envelope_add_preset(AgsPatternEnvelope *pattern_envelope,
126 				     gchar *preset_name);
127 void ags_pattern_envelope_remove_preset(AgsPatternEnvelope *pattern_envelope,
128 					guint nth);
129 
130 void ags_pattern_envelope_reset_control(AgsPatternEnvelope *pattern_envelope);
131 void ags_pattern_envelope_reset_tree_view(AgsPatternEnvelope *pattern_envelope);
132 
133 void ags_pattern_envelope_plot(AgsPatternEnvelope *pattern_envelope);
134 
135 AgsPatternEnvelope* ags_pattern_envelope_new();
136 
137 G_END_DECLS
138 
139 #endif /*__AGS_PATTERN_ENVELOPE_H__*/
140