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_recycling.h>
21 
22 #include <ags/audio/recall/ags_envelope_audio_signal.h>
23 
24 #include <stdlib.h>
25 #include <stdio.h>
26 
27 void ags_envelope_recycling_class_init(AgsEnvelopeRecyclingClass *envelope_recycling);
28 void ags_envelope_recycling_init(AgsEnvelopeRecycling *envelope_recycling);
29 void ags_envelope_recycling_finalize(GObject *gobject);
30 
31 /**
32  * SECTION:ags_envelope_recycling
33  * @short_description: envelopes recycling
34  * @title: AgsEnvelopeRecycling
35  * @section_id:
36  * @include: ags/audio/recall/ags_envelope_recycling.h
37  *
38  * The #AgsEnvelopeRecycling class envelopes the recycling.
39  */
40 
41 static gpointer ags_envelope_recycling_parent_class = NULL;
42 
43 GType
ags_envelope_recycling_get_type()44 ags_envelope_recycling_get_type()
45 {
46   static volatile gsize g_define_type_id__volatile = 0;
47 
48   if(g_once_init_enter (&g_define_type_id__volatile)){
49     GType ags_type_envelope_recycling = 0;
50 
51     static const GTypeInfo ags_envelope_recycling_info = {
52       sizeof (AgsEnvelopeRecyclingClass),
53       NULL, /* base_init */
54       NULL, /* base_finalize */
55       (GClassInitFunc) ags_envelope_recycling_class_init,
56       NULL, /* class_finalize */
57       NULL, /* class_data */
58       sizeof (AgsEnvelopeRecycling),
59       0,    /* n_preallocs */
60       (GInstanceInitFunc) ags_envelope_recycling_init,
61     };
62 
63     ags_type_envelope_recycling = g_type_register_static(AGS_TYPE_RECALL_RECYCLING,
64 							 "AgsEnvelopeRecycling",
65 							 &ags_envelope_recycling_info,
66 							 0);
67 
68     g_once_init_leave(&g_define_type_id__volatile, ags_type_envelope_recycling);
69   }
70 
71   return g_define_type_id__volatile;
72 }
73 
74 void
ags_envelope_recycling_class_init(AgsEnvelopeRecyclingClass * envelope_recycling)75 ags_envelope_recycling_class_init(AgsEnvelopeRecyclingClass *envelope_recycling)
76 {
77   GObjectClass *gobject;
78   AgsRecallClass *recall;
79 
80   ags_envelope_recycling_parent_class = g_type_class_peek_parent(envelope_recycling);
81 
82   /* GObjectClass */
83   gobject = (GObjectClass *) envelope_recycling;
84 
85   gobject->finalize = ags_envelope_recycling_finalize;
86 
87   /* AgsRecallClass */
88   recall = (AgsRecallClass *) envelope_recycling;
89 }
90 
91 void
ags_envelope_recycling_init(AgsEnvelopeRecycling * envelope_recycling)92 ags_envelope_recycling_init(AgsEnvelopeRecycling *envelope_recycling)
93 {
94   AGS_RECALL(envelope_recycling)->name = "ags-envelope";
95   AGS_RECALL(envelope_recycling)->version = AGS_RECALL_DEFAULT_VERSION;
96   AGS_RECALL(envelope_recycling)->build_id = AGS_RECALL_DEFAULT_BUILD_ID;
97   AGS_RECALL(envelope_recycling)->xml_type = "ags-envelope-recycling";
98   AGS_RECALL(envelope_recycling)->port = NULL;
99 
100   AGS_RECALL(envelope_recycling)->child_type = AGS_TYPE_ENVELOPE_AUDIO_SIGNAL;
101 }
102 
103 void
ags_envelope_recycling_finalize(GObject * gobject)104 ags_envelope_recycling_finalize(GObject *gobject)
105 {
106   /* call parent */
107   G_OBJECT_CLASS(ags_envelope_recycling_parent_class)->finalize(gobject);
108 }
109 
110 /**
111  * ags_envelope_recycling_new:
112  * @source: the #AgsRecycling
113  *
114  * Create a new instance of #AgsEnvelopeRecycling
115  *
116  * Returns: the new #AgsEnvelopeRecycling
117  *
118  * Since: 3.0.0
119  */
120 AgsEnvelopeRecycling*
ags_envelope_recycling_new(AgsRecycling * source)121 ags_envelope_recycling_new(AgsRecycling *source)
122 {
123   AgsEnvelopeRecycling *envelope_recycling;
124 
125   envelope_recycling = (AgsEnvelopeRecycling *) g_object_new(AGS_TYPE_ENVELOPE_RECYCLING,
126 							     "source", source,
127 							     NULL);
128 
129   return(envelope_recycling);
130 }
131