Debian Codegraph @

ags/audio/fx/ags_fx_envelope_audio_signal.c

raw symbols SCIP
1 /* GSequencer - Advanced GTK Sequencer
2 * Copyright (C) 2005-2025 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/fx/ags_fx_envelope_audio_signal.h>cxx . . $ `<file>/ags/audio/fx/ags_fx_envelope_audio_signal.h`/
21
22 #include <ags/audio/ags_audio.h>cxx . . $ `<file>/ags/audio/ags_audio.h`/
23 #include <ags/audio/ags_channel.h>cxx . . $ `<file>/ags/audio/ags_channel.h`/
24 #include <ags/audio/ags_audio_buffer_util.h>cxx . . $ `<file>/ags/audio/ags_audio_buffer_util.h`/
25 #include <ags/audio/ags_volume_util.h>cxx . . $ `<file>/ags/audio/ags_volume_util.h`/
26
27 #include <ags/audio/fx/ags_fx_envelope_channel.h>cxx . . $ `<file>/ags/audio/fx/ags_fx_envelope_channel.h`/
28 #include <ags/audio/fx/ags_fx_envelope_channel_processor.h>cxx . . $ `<file>/ags/audio/fx/ags_fx_envelope_channel_processor.h`/
29 #include <ags/audio/fx/ags_fx_envelope_recycling.h>cxx . . $ `<file>/ags/audio/fx/ags_fx_envelope_recycling.h`/
30 #include <ags/audio/fx/ags_fx_pattern_audio_processor.h>cxx . . $ `<file>/ags/audio/fx/ags_fx_pattern_audio_processor.h`/
31 #include <ags/audio/fx/ags_fx_notation_audio_processor.h>cxx . . $ `<file>/ags/audio/fx/ags_fx_notation_audio_processor.h`/
32
33 #include <complex.h>
34
35 #include <ags/i18n.h>cxx . . $ `<file>/ags/i18n.h`/
36
37 void ags_fx_envelope_audio_signal_class_initcxx . . $ ags_fx_envelope_audio_signal_class_init(34eddb32fb4a344).(AgsFxEnvelopeAudioSignalClasscxx . . $ AgsFxEnvelopeAudioSignalClass# *fx_envelope_audio_signal);
38 void ags_fx_envelope_audio_signal_initcxx . . $ ags_fx_envelope_audio_signal_init(1c82ee4aa254ebe1).(AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal# *fx_envelope_audio_signal);
39 void ags_fx_envelope_audio_signal_disposecxx . . $ ags_fx_envelope_audio_signal_dispose(6087475fa43034d3).(GObjectcxx . . $ GObject# *gobject);
40 void ags_fx_envelope_audio_signal_finalizecxx . . $ ags_fx_envelope_audio_signal_finalize(6087475fa43034d3).(GObjectcxx . . $ GObject# *gobject);
41
42 gdoublecxx . . $ gdouble# ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(guintcxx . . $ guint# x0, gdoublecxx . . $ gdouble# y0,
43 guintcxx . . $ guint# x1, gdoublecxx . . $ gdouble# y1);
44 gdoublecxx . . $ gdouble# ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(gdoublecxx . . $ gdouble# volume, gdoublecxx . . $ gdouble# ratio,
45 guintcxx . . $ guint# start_x, guintcxx . . $ guint# current_x,
46 guintcxx . . $ guint# length);
47
48 void ags_fx_envelope_audio_signal_real_run_intercxx . . $ ags_fx_envelope_audio_signal_real_run_inter(c1ad31f527358c62).(AgsRecallcxx . . $ AgsRecall# *recall);
49
50 /**
51 * SECTION:ags_fx_envelope_audio_signal
52 * @short_description: fx envelope audio signal
53 * @title: AgsFxEnvelopeAudioSignal
54 * @section_id:
55 * @include: ags/audio/fx/ags_fx_envelope_audio_signal.h
56 *
57 * The #AgsFxEnvelopeAudioSignal class provides ports to the effect processor.
58 */
59
60 static gpointercxx . . $ gpointer# ags_fx_envelope_audio_signal_parent_classcxx . . $ ags_fx_envelope_audio_signal_parent_class. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
61
62 const gcharcxx . . $ gchar# *ags_fx_envelope_audio_signal_plugin_namecxx . . $ ags_fx_envelope_audio_signal_plugin_name. = "ags-fx-envelope";
63
64 GTypecxx . . $ GType#
65 ags_fx_envelope_audio_signal_get_typecxx . . $ ags_fx_envelope_audio_signal_get_type(7b3bcd0168edf51f).()
66 {
67 static gsizecxx . . $ gsize# g_define_type_id__static = 0;
68
69 if(g_once_init_entercxx . . $ `<external>/457917468643292165/gthread.h:270:10`!(&g_define_type_id__static)){
70 GTypecxx . . $ GType# ags_type_fx_envelope_audio_signal = 0;
71
72 static const GTypeInfocxx . . $ GTypeInfo# ags_fx_envelope_audio_signal_info = {
73 sizeof (AgsFxEnvelopeAudioSignalClasscxx . . $ AgsFxEnvelopeAudioSignalClass#),
74 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, /* base_init */
75 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, /* base_finalize */
76 (GClassInitFunccxx . . $ GClassInitFunc#) ags_fx_envelope_audio_signal_class_initcxx . . $ ags_fx_envelope_audio_signal_class_init(34eddb32fb4a344).,
77 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, /* class_finalize */
78 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, /* class_audio_signal */
79 sizeof (AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal#),
80 0, /* n_preallocs */
81 (GInstanceInitFunccxx . . $ GInstanceInitFunc#) ags_fx_envelope_audio_signal_initcxx . . $ ags_fx_envelope_audio_signal_init(1c82ee4aa254ebe1).,
82 };
83
84 ags_type_fx_envelope_audio_signal = g_type_register_staticcxx . . $ g_type_register_static(805a40cfa272e950).(AGS_TYPE_RECALL_AUDIO_SIGNALcxx . . $ `ags/audio/ags_recall_audio_signal.h:33:9`!,
85 "AgsFxEnvelopeAudioSignal",
86 &ags_fx_envelope_audio_signal_info,
87 0);
88
89 g_once_init_leavecxx . . $ `<external>/457917468643292165/gthread.h:277:10`!(&g_define_type_id__static, ags_type_fx_envelope_audio_signal);
90 }
91
92 return(g_define_type_id__static);
93 }
94
95 void
96 ags_fx_envelope_audio_signal_class_initcxx . . $ ags_fx_envelope_audio_signal_class_init(34eddb32fb4a344).(AgsFxEnvelopeAudioSignalClasscxx . . $ AgsFxEnvelopeAudioSignalClass# *fx_envelope_audio_signal)
97 {
98 GObjectClasscxx . . $ GObjectClass# *gobject;
99 AgsRecallClasscxx . . $ AgsRecallClass# *recall;
100
101 ags_fx_envelope_audio_signal_parent_classcxx . . $ ags_fx_envelope_audio_signal_parent_class. = g_type_class_peek_parentcxx . . $ g_type_class_peek_parent(9f162e79bfc6c74).(fx_envelope_audio_signal);
102
103 /* GObjectClass */
104 gobject = (GObjectClasscxx . . $ GObjectClass# *) fx_envelope_audio_signal;
105
106 gobject->disposecxx . . $ _GObjectClass#dispose. = ags_fx_envelope_audio_signal_disposecxx . . $ ags_fx_envelope_audio_signal_dispose(6087475fa43034d3).;
107 gobject->finalizecxx . . $ _GObjectClass#finalize. = ags_fx_envelope_audio_signal_finalizecxx . . $ ags_fx_envelope_audio_signal_finalize(6087475fa43034d3).;
108
109 /* AgsRecallClass */
110 recall = (AgsRecallClasscxx . . $ AgsRecallClass# *) fx_envelope_audio_signal;
111
112 recall->run_intercxx . . $ _AgsRecallClass#run_inter. = ags_fx_envelope_audio_signal_real_run_intercxx . . $ ags_fx_envelope_audio_signal_real_run_inter(c1ad31f527358c62).;
113 }
114
115 void
116 ags_fx_envelope_audio_signal_initcxx . . $ ags_fx_envelope_audio_signal_init(1c82ee4aa254ebe1).(AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal# *fx_envelope_audio_signal)
117 {
118 AGS_RECALLcxx . . $ `ags/audio/ags_recall.h:41:9`!(fx_envelope_audio_signal)->namecxx . . $ _AgsRecall#name. = "ags-fx-envelope";
119 AGS_RECALLcxx . . $ `ags/audio/ags_recall.h:41:9`!(fx_envelope_audio_signal)->versioncxx . . $ _AgsRecall#version. = AGS_RECALL_DEFAULT_VERSIONcxx . . $ `ags/audio/ags_recall.h:137:9`!;
120 AGS_RECALLcxx . . $ `ags/audio/ags_recall.h:41:9`!(fx_envelope_audio_signal)->build_idcxx . . $ _AgsRecall#build_id. = AGS_RECALL_DEFAULT_BUILD_IDcxx . . $ `ags/audio/ags_recall.h:138:9`!;
121 AGS_RECALLcxx . . $ `ags/audio/ags_recall.h:41:9`!(fx_envelope_audio_signal)->xml_typecxx . . $ _AgsRecall#xml_type. = "ags-fx-envelope-audio-signal";
122 }
123
124 void
125 ags_fx_envelope_audio_signal_disposecxx . . $ ags_fx_envelope_audio_signal_dispose(6087475fa43034d3).(GObjectcxx . . $ GObject# *gobject)
126 {
127 AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal# *fx_envelope_audio_signal;
128
129 fx_envelope_audio_signal = AGS_FX_ENVELOPE_AUDIO_SIGNALcxx . . $ `ags/audio/fx/ags_fx_envelope_audio_signal.h:35:9`!(gobject);
130
131 /* call parent */
132 G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`!(ags_fx_envelope_audio_signal_parent_class)->disposecxx . . $ _GObjectClass#dispose.(gobject);
133 }
134
135 void
136 ags_fx_envelope_audio_signal_finalizecxx . . $ ags_fx_envelope_audio_signal_finalize(6087475fa43034d3).(GObjectcxx . . $ GObject# *gobject)
137 {
138 AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal# *fx_envelope_audio_signal;
139
140 fx_envelope_audio_signal = AGS_FX_ENVELOPE_AUDIO_SIGNALcxx . . $ `ags/audio/fx/ags_fx_envelope_audio_signal.h:35:9`!(gobject);
141
142 /* call parent */
143 G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`!(ags_fx_envelope_audio_signal_parent_class)->finalizecxx . . $ _GObjectClass#finalize.(gobject);
144 }
145
146 gdoublecxx . . $ gdouble#
147 ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(guintcxx . . $ guint# x0, gdoublecxx . . $ gdouble# y0,
148 guintcxx . . $ guint# x1, gdoublecxx . . $ gdouble# y1)
149 {
150 if(x1 - x0 == 0){
151 return(0.0);
152 }else{
153 return((y1 - y0) / (x1 - x0));
154 }
155 }
156
157 gdoublecxx . . $ gdouble#
158 ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(gdoublecxx . . $ gdouble# volume, gdoublecxx . . $ gdouble# ratio,
159 guintcxx . . $ guint# start_x, guintcxx . . $ guint# current_x,
160 guintcxx . . $ guint# length)
161 {
162 gdoublecxx . . $ gdouble# current_volume;
163
164 if(length == 0){
165 return(volume);
166 }else{
167 current_volume = volume + (ratio * (current_x - start_x));
168
169 #if 0
170 g_message("envelope get volume %f %f -> %f", volume, ratio, current_volume);
171 #endif
172
173 return(current_volume);
174 }
175 }
176
177 void
178 ags_fx_envelope_audio_signal_real_run_intercxx . . $ ags_fx_envelope_audio_signal_real_run_inter(c1ad31f527358c62).(AgsRecallcxx . . $ AgsRecall# *recall)
179 {
180 AgsAudiocxx . . $ AgsAudio# *audio;
181 AgsChannelcxx . . $ AgsChannel# *channel;
182 AgsAudioSignalcxx . . $ AgsAudioSignal# *template, *source;
183 AgsFxEnvelopeChannelcxx . . $ AgsFxEnvelopeChannel# *fx_envelope_channel;
184 AgsFxEnvelopeChannelProcessorcxx . . $ AgsFxEnvelopeChannelProcessor# *fx_envelope_channel_processor;
185 AgsFxEnvelopeRecyclingcxx . . $ AgsFxEnvelopeRecycling# *fx_envelope_recycling;
186 AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal# *fx_envelope_audio_signal;
187 AgsFxPatternAudioProcessorcxx . . $ AgsFxPatternAudioProcessor# *fx_pattern_audio_processor;
188 AgsFxNotationAudioProcessorcxx . . $ AgsFxNotationAudioProcessor# *fx_notation_audio_processor;
189 AgsPortcxx . . $ AgsPort# *fixed_length;
190 AgsPortcxx . . $ AgsPort# *attack, *decay, *sustain, *release, *ratio;
191 AgsRecallIDcxx . . $ AgsRecallID# *recall_id;
192 AgsRecyclingContextcxx . . $ AgsRecyclingContext# *parent_recycling_context, *recycling_context;
193
194 GObjectcxx . . $ GObject# *output_soundcard;
195
196 GListcxx . . $ GList# *start_list, *list;
197 GListcxx . . $ GList# *start_note, *note;
198
199 AgsComplexcxx . . $ AgsComplex# cattack, cdecay, csustain, crelease, cratio;
200
201 guintcxx . . $ guint# note_offset, delay_counter;
202 gdoublecxx . . $ gdouble# delay;
203 guintcxx . . $ guint# length;
204 guintcxx . . $ guint# buffer_size;
205 guintcxx . . $ guint# format;
206 gbooleancxx . . $ gboolean# is_pattern;
207 gbooleancxx . . $ gboolean# is_sequencer;
208
209 GRecMutexcxx . . $ GRecMutex# *stream_mutex;
210 GRecMutexcxx . . $ GRecMutex# *attack_mutex, *decay_mutex, *sustain_mutex, *release_mutex, *ratio_mutex;
211
212 output_soundcard = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
213
214 audio = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
215 channel = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
216
217 template = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
218 source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
219
220 recall_id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
221 recycling_context = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
222 parent_recycling_context = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
223
224 fx_envelope_channel = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
225 fx_envelope_channel_processor = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
226 fx_envelope_recycling = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
227 fx_envelope_audio_signal = (AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal# *) recall;
228
229 fixed_length = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
230
231 attack = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
232 decay = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
233 sustain = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
234 release = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
235 ratio = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
236
237 start_note = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
238
239 buffer_size = AGS_SOUNDCARD_DEFAULT_BUFFER_SIZEcxx . . $ `ags/object/ags_soundcard.h:51:9`!;
240 format = AGS_SOUNDCARD_DEFAULT_FORMATcxx . . $ `ags/object/ags_soundcard.h:49:9`!;
241
242 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(recall,
243 "parent", &fx_envelope_recycling,
244 "source", &source,
245 "recall-id", &recall_id,
246 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
247
248 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(recall_id,
249 "recycling-context", &recycling_context,
250 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
251
252 if(recycling_context != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
253 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(recycling_context,
254 "parent", &parent_recycling_context,
255 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
256 }
257
258 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(fx_envelope_recycling,
259 "parent", &fx_envelope_channel_processor,
260 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
261
262 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(fx_envelope_channel_processor,
263 "recall-channel", &fx_envelope_channel,
264 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
265
266 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(fx_envelope_channel,
267 "source", &channel,
268 "fixed-length", &fixed_length,
269 "attack", &attack,
270 "decay", &decay,
271 "sustain", &sustain,
272 "release", &release,
273 "ratio", &ratio,
274 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
275
276 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(source,
277 "output-soundcard", &output_soundcard,
278 "default-template", &template,
279 "note", &start_note,
280 "buffer-size", &buffer_size,
281 "format", &format,
282 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
283
284 if(channel != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
285 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(channel,
286 "audio", &audio,
287 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
288 }
289
290 is_pattern = ags_audio_test_behaviour_flagscxx . . $ ags_audio_test_behaviour_flags(a6fe955640454778).(audio,
291 AGS_SOUND_BEHAVIOUR_PATTERN_MODEcxx . . $ AGS_SOUND_BEHAVIOUR_PATTERN_MODE.);
292
293 is_sequencer = ags_recall_id_check_sound_scopecxx . . $ ags_recall_id_check_sound_scope(b3ed020f0a2d1563).(recall_id,
294 AGS_SOUND_SCOPE_SEQUENCERcxx . . $ AGS_SOUND_SCOPE_SEQUENCER.);
295
296 fx_notation_audio_processor = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
297 fx_pattern_audio_processor = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
298
299 note_offset = ags_soundcard_get_note_offsetcxx . . $ ags_soundcard_get_note_offset(f2f7bfa8e271c0bb).(AGS_SOUNDCARDcxx . . $ `ags/object/ags_soundcard.h:31:9`!(output_soundcard));
300 delay_counter = ags_soundcard_get_delay_countercxx . . $ ags_soundcard_get_delay_counter(f2f7bfa8e271c0bb).(AGS_SOUNDCARDcxx . . $ `ags/object/ags_soundcard.h:31:9`!(output_soundcard));
301
302 delay = ags_soundcard_get_absolute_delaycxx . . $ ags_soundcard_get_absolute_delay(bd40523a2a974031).(AGS_SOUNDCARDcxx . . $ `ags/object/ags_soundcard.h:31:9`!(output_soundcard));
303
304 start_list = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
305
306 if(audio != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
307 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(audio,
308 "recall", &start_list,
309 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
310 }
311
312 if(!is_sequencer){
313 GRecMutexcxx . . $ GRecMutex# *mutex;
314
315 list = ags_recall_find_type_with_recycling_contextcxx . . $ ags_recall_find_type_with_recycling_context(3a26b0f02a99f551).(start_list,
316 AGS_TYPE_FX_NOTATION_AUDIO_PROCESSORcxx . . $ `ags/audio/fx/ags_fx_notation_audio_processor.h:36:9`!, (GObjectcxx . . $ GObject# *) recycling_context);
317
318 if(list != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
319 fx_notation_audio_processor = list->datacxx . . $ _GList#data.;
320 }
321
322 if(fx_notation_audio_processor != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
323 mutex = AGS_RECALL_GET_OBJ_MUTEXcxx . . $ `ags/audio/ags_recall.h:49:9`!(fx_notation_audio_processor);
324
325 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(mutex);
326
327 note_offset = fx_notation_audio_processor->offset_countercxx . . $ _AgsFxNotationAudioProcessor#offset_counter.;
328 delay_counter = fx_notation_audio_processor->delay_countercxx . . $ _AgsFxNotationAudioProcessor#delay_counter.;
329
330 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(mutex);
331 }
332 }else{
333 GRecMutexcxx . . $ GRecMutex# *mutex;
334
335 list = ags_recall_find_type_with_recycling_contextcxx . . $ ags_recall_find_type_with_recycling_context(3a26b0f02a99f551).(start_list,
336 AGS_TYPE_FX_PATTERN_AUDIO_PROCESSORcxx . . $ `ags/audio/fx/ags_fx_pattern_audio_processor.h:34:9`!, (GObjectcxx . . $ GObject# *) recycling_context);
337
338 if(list != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
339 fx_pattern_audio_processor = list->datacxx . . $ _GList#data.;
340 }
341
342 if(fx_pattern_audio_processor != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
343 mutex = AGS_RECALL_GET_OBJ_MUTEXcxx . . $ `ags/audio/ags_recall.h:49:9`!(fx_pattern_audio_processor);
344
345 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(mutex);
346
347 note_offset = fx_pattern_audio_processor->offset_countercxx . . $ _AgsFxPatternAudioProcessor#offset_counter.;
348 delay_counter = fx_pattern_audio_processor->delay_countercxx . . $ _AgsFxPatternAudioProcessor#delay_counter.;
349
350 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(mutex);
351 }
352 }
353
354 g_list_free_fullcxx . . $ g_list_free_full(5ba5b0738c7ed753).(start_list,
355 (GDestroyNotifycxx . . $ GDestroyNotify#) g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
356
357 length = (guintcxx . . $ guint#) floorcxx . . $ floor(447c67c6676f75c3).(delay);
358
359 if(template != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
360 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(template,
361 "length", &length,
362 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
363 }
364
365 if(source != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! &&
366 source->stream_currentcxx . . $ _AgsAudioSignal#stream_current. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
367 stream_mutex = AGS_AUDIO_SIGNAL_GET_STREAM_MUTEXcxx . . $ `ags/audio/ags_audio_signal.h:41:9`!(source);
368
369 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..destination_stridecxx . . $ _AgsEnvelopeUtil#destination_stride. = 1;
370
371 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..source_stridecxx . . $ _AgsEnvelopeUtil#source_stride. = 1;
372
373 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..formatcxx . . $ _AgsEnvelopeUtil#format. = format;
374
375 if(start_note != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
376 note = start_note;
377
378 while(note != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
379 if(ags_note_test_flagscxx . . $ ags_note_test_flags(a425de7e6af9fc3).(AGS_NOTEcxx . . $ `ags/audio/ags_note.h:35:9`!(note->data), AGS_NOTE_ENVELOPEcxx . . $ AGS_NOTE_ENVELOPE.)){
380 AgsNotecxx . . $ AgsNote# *current_note;
381
382 gdoublecxx . . $ gdouble# envelope_x0, envelope_y0;
383 gdoublecxx . . $ gdouble# envelope_x1, envelope_y1;
384 gdoublecxx . . $ gdouble# envelope_current_x;
385
386 guintcxx . . $ guint# envelope_start_frame, envelope_end_frame;
387
388 guintcxx . . $ guint# x0, x1;
389 guintcxx . . $ guint# frame_count, current_frame;
390 guintcxx . . $ guint# current_frame_count, trailing_frame_count;
391 guintcxx . . $ guint# offset;
392
393 gdoublecxx . . $ gdouble# current_volume, current_ratio;
394
395 GRecMutexcxx . . $ GRecMutex# *note_mutex;
396
397 current_note = note->datacxx . . $ _GList#data.;
398
399 /* get note mutex */
400 note_mutex = AGS_NOTE_GET_OBJ_MUTEXcxx . . $ `ags/audio/ags_note.h:41:9`!(current_note);
401
402 x0 = 0;
403 x1 = 1;
404
405 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(current_note,
406 "x0", &x0,
407 "x1", &x1,
408 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
409
410 if(note_offset < x0){
411 note = note->nextcxx . . $ _GList#next.;
412
413 continue;
414 }
415
416 /* get note envelope */
417 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(note_mutex);
418
419 cattack.realcxx . . $ _AgsComplex#real. = current_note->attackcxx . . $ _AgsNote#attack..realcxx . . $ _AgsComplex#real.;
420 cattack.imagcxx . . $ _AgsComplex#imag. = current_note->attackcxx . . $ _AgsNote#attack..imagcxx . . $ _AgsComplex#imag.;
421
422 cdecay.realcxx . . $ _AgsComplex#real. = current_note->decaycxx . . $ _AgsNote#decay..realcxx . . $ _AgsComplex#real.;
423 cdecay.imagcxx . . $ _AgsComplex#imag. = current_note->decaycxx . . $ _AgsNote#decay..imagcxx . . $ _AgsComplex#imag.;
424
425 csustain.realcxx . . $ _AgsComplex#real. = current_note->sustaincxx . . $ _AgsNote#sustain..realcxx . . $ _AgsComplex#real.;
426 csustain.imagcxx . . $ _AgsComplex#imag. = current_note->sustaincxx . . $ _AgsNote#sustain..imagcxx . . $ _AgsComplex#imag.;
427
428 crelease.realcxx . . $ _AgsComplex#real. = current_note->releasecxx . . $ _AgsNote#release..realcxx . . $ _AgsComplex#real.;
429 crelease.imagcxx . . $ _AgsComplex#imag. = current_note->releasecxx . . $ _AgsNote#release..imagcxx . . $ _AgsComplex#imag.;
430
431 cratio.realcxx . . $ _AgsComplex#real. = current_note->ratiocxx . . $ _AgsNote#ratio..realcxx . . $ _AgsComplex#real.;
432 cratio.imagcxx . . $ _AgsComplex#imag. = current_note->ratiocxx . . $ _AgsNote#ratio..imagcxx . . $ _AgsComplex#imag.;
433
434 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(note_mutex);
435
436 /* get frame count */
437 if(!is_pattern){
438 frame_count = (x1 - x0) * (delay * buffer_size);
439 }else{
440 frame_count = length * buffer_size;
441 }
442
443 #if 0
444 g_message("frame-count: %d", frame_count);
445 #endif
446
447 current_frame = 0;
448 offset = 0;
449
450 if(note_offset >= x0){
451 current_frame = (guintcxx . . $ guint#) floorcxx . . $ floor(447c67c6676f75c3).(((gdoublecxx . . $ gdouble#) (note_offset - x0) * delay + delay_counter) * buffer_size);
452 }
453
454 #if 0
455 g_message("current-frame: %d", current_frame);
456 #endif
457
458 /* special case release - #0 key offset bigger than note offset */
459 if(x1 < note_offset){
460 AgsVolumeUtilcxx . . $ AgsVolumeUtil# volume_util;
461
462 envelope_current_x = cattack.realcxx . . $ _AgsComplex#real. + cdecay.realcxx . . $ _AgsComplex#real.;
463
464 envelope_x0 = csustain.realcxx . . $ _AgsComplex#real.;
465 envelope_y0 = csustain.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
466
467 envelope_x1 = crelease.realcxx . . $ _AgsComplex#real.;
468 envelope_y1 = crelease.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
469
470 envelope_start_frame = (envelope_current_x + envelope_x0) * frame_count;
471 envelope_end_frame = (envelope_current_x + envelope_x0 + envelope_x1) * frame_count;
472
473 current_ratio = ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(0, envelope_y0,
474 envelope_end_frame - envelope_start_frame, envelope_y1);
475 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
476 0, envelope_end_frame - envelope_start_frame,
477 envelope_end_frame - envelope_start_frame);
478
479 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
480
481 volume_util.destinationcxx . . $ _AgsVolumeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data.;
482 volume_util.destination_stridecxx . . $ _AgsVolumeUtil#destination_stride. = 1;
483
484 volume_util.sourcecxx . . $ _AgsVolumeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data.;
485 volume_util.source_stridecxx . . $ _AgsVolumeUtil#source_stride. = 1;
486
487 volume_util.buffer_lengthcxx . . $ _AgsVolumeUtil#buffer_length. = buffer_size;
488 volume_util.formatcxx . . $ _AgsVolumeUtil#format. = format;
489
490 volume_util.volumecxx . . $ _AgsVolumeUtil#volume. = current_volume;
491
492 ags_volume_util_computecxx . . $ ags_volume_util_compute(5b0b6bc36931bdf4).(&volume_util);
493
494 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
495
496 /* iterate */
497 note = note->nextcxx . . $ _GList#next.;
498
499 continue;
500 }
501
502 //TODO:JK: implement me
503
504 /* special case not applicable - #0 key offset lower than note offset */
505 if(x0 > note_offset){
506 /* iterate */
507 note = note->nextcxx . . $ _GList#next.;
508
509 continue;
510 }
511
512 envelope_current_x = 0.0;
513
514 /* attack */
515 envelope_x0 = 0.0;
516 envelope_y0 = cratio.imagcxx . . $ _AgsComplex#imag.;
517
518 envelope_x1 = cattack.realcxx . . $ _AgsComplex#real.;
519 envelope_y1 = cattack.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
520
521 envelope_start_frame = (guintcxx . . $ guint#) floorcxx . . $ floor(447c67c6676f75c3).((envelope_current_x + envelope_x0) * (double) frame_count);
522 envelope_end_frame = (guintcxx . . $ guint#) floorcxx . . $ floor(447c67c6676f75c3).((envelope_current_x + envelope_x0 + envelope_x1) * (double) frame_count);
523
524 #if 0
525 g_message("attack - first-frame: %d -> %d::%d", offset, envelope_start_frame, envelope_end_frame);
526 #endif
527
528 if(envelope_start_frame <= current_frame &&
529 envelope_end_frame > current_frame){
530 if(envelope_end_frame - current_frame < buffer_size){
531 current_frame_count = envelope_end_frame - current_frame;
532 }else{
533 current_frame_count = buffer_size;
534 }
535
536 current_ratio = ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(0, envelope_y0,
537 envelope_end_frame - envelope_start_frame, envelope_y1);
538 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
539 0, current_frame - envelope_start_frame,
540 envelope_end_frame - envelope_start_frame);
541
542 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
543
544 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..destinationcxx . . $ _AgsEnvelopeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
545
546 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..sourcecxx . . $ _AgsEnvelopeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
547
548 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..volumecxx . . $ _AgsEnvelopeUtil#volume. = current_volume;
549
550 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..amountcxx . . $ _AgsEnvelopeUtil#amount. = current_ratio;
551
552 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..buffer_lengthcxx . . $ _AgsEnvelopeUtil#buffer_length. = current_frame_count;
553
554 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..offsetcxx . . $ _AgsEnvelopeUtil#offset. = envelope_start_frame;
555
556 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
557
558 if(ags_note_test_flagscxx . . $ ags_note_test_flags(a425de7e6af9fc3).(AGS_NOTEcxx . . $ `ags/audio/ags_note.h:35:9`!(note->data), AGS_NOTE_ENVELOPE_LFOcxx . . $ AGS_NOTE_ENVELOPE_LFO.)){
559 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
560 }
561
562 ags_envelope_util_computecxx . . $ ags_envelope_util_compute(3b498363814f3d8d).(&(fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util.));
563
564 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
565
566 current_frame += current_frame_count;
567 offset += current_frame_count;
568 }
569
570 if(offset >= buffer_size){
571 /* iterate */
572 note = note->nextcxx . . $ _GList#next.;
573
574 continue;
575 }
576
577 envelope_current_x = 0.0;
578
579 /* decay */
580 envelope_x0 = cattack.realcxx . . $ _AgsComplex#real.;
581 envelope_y0 = cattack.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
582
583 envelope_x1 = cdecay.realcxx . . $ _AgsComplex#real.;
584 envelope_y1 = cdecay.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
585
586 envelope_start_frame = (guintcxx . . $ guint#) floorcxx . . $ floor(447c67c6676f75c3).((envelope_current_x + envelope_x0) * (double) frame_count);
587 envelope_end_frame = (guintcxx . . $ guint#) floorcxx . . $ floor(447c67c6676f75c3).((envelope_current_x + envelope_x0 + envelope_x1) * (double) frame_count);
588
589 #if 0
590 g_message("decay - first-frame: %d -> %d::%d", offset, envelope_start_frame, envelope_end_frame);
591 #endif
592
593 if(envelope_start_frame <= current_frame &&
594 envelope_end_frame > current_frame){
595 if(envelope_end_frame - current_frame < buffer_size){
596 current_frame_count = envelope_end_frame - current_frame;
597 }else{
598 current_frame_count = buffer_size - offset;
599 }
600
601 current_ratio = ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(0, envelope_y0,
602 envelope_end_frame - envelope_start_frame, envelope_y1);
603 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
604 0, current_frame - envelope_start_frame,
605 envelope_end_frame - envelope_start_frame);
606
607 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
608
609 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..destinationcxx . . $ _AgsEnvelopeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
610
611 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..sourcecxx . . $ _AgsEnvelopeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
612
613 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..volumecxx . . $ _AgsEnvelopeUtil#volume. = current_volume;
614
615 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..amountcxx . . $ _AgsEnvelopeUtil#amount. = current_ratio;
616
617 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..buffer_lengthcxx . . $ _AgsEnvelopeUtil#buffer_length. = current_frame_count;
618
619 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..offsetcxx . . $ _AgsEnvelopeUtil#offset. = envelope_start_frame;
620
621 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
622
623 if(ags_note_test_flagscxx . . $ ags_note_test_flags(a425de7e6af9fc3).(AGS_NOTEcxx . . $ `ags/audio/ags_note.h:35:9`!(note->data), AGS_NOTE_ENVELOPE_LFOcxx . . $ AGS_NOTE_ENVELOPE_LFO.)){
624 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
625 }
626
627 ags_envelope_util_computecxx . . $ ags_envelope_util_compute(3b498363814f3d8d).(&(fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util.));
628
629 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
630
631 current_frame += current_frame_count;
632 offset += current_frame_count;
633 }
634
635 if(offset >= buffer_size){
636 /* iterate */
637 note = note->nextcxx . . $ _GList#next.;
638
639 continue;
640 }
641
642 envelope_current_x = cattack.realcxx . . $ _AgsComplex#real.;
643
644 /* sustain */
645 envelope_x0 = cdecay.realcxx . . $ _AgsComplex#real.;
646 envelope_y0 = cdecay.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
647
648 envelope_x1 = csustain.realcxx . . $ _AgsComplex#real.;
649 envelope_y1 = csustain.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
650
651 envelope_start_frame = (guintcxx . . $ guint#) floorcxx . . $ floor(447c67c6676f75c3).((envelope_current_x + envelope_x0) * (double) frame_count);
652 envelope_end_frame = (guintcxx . . $ guint#) floorcxx . . $ floor(447c67c6676f75c3).((envelope_current_x + envelope_x0 + envelope_x1) * (double) frame_count);
653
654 #if 0
655 g_message("sustain - first-frame: %d -> %d::%d", offset, envelope_start_frame, envelope_end_frame);
656 #endif
657
658 if(envelope_start_frame <= current_frame &&
659 envelope_end_frame > current_frame){
660 if(envelope_end_frame - current_frame < buffer_size){
661 current_frame_count = envelope_end_frame - current_frame;
662 }else{
663 current_frame_count = buffer_size - offset;
664 }
665
666 current_ratio = ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(0, envelope_y0,
667 envelope_end_frame - envelope_start_frame, envelope_y1);
668 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
669 0, current_frame - envelope_start_frame,
670 envelope_end_frame - envelope_start_frame);
671
672 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
673
674 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..destinationcxx . . $ _AgsEnvelopeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
675
676 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..sourcecxx . . $ _AgsEnvelopeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
677
678 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..volumecxx . . $ _AgsEnvelopeUtil#volume. = current_volume;
679
680 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..amountcxx . . $ _AgsEnvelopeUtil#amount. = current_ratio;
681
682 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..buffer_lengthcxx . . $ _AgsEnvelopeUtil#buffer_length. = current_frame_count;
683
684 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..offsetcxx . . $ _AgsEnvelopeUtil#offset. = envelope_start_frame;
685
686 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
687
688 if(ags_note_test_flagscxx . . $ ags_note_test_flags(a425de7e6af9fc3).(AGS_NOTEcxx . . $ `ags/audio/ags_note.h:35:9`!(note->data), AGS_NOTE_ENVELOPE_LFOcxx . . $ AGS_NOTE_ENVELOPE_LFO.)){
689 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
690 }
691
692 ags_envelope_util_computecxx . . $ ags_envelope_util_compute(3b498363814f3d8d).(&(fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util.));
693
694 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
695
696 current_frame += current_frame_count;
697 offset += current_frame_count;
698 }
699
700 if(offset >= buffer_size){
701 /* iterate */
702 note = note->nextcxx . . $ _GList#next.;
703
704 continue;
705 }
706
707 envelope_current_x = cdecay.realcxx . . $ _AgsComplex#real. + csustain.realcxx . . $ _AgsComplex#real.;
708
709 /* release */
710 envelope_x0 = csustain.realcxx . . $ _AgsComplex#real.;
711 envelope_y0 = csustain.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
712
713 envelope_x1 = crelease.realcxx . . $ _AgsComplex#real.;
714 envelope_y1 = crelease.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
715
716 envelope_start_frame = (guintcxx . . $ guint#) floorcxx . . $ floor(447c67c6676f75c3).((envelope_current_x + envelope_x0) * (double) frame_count);
717 envelope_end_frame = (guintcxx . . $ guint#) floorcxx . . $ floor(447c67c6676f75c3).((envelope_current_x + envelope_x0 + envelope_x1) * (double) frame_count);
718
719 #if 0
720 g_message("release - first-frame: %d -> %d::%d", offset, envelope_start_frame, envelope_end_frame);
721 #endif
722
723 if(envelope_start_frame <= current_frame &&
724 envelope_end_frame > current_frame){
725 trailing_frame_count = 0;
726
727 if(envelope_end_frame - current_frame < buffer_size){
728 current_frame_count = envelope_end_frame - current_frame;
729
730 trailing_frame_count = buffer_size - current_frame_count;
731 }else{
732 current_frame_count = buffer_size - offset;
733 }
734
735 current_ratio = ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(0, envelope_y0,
736 envelope_end_frame - envelope_start_frame, envelope_y1);
737 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
738 0, current_frame - envelope_start_frame,
739 envelope_end_frame - envelope_start_frame);
740
741 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
742
743 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..destinationcxx . . $ _AgsEnvelopeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
744
745 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..sourcecxx . . $ _AgsEnvelopeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
746
747 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..volumecxx . . $ _AgsEnvelopeUtil#volume. = current_volume;
748
749 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..amountcxx . . $ _AgsEnvelopeUtil#amount. = current_ratio;
750
751 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..buffer_lengthcxx . . $ _AgsEnvelopeUtil#buffer_length. = current_frame_count;
752
753 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..offsetcxx . . $ _AgsEnvelopeUtil#offset. = envelope_start_frame;
754
755 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
756
757 if(ags_note_test_flagscxx . . $ ags_note_test_flags(a425de7e6af9fc3).(AGS_NOTEcxx . . $ `ags/audio/ags_note.h:35:9`!(note->data), AGS_NOTE_ENVELOPE_LFOcxx . . $ AGS_NOTE_ENVELOPE_LFO.)){
758 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
759 }
760
761 ags_envelope_util_computecxx . . $ ags_envelope_util_compute(3b498363814f3d8d).(&(fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util.));
762
763 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
764
765 offset += current_frame_count;
766
767 if(trailing_frame_count != 0){
768 AgsVolumeUtilcxx . . $ AgsVolumeUtil# volume_util;
769
770 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
771 0, envelope_end_frame - envelope_start_frame,
772 envelope_end_frame);
773
774 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
775
776 volume_util.destinationcxx . . $ _AgsVolumeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data.;
777 volume_util.destination_stridecxx . . $ _AgsVolumeUtil#destination_stride. = 1;
778
779 volume_util.sourcecxx . . $ _AgsVolumeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data.;
780 volume_util.source_stridecxx . . $ _AgsVolumeUtil#source_stride. = 1;
781
782 volume_util.buffer_lengthcxx . . $ _AgsVolumeUtil#buffer_length. = buffer_size;
783 volume_util.formatcxx . . $ _AgsVolumeUtil#format. = format;
784
785 volume_util.volumecxx . . $ _AgsVolumeUtil#volume. = current_volume;
786
787 ags_volume_util_computecxx . . $ ags_volume_util_compute(5b0b6bc36931bdf4).(&volume_util);
788
789 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
790 }
791 }
792 }
793
794 note = note->nextcxx . . $ _GList#next.;
795 }
796 }
797 }
798
799 if(source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ||
800 source->stream_currentcxx . . $ _AgsAudioSignal#stream_current. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
801 ags_recall_donecxx . . $ ags_recall_done(c1ad31f527358c62).(recall);
802 }
803
804 if(audio != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
805 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(audio);
806 }
807
808 if(channel != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
809 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(channel);
810 }
811
812 if(output_soundcard != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
813 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(output_soundcard);
814 }
815
816 if(template != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
817 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(template);
818 }
819
820 if(source != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
821 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(source);
822 }
823
824 if(recall_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
825 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(recall_id);
826 }
827
828 if(recycling_context != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
829 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(recycling_context);
830 }
831
832 if(parent_recycling_context != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
833 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(parent_recycling_context);
834 }
835
836 if(fx_envelope_channel != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
837 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(fx_envelope_channel);
838 }
839
840 if(fixed_length != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
841 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(fixed_length);
842 }
843
844 if(attack != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
845 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(attack);
846 }
847
848 if(decay != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
849 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(decay);
850 }
851
852 if(sustain != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
853 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(sustain);
854 }
855
856 if(release != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
857 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(release);
858 }
859
860 if(ratio != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
861 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(ratio);
862 }
863
864 if(fx_envelope_channel_processor != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
865 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(fx_envelope_channel_processor);
866 }
867
868 if(fx_envelope_recycling != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){
869 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(fx_envelope_recycling);
870 }
871
872 g_list_free_fullcxx . . $ g_list_free_full(5ba5b0738c7ed753).(start_note,
873 (GDestroyNotifycxx . . $ GDestroyNotify#) g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
874
875 /* call parent */
876 AGS_RECALL_CLASScxx . . $ `ags/audio/ags_recall.h:42:9`!(ags_fx_envelope_audio_signal_parent_class)->run_intercxx . . $ _AgsRecallClass#run_inter.(recall);
877 }
878
879 /**
880 * ags_fx_envelope_audio_signal_new:
881 * @audio_signal: the #AgsAudioSignal
882 *
883 * Create a new instance of #AgsFxEnvelopeAudioSignal
884 *
885 * Returns: the new #AgsFxEnvelopeAudioSignal
886 *
887 * Since: 3.3.0
888 */
889 AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal#*
890 ags_fx_envelope_audio_signal_newcxx . . $ ags_fx_envelope_audio_signal_new(7bea34ea1f6219d6).(AgsAudioSignalcxx . . $ AgsAudioSignal# *audio_signal)
891 {
892 AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal# *fx_envelope_audio_signal;
893
894 fx_envelope_audio_signal = (AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal# *) g_object_newcxx . . $ g_object_new(8485fe61b4be4c78).(AGS_TYPE_FX_ENVELOPE_AUDIO_SIGNALcxx . . $ `ags/audio/fx/ags_fx_envelope_audio_signal.h:34:9`!,
895 "source", audio_signal,
896 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
897
898 return(fx_envelope_audio_signal);
899 }