1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2018 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_feed_recycling.h>
21 
22 #include <ags/audio/recall/ags_feed_audio_signal.h>
23 
24 void ags_feed_recycling_class_init(AgsFeedRecyclingClass *feed_recycling);
25 void ags_feed_recycling_init(AgsFeedRecycling *feed_recycling);
26 void ags_feed_recycling_finalize(GObject *gobject);
27 
28 /**
29  * SECTION:ags_feed_recycling
30  * @short_description: feeds recycling
31  * @title: AgsFeedRecycling
32  * @section_id:
33  * @include: ags/audio/recall/ags_feed_recycling.h
34  *
35  * The #AgsFeedRecycling class feeds the recycling.
36  */
37 
38 static gpointer ags_feed_recycling_parent_class = NULL;
39 
40 GType
ags_feed_recycling_get_type()41 ags_feed_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_feed_recycling = 0;
47 
48     static const GTypeInfo ags_feed_recycling_info = {
49       sizeof (AgsFeedRecyclingClass),
50       NULL, /* base_init */
51       NULL, /* base_finalize */
52       (GClassInitFunc) ags_feed_recycling_class_init,
53       NULL, /* class_finalize */
54       NULL, /* class_data */
55       sizeof (AgsFeedRecycling),
56       0,    /* n_preallocs */
57       (GInstanceInitFunc) ags_feed_recycling_init,
58     };
59 
60     ags_type_feed_recycling = g_type_register_static(AGS_TYPE_RECALL_RECYCLING,
61 						     "AgsFeedRecycling",
62 						     &ags_feed_recycling_info,
63 						     0);
64 
65     g_once_init_leave(&g_define_type_id__volatile, ags_type_feed_recycling);
66   }
67 
68   return g_define_type_id__volatile;
69 }
70 
71 void
ags_feed_recycling_class_init(AgsFeedRecyclingClass * feed_recycling)72 ags_feed_recycling_class_init(AgsFeedRecyclingClass *feed_recycling)
73 {
74   GObjectClass *gobject;
75   AgsRecallClass *recall;
76 
77   ags_feed_recycling_parent_class = g_type_class_peek_parent(feed_recycling);
78 
79   /* GObjectClass */
80   gobject = (GObjectClass *) feed_recycling;
81 
82   gobject->finalize = ags_feed_recycling_finalize;
83 
84   /* AgsRecallClass */
85   recall = (AgsRecallClass *) feed_recycling;
86 }
87 
88 void
ags_feed_recycling_init(AgsFeedRecycling * feed_recycling)89 ags_feed_recycling_init(AgsFeedRecycling *feed_recycling)
90 {
91   AGS_RECALL(feed_recycling)->name = "ags-feed";
92   AGS_RECALL(feed_recycling)->version = AGS_RECALL_DEFAULT_VERSION;
93   AGS_RECALL(feed_recycling)->build_id = AGS_RECALL_DEFAULT_BUILD_ID;
94   AGS_RECALL(feed_recycling)->xml_type = "ags-feed-recycling";
95 
96   AGS_RECALL(feed_recycling)->child_type = AGS_TYPE_FEED_AUDIO_SIGNAL;
97 
98   AGS_RECALL_RECYCLING(feed_recycling)->flags |= (AGS_RECALL_RECYCLING_MAP_CHILD_SOURCE);
99 }
100 
101 void
ags_feed_recycling_finalize(GObject * gobject)102 ags_feed_recycling_finalize(GObject *gobject)
103 {
104   /* call parent */
105   G_OBJECT_CLASS(ags_feed_recycling_parent_class)->finalize(gobject);
106 }
107 
108 /**
109  * ags_feed_recycling_new:
110  * @source: the #AgsRecycling
111  *
112  * Creates an #AgsFeedRecycling
113  *
114  * Returns: a new #AgsFeedRecycling
115  *
116  * Since: 3.0.0
117  */
118 AgsFeedRecycling*
ags_feed_recycling_new(AgsRecycling * source)119 ags_feed_recycling_new(AgsRecycling *source)
120 {
121   AgsFeedRecycling *feed_recycling;
122 
123   feed_recycling = (AgsFeedRecycling *) g_object_new(AGS_TYPE_FEED_RECYCLING,
124 						     "source", source,
125 						     NULL);
126 
127   return(feed_recycling);
128 }
129