Debian Codegraph @

ags/audio/fx/ags_fx_envelope_audio_signal.c

raw symbols SCIP
1 /* GSequencer - Advanced GTK Sequencer
2 * Copyright (C) 2005-2026 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 static void ags_fx_envelope_audio_signal_class_initcxx . . $ ags_fx_envelope_audio_signal_class_init(34eddb32fb4a344).(AgsFxEnvelopeAudioSignalClasscxx . . $ AgsFxEnvelopeAudioSignalClass# *fx_envelope_audio_signal);
38 static void ags_fx_envelope_audio_signal_initcxx . . $ ags_fx_envelope_audio_signal_init(1c82ee4aa254ebe1).(AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal# *fx_envelope_audio_signal);
39 static void ags_fx_envelope_audio_signal_disposecxx . . $ ags_fx_envelope_audio_signal_dispose(6087475fa43034d3).(GObjectcxx . . $ GObject# *gobject);
40 static void ags_fx_envelope_audio_signal_finalizecxx . . $ ags_fx_envelope_audio_signal_finalize(6087475fa43034d3).(GObjectcxx . . $ GObject# *gobject);
41
42 static 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 static 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 static 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/16/include/stddef.h:419:9`!;
61
62 static 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/16/include/stddef.h:419:9`!, /* base_init */
75 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/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/16/include/stddef.h:419:9`!, /* class_finalize */
78 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/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:42:9`!(fx_envelope_audio_signal)->namecxx . . $ _AgsRecall#name. = "ags-fx-envelope";
119 AGS_RECALLcxx . . $ `ags/audio/ags_recall.h:42:9`!(fx_envelope_audio_signal)->versioncxx . . $ _AgsRecall#version. = AGS_RECALL_DEFAULT_VERSIONcxx . . $ `ags/audio/ags_recall.h:52:9`!;
120 AGS_RECALLcxx . . $ `ags/audio/ags_recall.h:42:9`!(fx_envelope_audio_signal)->build_idcxx . . $ _AgsRecall#build_id. = AGS_RECALL_DEFAULT_BUILD_IDcxx . . $ `ags/audio/ags_recall.h:53:9`!;
121 AGS_RECALLcxx . . $ `ags/audio/ags_recall.h:42: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 AgsFrameClockcxx . . $ AgsFrameClock# *frame_clock;
195
196 GObjectcxx . . $ GObject# *output_soundcard;
197
198 GListcxx . . $ GList# *start_list, *list;
199 GListcxx . . $ GList# *start_note, *note;
200
201 AgsComplexcxx . . $ AgsComplex# cattack, cdecay, csustain, crelease, cratio;
202
203 guint64cxx . . $ guint64# note_offset;
204 gdoublecxx . . $ gdouble# delay, delay_counter;
205 guintcxx . . $ guint# length;
206 guintcxx . . $ guint# buffer_size;
207 guintcxx . . $ guint# format;
208 gbooleancxx . . $ gboolean# is_pattern;
209 gbooleancxx . . $ gboolean# is_sequencer;
210
211 GRecMutexcxx . . $ GRecMutex# *stream_mutex;
212 GRecMutexcxx . . $ GRecMutex# *attack_mutex, *decay_mutex, *sustain_mutex, *release_mutex, *ratio_mutex;
213
214 output_soundcard = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
215
216 audio = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
217 channel = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
218
219 template = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
220 source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
221
222 recall_id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
223 recycling_context = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
224 parent_recycling_context = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
225
226 fx_envelope_channel = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
227 fx_envelope_channel_processor = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
228 fx_envelope_recycling = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
229 fx_envelope_audio_signal = (AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal# *) recall;
230
231 fixed_length = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
232
233 attack = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
234 decay = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
235 sustain = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
236 release = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
237 ratio = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
238
239 start_note = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
240
241 buffer_size = AGS_SOUNDCARD_DEFAULT_BUFFER_SIZEcxx . . $ `ags/object/ags_soundcard.h:51:9`!;
242 format = AGS_SOUNDCARD_DEFAULT_FORMATcxx . . $ `ags/object/ags_soundcard.h:49:9`!;
243
244 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(recall,
245 "parent", &fx_envelope_recycling,
246 "source", &source,
247 "recall-id", &recall_id,
248 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
249
250 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(recall_id,
251 "recycling-context", &recycling_context,
252 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
253
254 if(recycling_context != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
255 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(recycling_context,
256 "parent", &parent_recycling_context,
257 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
258 }
259
260 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(fx_envelope_recycling,
261 "parent", &fx_envelope_channel_processor,
262 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
263
264 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(fx_envelope_channel_processor,
265 "recall-channel", &fx_envelope_channel,
266 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
267
268 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(fx_envelope_channel,
269 "source", &channel,
270 "fixed-length", &fixed_length,
271 "attack", &attack,
272 "decay", &decay,
273 "sustain", &sustain,
274 "release", &release,
275 "ratio", &ratio,
276 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
277
278 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(source,
279 "output-soundcard", &output_soundcard,
280 "default-template", &template,
281 "note", &start_note,
282 "buffer-size", &buffer_size,
283 "format", &format,
284 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
285
286 if(channel != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
287 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(channel,
288 "audio", &audio,
289 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
290 }
291
292 is_pattern = ags_audio_test_behaviour_flagscxx . . $ ags_audio_test_behaviour_flags(a6fe955640454778).(audio,
293 AGS_SOUND_BEHAVIOUR_PATTERN_MODEcxx . . $ AGS_SOUND_BEHAVIOUR_PATTERN_MODE.);
294
295 is_sequencer = ags_recall_id_check_sound_scopecxx . . $ ags_recall_id_check_sound_scope(b3ed020f0a2d1563).(recall_id,
296 AGS_SOUND_SCOPE_SEQUENCERcxx . . $ AGS_SOUND_SCOPE_SEQUENCER.);
297
298 fx_notation_audio_processor = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
299 fx_pattern_audio_processor = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
300
301 frame_clock = (AgsFrameClockcxx . . $ AgsFrameClock# *) ags_soundcard_get_frame_clockcxx . . $ ags_soundcard_get_frame_clock(38e425f6d0f138ed).(AGS_SOUNDCARDcxx . . $ `ags/object/ags_soundcard.h:31:9`!(output_soundcard));
302
303 note_offset = ags_frame_clock_get_note_offsetcxx . . $ ags_frame_clock_get_note_offset(de64f1eccbd77803).(frame_clock);
304
305 delay = (gdoublecxx . . $ gdouble#) frame_clock->absolute_delaycxx . . $ _AgsFrameClock#absolute_delay.;
306
307 delay_counter = (gdoublecxx . . $ gdouble#) frame_clock->delay_countercxx . . $ _AgsFrameClock#delay_counter.;
308
309 start_list = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
310
311 if(audio != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
312 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(audio,
313 "recall", &start_list,
314 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
315 }
316
317 if(!is_sequencer){
318 GRecMutexcxx . . $ GRecMutex# *mutex;
319
320 list = ags_recall_find_type_with_recycling_contextcxx . . $ ags_recall_find_type_with_recycling_context(3a26b0f02a99f551).(start_list,
321 AGS_TYPE_FX_NOTATION_AUDIO_PROCESSORcxx . . $ `ags/audio/fx/ags_fx_notation_audio_processor.h:36:9`!, (GObjectcxx . . $ GObject# *) recycling_context);
322
323 if(list != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
324 fx_notation_audio_processor = list->datacxx . . $ _GList#data.;
325 }
326
327 if(fx_notation_audio_processor != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
328 mutex = AGS_RECALL_GET_OBJ_MUTEXcxx . . $ `ags/audio/ags_recall.h:50:9`!(fx_notation_audio_processor);
329
330 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(mutex);
331
332 note_offset = ags_frame_clock_get_note_offsetcxx . . $ ags_frame_clock_get_note_offset(de64f1eccbd77803).(fx_notation_audio_processor->frame_clockcxx . . $ _AgsFxNotationAudioProcessor#frame_clock.);
333
334 delay_counter = (gdoublecxx . . $ gdouble#) fx_notation_audio_processor->frame_clockcxx . . $ _AgsFxNotationAudioProcessor#frame_clock.->delay_countercxx . . $ _AgsFrameClock#delay_counter.;
335
336 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(mutex);
337 }
338 }else{
339 GRecMutexcxx . . $ GRecMutex# *mutex;
340
341 list = ags_recall_find_type_with_recycling_contextcxx . . $ ags_recall_find_type_with_recycling_context(3a26b0f02a99f551).(start_list,
342 AGS_TYPE_FX_PATTERN_AUDIO_PROCESSORcxx . . $ `ags/audio/fx/ags_fx_pattern_audio_processor.h:34:9`!, (GObjectcxx . . $ GObject# *) recycling_context);
343
344 if(list != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
345 fx_pattern_audio_processor = list->datacxx . . $ _GList#data.;
346 }
347
348 if(fx_pattern_audio_processor != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
349 mutex = AGS_RECALL_GET_OBJ_MUTEXcxx . . $ `ags/audio/ags_recall.h:50:9`!(fx_pattern_audio_processor);
350
351 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(mutex);
352
353 note_offset = ags_frame_clock_get_note_offsetcxx . . $ ags_frame_clock_get_note_offset(de64f1eccbd77803).(fx_pattern_audio_processor->frame_clockcxx . . $ _AgsFxPatternAudioProcessor#frame_clock.);
354
355 delay_counter = (gdoublecxx . . $ gdouble#) fx_pattern_audio_processor->frame_clockcxx . . $ _AgsFxPatternAudioProcessor#frame_clock.->delay_countercxx . . $ _AgsFrameClock#delay_counter.;
356
357 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(mutex);
358 }
359 }
360
361 g_list_free_fullcxx . . $ g_list_free_full(5ba5b0738c7ed753).(start_list,
362 (GDestroyNotifycxx . . $ GDestroyNotify#) g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
363
364 length = (guintcxx . . $ guint#) floor(delay);
365
366 if(template != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
367 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(template,
368 "length", &length,
369 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
370 }
371
372 if(source != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! &&
373 source->stream_currentcxx . . $ _AgsAudioSignal#stream_current. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
374 stream_mutex = AGS_AUDIO_SIGNAL_GET_STREAM_MUTEXcxx . . $ `ags/audio/ags_audio_signal.h:41:9`!(source);
375
376 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..destination_stridecxx . . $ _AgsEnvelopeUtil#destination_stride. = 1;
377
378 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..source_stridecxx . . $ _AgsEnvelopeUtil#source_stride. = 1;
379
380 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..formatcxx . . $ _AgsEnvelopeUtil#format. = format;
381
382 if(start_note != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
383 note = start_note;
384
385 while(note != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
386 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.)){
387 AgsNotecxx . . $ AgsNote# *current_note;
388
389 gdoublecxx . . $ gdouble# envelope_x0, envelope_y0;
390 gdoublecxx . . $ gdouble# envelope_x1, envelope_y1;
391 gdoublecxx . . $ gdouble# envelope_current_x;
392
393 guintcxx . . $ guint# envelope_start_frame, envelope_end_frame;
394
395 guintcxx . . $ guint# x0, x1;
396 guintcxx . . $ guint# frame_count, current_frame;
397 guintcxx . . $ guint# current_frame_count, trailing_frame_count;
398 guintcxx . . $ guint# offset;
399
400 gdoublecxx . . $ gdouble# current_volume, current_ratio;
401
402 GRecMutexcxx . . $ GRecMutex# *note_mutex;
403
404 current_note = note->datacxx . . $ _GList#data.;
405
406 /* get note mutex */
407 note_mutex = AGS_NOTE_GET_OBJ_MUTEXcxx . . $ `ags/audio/ags_note.h:41:9`!(current_note);
408
409 x0 = 0;
410 x1 = 1;
411
412 g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d).(current_note,
413 "x0", &x0,
414 "x1", &x1,
415 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
416
417 if(note_offset < x0){
418 note = note->nextcxx . . $ _GList#next.;
419
420 continue;
421 }
422
423 /* get note envelope */
424 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(note_mutex);
425
426 cattack.realcxx . . $ _AgsComplex#real. = current_note->attackcxx . . $ _AgsNote#attack..realcxx . . $ _AgsComplex#real.;
427 cattack.imagcxx . . $ _AgsComplex#imag. = current_note->attackcxx . . $ _AgsNote#attack..imagcxx . . $ _AgsComplex#imag.;
428
429 cdecay.realcxx . . $ _AgsComplex#real. = current_note->decaycxx . . $ _AgsNote#decay..realcxx . . $ _AgsComplex#real.;
430 cdecay.imagcxx . . $ _AgsComplex#imag. = current_note->decaycxx . . $ _AgsNote#decay..imagcxx . . $ _AgsComplex#imag.;
431
432 csustain.realcxx . . $ _AgsComplex#real. = current_note->sustaincxx . . $ _AgsNote#sustain..realcxx . . $ _AgsComplex#real.;
433 csustain.imagcxx . . $ _AgsComplex#imag. = current_note->sustaincxx . . $ _AgsNote#sustain..imagcxx . . $ _AgsComplex#imag.;
434
435 crelease.realcxx . . $ _AgsComplex#real. = current_note->releasecxx . . $ _AgsNote#release..realcxx . . $ _AgsComplex#real.;
436 crelease.imagcxx . . $ _AgsComplex#imag. = current_note->releasecxx . . $ _AgsNote#release..imagcxx . . $ _AgsComplex#imag.;
437
438 cratio.realcxx . . $ _AgsComplex#real. = current_note->ratiocxx . . $ _AgsNote#ratio..realcxx . . $ _AgsComplex#real.;
439 cratio.imagcxx . . $ _AgsComplex#imag. = current_note->ratiocxx . . $ _AgsNote#ratio..imagcxx . . $ _AgsComplex#imag.;
440
441 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(note_mutex);
442
443 /* get frame count */
444 if(!is_pattern){
445 frame_count = (x1 - x0) * (delay * buffer_size);
446 }else{
447 frame_count = length * buffer_size;
448 }
449
450 #if 0
451 g_message("frame-count: %d", frame_count);
452 #endif
453
454 current_frame = 0;
455 offset = 0;
456
457 if(note_offset >= x0){
458 current_frame = (guintcxx . . $ guint#) floor(((gdoublecxx . . $ gdouble#) (note_offset - x0) * delay + delay_counter) * buffer_size);
459 }
460
461 #if 0
462 g_message("current-frame: %d", current_frame);
463 #endif
464
465 /* special case release - #0 key offset bigger than note offset */
466 if(x1 < note_offset){
467 AgsVolumeUtilcxx . . $ AgsVolumeUtil# volume_util;
468
469 envelope_current_x = cattack.realcxx . . $ _AgsComplex#real. + cdecay.realcxx . . $ _AgsComplex#real.;
470
471 envelope_x0 = csustain.realcxx . . $ _AgsComplex#real.;
472 envelope_y0 = csustain.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
473
474 envelope_x1 = crelease.realcxx . . $ _AgsComplex#real.;
475 envelope_y1 = crelease.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
476
477 envelope_start_frame = (envelope_current_x + envelope_x0) * frame_count;
478 envelope_end_frame = (envelope_current_x + envelope_x0 + envelope_x1) * frame_count;
479
480 current_ratio = ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(0, envelope_y0,
481 envelope_end_frame - envelope_start_frame, envelope_y1);
482 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
483 0, envelope_end_frame - envelope_start_frame,
484 envelope_end_frame - envelope_start_frame);
485
486 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
487
488 volume_util.destinationcxx . . $ _AgsVolumeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data.;
489 volume_util.destination_stridecxx . . $ _AgsVolumeUtil#destination_stride. = 1;
490
491 volume_util.sourcecxx . . $ _AgsVolumeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data.;
492 volume_util.source_stridecxx . . $ _AgsVolumeUtil#source_stride. = 1;
493
494 volume_util.buffer_lengthcxx . . $ _AgsVolumeUtil#buffer_length. = buffer_size;
495 volume_util.formatcxx . . $ _AgsVolumeUtil#format. = format;
496
497 volume_util.volumecxx . . $ _AgsVolumeUtil#volume. = current_volume;
498
499 ags_volume_util_computecxx . . $ ags_volume_util_compute(5b0b6bc36931bdf4).(&volume_util);
500
501 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
502
503 /* iterate */
504 note = note->nextcxx . . $ _GList#next.;
505
506 continue;
507 }
508
509 //TODO:JK: implement me
510
511 /* special case not applicable - #0 key offset lower than note offset */
512 if(x0 > note_offset){
513 /* iterate */
514 note = note->nextcxx . . $ _GList#next.;
515
516 continue;
517 }
518
519 envelope_current_x = 0.0;
520
521 /* attack */
522 envelope_x0 = 0.0;
523 envelope_y0 = cratio.imagcxx . . $ _AgsComplex#imag.;
524
525 envelope_x1 = cattack.realcxx . . $ _AgsComplex#real.;
526 envelope_y1 = cattack.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
527
528 envelope_start_frame = (guintcxx . . $ guint#) floor((envelope_current_x + envelope_x0) * (double) frame_count);
529 envelope_end_frame = (guintcxx . . $ guint#) floor((envelope_current_x + envelope_x0 + envelope_x1) * (double) frame_count);
530
531 #if 0
532 g_message("attack - first-frame: %d -> %d::%d", offset, envelope_start_frame, envelope_end_frame);
533 #endif
534
535 if(envelope_start_frame <= current_frame &&
536 envelope_end_frame > current_frame){
537 if(envelope_end_frame - current_frame < buffer_size){
538 current_frame_count = envelope_end_frame - current_frame;
539 }else{
540 current_frame_count = buffer_size;
541 }
542
543 current_ratio = ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(0, envelope_y0,
544 envelope_end_frame - envelope_start_frame, envelope_y1);
545 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
546 0, current_frame - envelope_start_frame,
547 envelope_end_frame - envelope_start_frame);
548
549 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
550
551 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..destinationcxx . . $ _AgsEnvelopeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
552
553 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..sourcecxx . . $ _AgsEnvelopeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
554
555 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..volumecxx . . $ _AgsEnvelopeUtil#volume. = current_volume;
556
557 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..amountcxx . . $ _AgsEnvelopeUtil#amount. = current_ratio;
558
559 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..buffer_lengthcxx . . $ _AgsEnvelopeUtil#buffer_length. = current_frame_count;
560
561 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..offsetcxx . . $ _AgsEnvelopeUtil#offset. = envelope_start_frame;
562
563 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
564
565 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.)){
566 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
567 }
568
569 ags_envelope_util_computecxx . . $ ags_envelope_util_compute(3b498363814f3d8d).(&(fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util.));
570
571 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
572
573 current_frame += current_frame_count;
574 offset += current_frame_count;
575 }
576
577 if(offset >= buffer_size){
578 /* iterate */
579 note = note->nextcxx . . $ _GList#next.;
580
581 continue;
582 }
583
584 envelope_current_x = 0.0;
585
586 /* decay */
587 envelope_x0 = cattack.realcxx . . $ _AgsComplex#real.;
588 envelope_y0 = cattack.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
589
590 envelope_x1 = cdecay.realcxx . . $ _AgsComplex#real.;
591 envelope_y1 = cdecay.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
592
593 envelope_start_frame = (guintcxx . . $ guint#) floor((envelope_current_x + envelope_x0) * (double) frame_count);
594 envelope_end_frame = (guintcxx . . $ guint#) floor((envelope_current_x + envelope_x0 + envelope_x1) * (double) frame_count);
595
596 #if 0
597 g_message("decay - first-frame: %d -> %d::%d", offset, envelope_start_frame, envelope_end_frame);
598 #endif
599
600 if(envelope_start_frame <= current_frame &&
601 envelope_end_frame > current_frame){
602 if(envelope_end_frame - current_frame < buffer_size){
603 current_frame_count = envelope_end_frame - current_frame;
604 }else{
605 current_frame_count = buffer_size - offset;
606 }
607
608 current_ratio = ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(0, envelope_y0,
609 envelope_end_frame - envelope_start_frame, envelope_y1);
610 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
611 0, current_frame - envelope_start_frame,
612 envelope_end_frame - envelope_start_frame);
613
614 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
615
616 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..destinationcxx . . $ _AgsEnvelopeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
617
618 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..sourcecxx . . $ _AgsEnvelopeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
619
620 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..volumecxx . . $ _AgsEnvelopeUtil#volume. = current_volume;
621
622 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..amountcxx . . $ _AgsEnvelopeUtil#amount. = current_ratio;
623
624 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..buffer_lengthcxx . . $ _AgsEnvelopeUtil#buffer_length. = current_frame_count;
625
626 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..offsetcxx . . $ _AgsEnvelopeUtil#offset. = envelope_start_frame;
627
628 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
629
630 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.)){
631 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
632 }
633
634 ags_envelope_util_computecxx . . $ ags_envelope_util_compute(3b498363814f3d8d).(&(fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util.));
635
636 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
637
638 current_frame += current_frame_count;
639 offset += current_frame_count;
640 }
641
642 if(offset >= buffer_size){
643 /* iterate */
644 note = note->nextcxx . . $ _GList#next.;
645
646 continue;
647 }
648
649 envelope_current_x = cattack.realcxx . . $ _AgsComplex#real.;
650
651 /* sustain */
652 envelope_x0 = cdecay.realcxx . . $ _AgsComplex#real.;
653 envelope_y0 = cdecay.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
654
655 envelope_x1 = csustain.realcxx . . $ _AgsComplex#real.;
656 envelope_y1 = csustain.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
657
658 envelope_start_frame = (guintcxx . . $ guint#) floor((envelope_current_x + envelope_x0) * (double) frame_count);
659 envelope_end_frame = (guintcxx . . $ guint#) floor((envelope_current_x + envelope_x0 + envelope_x1) * (double) frame_count);
660
661 #if 0
662 g_message("sustain - first-frame: %d -> %d::%d", offset, envelope_start_frame, envelope_end_frame);
663 #endif
664
665 if(envelope_start_frame <= current_frame &&
666 envelope_end_frame > current_frame){
667 if(envelope_end_frame - current_frame < buffer_size){
668 current_frame_count = envelope_end_frame - current_frame;
669 }else{
670 current_frame_count = buffer_size - offset;
671 }
672
673 current_ratio = ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(0, envelope_y0,
674 envelope_end_frame - envelope_start_frame, envelope_y1);
675 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
676 0, current_frame - envelope_start_frame,
677 envelope_end_frame - envelope_start_frame);
678
679 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
680
681 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..destinationcxx . . $ _AgsEnvelopeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
682
683 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..sourcecxx . . $ _AgsEnvelopeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
684
685 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..volumecxx . . $ _AgsEnvelopeUtil#volume. = current_volume;
686
687 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..amountcxx . . $ _AgsEnvelopeUtil#amount. = current_ratio;
688
689 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..buffer_lengthcxx . . $ _AgsEnvelopeUtil#buffer_length. = current_frame_count;
690
691 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..offsetcxx . . $ _AgsEnvelopeUtil#offset. = envelope_start_frame;
692
693 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
694
695 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.)){
696 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
697 }
698
699 ags_envelope_util_computecxx . . $ ags_envelope_util_compute(3b498363814f3d8d).(&(fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util.));
700
701 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
702
703 current_frame += current_frame_count;
704 offset += current_frame_count;
705 }
706
707 if(offset >= buffer_size){
708 /* iterate */
709 note = note->nextcxx . . $ _GList#next.;
710
711 continue;
712 }
713
714 envelope_current_x = cdecay.realcxx . . $ _AgsComplex#real. + csustain.realcxx . . $ _AgsComplex#real.;
715
716 /* release */
717 envelope_x0 = csustain.realcxx . . $ _AgsComplex#real.;
718 envelope_y0 = csustain.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
719
720 envelope_x1 = crelease.realcxx . . $ _AgsComplex#real.;
721 envelope_y1 = crelease.imagcxx . . $ _AgsComplex#imag. + cratio.imagcxx . . $ _AgsComplex#imag.;
722
723 envelope_start_frame = (guintcxx . . $ guint#) floor((envelope_current_x + envelope_x0) * (double) frame_count);
724 envelope_end_frame = (guintcxx . . $ guint#) floor((envelope_current_x + envelope_x0 + envelope_x1) * (double) frame_count);
725
726 #if 0
727 g_message("release - first-frame: %d -> %d::%d", offset, envelope_start_frame, envelope_end_frame);
728 #endif
729
730 if(envelope_start_frame <= current_frame &&
731 envelope_end_frame > current_frame){
732 trailing_frame_count = 0;
733
734 if(envelope_end_frame - current_frame < buffer_size){
735 current_frame_count = envelope_end_frame - current_frame;
736
737 trailing_frame_count = buffer_size - current_frame_count;
738 }else{
739 current_frame_count = buffer_size - offset;
740 }
741
742 current_ratio = ags_fx_envelope_audio_signal_get_ratiocxx . . $ ags_fx_envelope_audio_signal_get_ratio(39426f7b5473cee6).(0, envelope_y0,
743 envelope_end_frame - envelope_start_frame, envelope_y1);
744 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
745 0, current_frame - envelope_start_frame,
746 envelope_end_frame - envelope_start_frame);
747
748 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
749
750 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..destinationcxx . . $ _AgsEnvelopeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
751
752 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..sourcecxx . . $ _AgsEnvelopeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data. + offset;
753
754 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..volumecxx . . $ _AgsEnvelopeUtil#volume. = current_volume;
755
756 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..amountcxx . . $ _AgsEnvelopeUtil#amount. = current_ratio;
757
758 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..buffer_lengthcxx . . $ _AgsEnvelopeUtil#buffer_length. = current_frame_count;
759
760 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..offsetcxx . . $ _AgsEnvelopeUtil#offset. = envelope_start_frame;
761
762 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
763
764 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.)){
765 fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util..lfo_enabledcxx . . $ _AgsEnvelopeUtil#lfo_enabled. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
766 }
767
768 ags_envelope_util_computecxx . . $ ags_envelope_util_compute(3b498363814f3d8d).(&(fx_envelope_audio_signal->envelope_utilcxx . . $ _AgsFxEnvelopeAudioSignal#envelope_util.));
769
770 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
771
772 offset += current_frame_count;
773
774 if(trailing_frame_count != 0){
775 AgsVolumeUtilcxx . . $ AgsVolumeUtil# volume_util;
776
777 current_volume = ags_fx_envelope_audio_signal_get_volumecxx . . $ ags_fx_envelope_audio_signal_get_volume(8c255177d520f05f).(envelope_y0, current_ratio,
778 0, envelope_end_frame - envelope_start_frame,
779 envelope_end_frame);
780
781 g_rec_mutex_lockcxx . . $ g_rec_mutex_lock(70e02e1a6dfc5752).(stream_mutex);
782
783 volume_util.destinationcxx . . $ _AgsVolumeUtil#destination. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data.;
784 volume_util.destination_stridecxx . . $ _AgsVolumeUtil#destination_stride. = 1;
785
786 volume_util.sourcecxx . . $ _AgsVolumeUtil#source. = source->stream_currentcxx . . $ _AgsAudioSignal#stream_current.->datacxx . . $ _GList#data.;
787 volume_util.source_stridecxx . . $ _AgsVolumeUtil#source_stride. = 1;
788
789 volume_util.buffer_lengthcxx . . $ _AgsVolumeUtil#buffer_length. = buffer_size;
790 volume_util.formatcxx . . $ _AgsVolumeUtil#format. = format;
791
792 volume_util.volumecxx . . $ _AgsVolumeUtil#volume. = current_volume;
793
794 ags_volume_util_computecxx . . $ ags_volume_util_compute(5b0b6bc36931bdf4).(&volume_util);
795
796 g_rec_mutex_unlockcxx . . $ g_rec_mutex_unlock(70e02e1a6dfc5752).(stream_mutex);
797 }
798 }
799 }
800
801 note = note->nextcxx . . $ _GList#next.;
802 }
803 }
804 }
805
806 if(source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! ||
807 source->stream_currentcxx . . $ _AgsAudioSignal#stream_current. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
808 ags_recall_donecxx . . $ ags_recall_done(c1ad31f527358c62).(recall);
809 }
810
811 if(audio != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
812 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(audio);
813 }
814
815 if(channel != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
816 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(channel);
817 }
818
819 if(output_soundcard != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
820 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(output_soundcard);
821 }
822
823 if(template != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
824 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(template);
825 }
826
827 if(source != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
828 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(source);
829 }
830
831 if(recall_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
832 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(recall_id);
833 }
834
835 if(recycling_context != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
836 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(recycling_context);
837 }
838
839 if(parent_recycling_context != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
840 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(parent_recycling_context);
841 }
842
843 if(fx_envelope_channel != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
844 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(fx_envelope_channel);
845 }
846
847 if(fixed_length != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
848 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(fixed_length);
849 }
850
851 if(attack != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
852 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(attack);
853 }
854
855 if(decay != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
856 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(decay);
857 }
858
859 if(sustain != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
860 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(sustain);
861 }
862
863 if(release != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
864 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(release);
865 }
866
867 if(ratio != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
868 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(ratio);
869 }
870
871 if(fx_envelope_channel_processor != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
872 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(fx_envelope_channel_processor);
873 }
874
875 if(fx_envelope_recycling != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
876 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).(fx_envelope_recycling);
877 }
878
879 g_list_free_fullcxx . . $ g_list_free_full(5ba5b0738c7ed753).(start_note,
880 (GDestroyNotifycxx . . $ GDestroyNotify#) g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
881
882 /* call parent */
883 AGS_RECALL_CLASScxx . . $ `ags/audio/ags_recall.h:43:9`!(ags_fx_envelope_audio_signal_parent_class)->run_intercxx . . $ _AgsRecallClass#run_inter.(recall);
884 }
885
886 /**
887 * ags_fx_envelope_audio_signal_new:
888 * @audio_signal: the #AgsAudioSignal
889 *
890 * Create a new instance of #AgsFxEnvelopeAudioSignal
891 *
892 * Returns: the new #AgsFxEnvelopeAudioSignal
893 *
894 * Since: 3.3.0
895 */
896 AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal#*
897 ags_fx_envelope_audio_signal_newcxx . . $ ags_fx_envelope_audio_signal_new(7bea34ea1f6219d6).(AgsAudioSignalcxx . . $ AgsAudioSignal# *audio_signal)
898 {
899 AgsFxEnvelopeAudioSignalcxx . . $ AgsFxEnvelopeAudioSignal# *fx_envelope_audio_signal;
900
901 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`!,
902 "source", audio_signal,
903 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
904
905 return(fx_envelope_audio_signal);
906 }