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 #include <ags/audio/recall/ags_envelope_channel_run.h>
21
22 #include <ags/audio/ags_audio.h>
23 #include <ags/audio/ags_recall_id.h>
24
25 #include <ags/audio/recall/ags_envelope_recycling.h>
26
27 #include <stdlib.h>
28 #include <stdio.h>
29
30 void ags_envelope_channel_run_class_init(AgsEnvelopeChannelRunClass *envelope_channel_run);
31 void ags_envelope_channel_run_init(AgsEnvelopeChannelRun *envelope_channel_run);
32 void ags_envelope_channel_run_finalize(GObject *gobject);
33
34 static gpointer ags_envelope_channel_run_parent_class = NULL;
35
36 GType
ags_envelope_channel_run_get_type()37 ags_envelope_channel_run_get_type()
38 {
39 static volatile gsize g_define_type_id__volatile = 0;
40
41 if(g_once_init_enter (&g_define_type_id__volatile)){
42 GType ags_type_envelope_channel_run = 0;
43
44 static const GTypeInfo ags_envelope_channel_run_info = {
45 sizeof (AgsEnvelopeChannelRunClass),
46 NULL, /* base_init */
47 NULL, /* base_finalize */
48 (GClassInitFunc) ags_envelope_channel_run_class_init,
49 NULL, /* class_finalize */
50 NULL, /* class_data */
51 sizeof (AgsEnvelopeChannelRun),
52 0, /* n_preallocs */
53 (GInstanceInitFunc) ags_envelope_channel_run_init,
54 };
55
56 ags_type_envelope_channel_run = g_type_register_static(AGS_TYPE_RECALL_CHANNEL_RUN,
57 "AgsEnvelopeChannelRun",
58 &ags_envelope_channel_run_info,
59 0);
60
61 g_once_init_leave(&g_define_type_id__volatile, ags_type_envelope_channel_run);
62 }
63
64 return g_define_type_id__volatile;
65 }
66
67 void
ags_envelope_channel_run_class_init(AgsEnvelopeChannelRunClass * envelope_channel_run)68 ags_envelope_channel_run_class_init(AgsEnvelopeChannelRunClass *envelope_channel_run)
69 {
70 GObjectClass *gobject;
71 AgsRecallClass *recall;
72
73 ags_envelope_channel_run_parent_class = g_type_class_peek_parent(envelope_channel_run);
74
75 /* GObjectClass */
76 gobject = (GObjectClass *) envelope_channel_run;
77
78 gobject->finalize = ags_envelope_channel_run_finalize;
79
80 /* AgsRecallClass */
81 recall = (AgsRecallClass *) envelope_channel_run;
82 }
83
84 void
ags_envelope_channel_run_init(AgsEnvelopeChannelRun * envelope_channel_run)85 ags_envelope_channel_run_init(AgsEnvelopeChannelRun *envelope_channel_run)
86 {
87 ags_recall_set_ability_flags((AgsRecall *) envelope_channel_run, (AGS_SOUND_ABILITY_SEQUENCER |
88 AGS_SOUND_ABILITY_NOTATION |
89 AGS_SOUND_ABILITY_WAVE |
90 AGS_SOUND_ABILITY_MIDI));
91
92 AGS_RECALL(envelope_channel_run)->name = "ags-envelope";
93 AGS_RECALL(envelope_channel_run)->version = AGS_RECALL_DEFAULT_VERSION;
94 AGS_RECALL(envelope_channel_run)->build_id = AGS_RECALL_DEFAULT_BUILD_ID;
95 AGS_RECALL(envelope_channel_run)->xml_type = "ags-envelope-channel-run";
96 AGS_RECALL(envelope_channel_run)->port = NULL;
97
98 AGS_RECALL(envelope_channel_run)->child_type = AGS_TYPE_ENVELOPE_RECYCLING;
99 }
100
101 void
ags_envelope_channel_run_finalize(GObject * gobject)102 ags_envelope_channel_run_finalize(GObject *gobject)
103 {
104 /* call parent */
105 G_OBJECT_CLASS(ags_envelope_channel_run_parent_class)->finalize(gobject);
106 }
107
108 /**
109 * ags_envelope_channel_run_new:
110 * @source: the #AgsChannel
111 *
112 * Create a new instance of #AgsEnvelopeChannelRun
113 *
114 * Returns: the new #AgsEnvelopeChannelRun
115 *
116 * Since: 3.0.0
117 */
118 AgsEnvelopeChannelRun*
ags_envelope_channel_run_new(AgsChannel * source)119 ags_envelope_channel_run_new(AgsChannel *source)
120 {
121 AgsEnvelopeChannelRun *envelope_channel_run;
122
123 envelope_channel_run = (AgsEnvelopeChannelRun *) g_object_new(AGS_TYPE_ENVELOPE_CHANNEL_RUN,
124 "source", source,
125 NULL);
126
127 return(envelope_channel_run);
128 }
129