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_copy_recycling.h>
21 
22 #include <ags/audio/recall/ags_copy_audio_signal.h>
23 
24 #include <stdlib.h>
25 #include <stdio.h>
26 
27 void ags_copy_recycling_class_init(AgsCopyRecyclingClass *copy_recycling);
28 void ags_copy_recycling_init(AgsCopyRecycling *copy_recycling);
29 void ags_copy_recycling_finalize(GObject *gobject);
30 
31 /**
32  * SECTION:ags_copy_recycling
33  * @short_description: copy recycling
34  * @title: AgsCopyRecycling
35  * @section_id:
36  * @include: ags/audio/recall/ags_copy_recycling.h
37  *
38  * The #AgsCopyRecycling class copies the recycling.
39  */
40 
41 static gpointer ags_copy_recycling_parent_class = NULL;
42 
43 GType
ags_copy_recycling_get_type()44 ags_copy_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_copy_recycling = 0;
50 
51     static const GTypeInfo ags_copy_recycling_info = {
52       sizeof(AgsCopyRecyclingClass),
53       NULL, /* base_init */
54       NULL, /* base_finalize */
55       (GClassInitFunc) ags_copy_recycling_class_init,
56       NULL, /* class_finalize */
57       NULL, /* class_data */
58       sizeof(AgsCopyRecycling),
59       0,    /* n_preallocs */
60       (GInstanceInitFunc) ags_copy_recycling_init,
61     };
62 
63     ags_type_copy_recycling = g_type_register_static(AGS_TYPE_RECALL_RECYCLING,
64 						     "AgsCopyRecycling",
65 						     &ags_copy_recycling_info,
66 						     0);
67 
68     g_once_init_leave(&g_define_type_id__volatile, ags_type_copy_recycling);
69   }
70 
71   return g_define_type_id__volatile;
72 }
73 
74 void
ags_copy_recycling_class_init(AgsCopyRecyclingClass * copy_recycling)75 ags_copy_recycling_class_init(AgsCopyRecyclingClass *copy_recycling)
76 {
77   GObjectClass *gobject;
78   AgsRecallClass *recall;
79 
80   ags_copy_recycling_parent_class = g_type_class_peek_parent(copy_recycling);
81 
82   /* GObjectClass */
83   gobject = (GObjectClass *) copy_recycling;
84 
85   gobject->finalize = ags_copy_recycling_finalize;
86 
87   /* AgsRecallClass */
88   recall = (AgsRecallClass *) copy_recycling;
89 }
90 
91 void
ags_copy_recycling_init(AgsCopyRecycling * copy_recycling)92 ags_copy_recycling_init(AgsCopyRecycling *copy_recycling)
93 {
94   AGS_RECALL(copy_recycling)->name = "ags-copy";
95   AGS_RECALL(copy_recycling)->version = AGS_RECALL_DEFAULT_VERSION;
96   AGS_RECALL(copy_recycling)->build_id = AGS_RECALL_DEFAULT_BUILD_ID;
97   AGS_RECALL(copy_recycling)->xml_type = "ags-copy-recycling";
98   AGS_RECALL(copy_recycling)->port = NULL;
99 
100   AGS_RECALL(copy_recycling)->child_type = AGS_TYPE_COPY_AUDIO_SIGNAL;
101   AGS_RECALL_RECYCLING(copy_recycling)->flags |= (AGS_RECALL_RECYCLING_MAP_CHILD_DESTINATION);
102 }
103 
104 void
ags_copy_recycling_finalize(GObject * gobject)105 ags_copy_recycling_finalize(GObject *gobject)
106 {
107   /* call parent */
108   G_OBJECT_CLASS(ags_copy_recycling_parent_class)->finalize(gobject);
109 }
110 
111 /**
112  * ags_copy_recycling_new:
113  * @destination: the destination #AgsRecycling
114  * @source: the source #AgsRecycling
115  *
116  * Create a new instance of #AgsCopyRecycling
117  *
118  * Returns: the new #AgsCopyRecycling
119  *
120  * Since: 3.0.0
121  */
122 AgsCopyRecycling*
ags_copy_recycling_new(AgsRecycling * destination,AgsRecycling * source)123 ags_copy_recycling_new(AgsRecycling *destination,
124 		       AgsRecycling *source)
125 {
126   AgsCopyRecycling *copy_recycling;
127 
128   copy_recycling = (AgsCopyRecycling *) g_object_new(AGS_TYPE_COPY_RECYCLING,
129 						     "destination", destination,
130 						     "source", source,
131 						     NULL);
132 
133   return(copy_recycling);
134 }
135