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