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_rt_stream_recycling.h>
21 
22 #include <ags/audio/recall/ags_rt_stream_audio_signal.h>
23 
24 void ags_rt_stream_recycling_class_init(AgsRtStreamRecyclingClass *rt_stream_recycling);
25 void ags_rt_stream_recycling_init(AgsRtStreamRecycling *rt_stream_recycling);
26 void ags_rt_stream_recycling_finalize(GObject *gobject);
27 
28 /**
29  * SECTION:ags_rt_stream_recycling
30  * @short_description: rt streams recycling
31  * @title: AgsRtStreamRecycling
32  * @section_id:
33  * @include: ags/audio/recall/ags_rt_stream_recycling.h
34  *
35  * The #AgsRtStreamRecycling rt streams the recycling with appropriate #AgsRecallID.
36  */
37 
38 static gpointer ags_rt_stream_recycling_parent_class = NULL;
39 
40 GType
ags_rt_stream_recycling_get_type()41 ags_rt_stream_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_rt_stream_recycling = 0;
47 
48     static const GTypeInfo ags_rt_stream_recycling_info = {
49       sizeof (AgsRtStreamRecyclingClass),
50       NULL, /* base_init */
51       NULL, /* base_finalize */
52       (GClassInitFunc) ags_rt_stream_recycling_class_init,
53       NULL, /* class_finalize */
54       NULL, /* class_data */
55       sizeof (AgsRtStreamRecycling),
56       0,    /* n_preallocs */
57       (GInstanceInitFunc) ags_rt_stream_recycling_init,
58     };
59 
60     ags_type_rt_stream_recycling = g_type_register_static(AGS_TYPE_RECALL_RECYCLING,
61 							  "AgsRtStreamRecycling",
62 							  &ags_rt_stream_recycling_info,
63 							  0);
64 
65     g_once_init_leave(&g_define_type_id__volatile, ags_type_rt_stream_recycling);
66   }
67 
68   return g_define_type_id__volatile;
69 }
70 
71 void
ags_rt_stream_recycling_class_init(AgsRtStreamRecyclingClass * rt_stream_recycling)72 ags_rt_stream_recycling_class_init(AgsRtStreamRecyclingClass *rt_stream_recycling)
73 {
74   GObjectClass *gobject;
75 
76   ags_rt_stream_recycling_parent_class = g_type_class_peek_parent(rt_stream_recycling);
77 
78   /* GObjectClass */
79   gobject = (GObjectClass *) rt_stream_recycling;
80 
81   gobject->finalize = ags_rt_stream_recycling_finalize;
82 }
83 
84 void
ags_rt_stream_recycling_init(AgsRtStreamRecycling * rt_stream_recycling)85 ags_rt_stream_recycling_init(AgsRtStreamRecycling *rt_stream_recycling)
86 {
87   AGS_RECALL(rt_stream_recycling)->name = "ags-rt_stream";
88   AGS_RECALL(rt_stream_recycling)->version = AGS_RECALL_DEFAULT_VERSION;
89   AGS_RECALL(rt_stream_recycling)->build_id = AGS_RECALL_DEFAULT_BUILD_ID;
90   AGS_RECALL(rt_stream_recycling)->xml_type = "ags-rt_stream-recycling";
91   AGS_RECALL(rt_stream_recycling)->port = NULL;
92 
93   AGS_RECALL(rt_stream_recycling)->child_type = AGS_TYPE_RT_STREAM_AUDIO_SIGNAL;
94 
95   AGS_RECALL_RECYCLING(rt_stream_recycling)->flags |= (AGS_RECALL_RECYCLING_MAP_CHILD_SOURCE);
96 }
97 
98 void
ags_rt_stream_recycling_finalize(GObject * gobject)99 ags_rt_stream_recycling_finalize(GObject *gobject)
100 {
101   /* call parent */
102   G_OBJECT_CLASS(ags_rt_stream_recycling_parent_class)->finalize(gobject);
103 }
104 
105 /**
106  * ags_rt_stream_recycling_new:
107  * @source: the #AgsRecycling
108  *
109  * Create a new instance of #AgsRtStreamRecycling
110  *
111  * Returns: the new #AgsRtStreamRecycling
112  *
113  * Since: 3.0.0
114  */
115 AgsRtStreamRecycling*
ags_rt_stream_recycling_new(AgsRecycling * source)116 ags_rt_stream_recycling_new(AgsRecycling *source)
117 {
118   AgsRtStreamRecycling *rt_stream_recycling;
119 
120   rt_stream_recycling = (AgsRtStreamRecycling *) g_object_new(AGS_TYPE_RT_STREAM_RECYCLING,
121 							      "source", source,
122 							      NULL);
123 
124   return(rt_stream_recycling);
125 }
126