1 /* GSequencer - Advanced GTK Sequencer
2 * Copyright (C) 2005-2021 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/X/machine/ags_pitch_sampler_callbacks.h>
21
22 #include <ags/X/ags_ui_provider.h>
23 #include <ags/X/ags_window.h>
24
25 #include <ags/i18n.h>
26
27 void ags_pitch_sampler_open_response_callback(GtkWidget *widget, gint response,
28 AgsPitchSampler *pitch_sampler);
29
30 void
ags_pitch_sampler_parent_set_callback(GtkWidget * widget,GtkWidget * old_parent,AgsPitchSampler * pitch_sampler)31 ags_pitch_sampler_parent_set_callback(GtkWidget *widget, GtkWidget *old_parent, AgsPitchSampler *pitch_sampler)
32 {
33 AgsWindow *window;
34
35 gchar *str;
36
37 if(old_parent != NULL){
38 return;
39 }
40
41 window = AGS_WINDOW(gtk_widget_get_ancestor((GtkWidget *) pitch_sampler, AGS_TYPE_WINDOW));
42
43 str = g_strdup_printf("Default %d",
44 ags_window_find_machine_counter(window, AGS_TYPE_PITCH_SAMPLER)->counter);
45
46 g_object_set(AGS_MACHINE(pitch_sampler),
47 "machine-name", str,
48 NULL);
49
50 ags_window_increment_machine_counter(window,
51 AGS_TYPE_PITCH_SAMPLER);
52 g_free(str);
53 }
54
55 void
ags_pitch_sampler_open_callback(GtkButton * button,AgsPitchSampler * pitch_sampler)56 ags_pitch_sampler_open_callback(GtkButton *button, AgsPitchSampler *pitch_sampler)
57 {
58 GtkFileChooserDialog *dialog;
59
60 if(pitch_sampler->open_dialog != NULL){
61 return;
62 }
63
64 pitch_sampler->open_dialog =
65 dialog = (GtkFileChooserDialog *) gtk_file_chooser_dialog_new(i18n("Open audio files"),
66 (GtkWindow *) gtk_widget_get_toplevel((GtkWidget *) pitch_sampler),
67 GTK_FILE_CHOOSER_ACTION_OPEN,
68 i18n("_OK"), GTK_RESPONSE_ACCEPT,
69 i18n("_Cancel"), GTK_RESPONSE_CANCEL,
70 NULL);
71 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog),
72 FALSE);
73 gtk_widget_show_all((GtkWidget *) dialog);
74
75 g_signal_connect((GObject *) dialog, "response",
76 G_CALLBACK(ags_pitch_sampler_open_response_callback), pitch_sampler);
77 }
78
79 void
ags_pitch_sampler_open_response_callback(GtkWidget * widget,gint response,AgsPitchSampler * pitch_sampler)80 ags_pitch_sampler_open_response_callback(GtkWidget *widget, gint response,
81 AgsPitchSampler *pitch_sampler)
82 {
83 if(response == GTK_RESPONSE_ACCEPT){
84 gchar *filename;
85
86 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
87 gtk_entry_set_text(pitch_sampler->filename,
88 filename);
89 ags_pitch_sampler_open_filename(pitch_sampler,
90 filename);
91 }
92
93 pitch_sampler->open_dialog = NULL;
94 gtk_widget_destroy(widget);
95 }
96
97 void
ags_pitch_sampler_file_control_changed_callback(AgsPitchSamplerFile * pitch_sampler_file,AgsPitchSampler * pitch_sampler)98 ags_pitch_sampler_file_control_changed_callback(AgsPitchSamplerFile *pitch_sampler_file,
99 AgsPitchSampler *pitch_sampler)
100 {
101 if((AGS_PITCH_SAMPLER_AUTO_UPDATE & (pitch_sampler->flags)) != 0){
102 ags_pitch_sampler_update(pitch_sampler);
103 }
104 }
105
106 void
ags_pitch_sampler_update_callback(GtkButton * button,AgsPitchSampler * pitch_sampler)107 ags_pitch_sampler_update_callback(GtkButton *button, AgsPitchSampler *pitch_sampler)
108 {
109 ags_pitch_sampler_update(pitch_sampler);
110 }
111
112 void
ags_pitch_sampler_enable_lfo_callback(GtkToggleButton * toggle,AgsPitchSampler * pitch_sampler)113 ags_pitch_sampler_enable_lfo_callback(GtkToggleButton *toggle, AgsPitchSampler *pitch_sampler)
114 {
115 AgsAudio *audio;
116 AgsChannel *start_input;
117 AgsChannel *channel, *next_channel;
118 AgsPort *port;
119
120 GList *start_play, *play;
121 GList *start_recall, *recall;
122
123 audio = AGS_MACHINE(pitch_sampler)->audio;
124
125 /* get some fields */
126 g_object_get(audio,
127 "input", &start_input,
128 NULL);
129
130 channel = start_input;
131
132 while(channel != NULL){
133 g_object_get(channel,
134 "play", &start_play,
135 "recall", &start_recall,
136 NULL);
137
138 /* play */
139 play = ags_recall_find_type(start_play,
140 AGS_TYPE_FX_LFO_CHANNEL);
141
142 if(play != NULL){
143 GValue value = {0};
144
145 g_object_get(play->data,
146 "enabled", &port,
147 NULL);
148
149 g_value_init(&value,
150 G_TYPE_FLOAT);
151 g_value_set_float(&value,
152 (gtk_toggle_button_get_active(toggle) ? 1.0: 0.0));
153
154 ags_port_safe_write(port,
155 &value);
156
157 g_object_unref(port);
158 }
159
160 g_list_free(start_play);
161
162 /* recall */
163 recall = ags_recall_find_type(start_recall,
164 AGS_TYPE_FX_LFO_CHANNEL);
165
166 if(recall != NULL){
167 GValue value = {0};
168
169 g_object_get(recall->data,
170 "enabled", &port,
171 NULL);
172
173 g_value_init(&value,
174 G_TYPE_FLOAT);
175 g_value_set_float(&value,
176 (gtk_toggle_button_get_active(toggle) ? 1.0: 0.0));
177
178 ags_port_safe_write(port,
179 &value);
180
181 g_object_unref(port);
182 }
183
184 g_list_free(start_recall);
185
186 /* iterate */
187 next_channel = ags_channel_next(channel);
188
189 g_object_unref(channel);
190
191 channel = next_channel;
192 }
193 }
194
195 void
ags_pitch_sampler_lfo_freq_callback(GtkSpinButton * spin_button,AgsPitchSampler * pitch_sampler)196 ags_pitch_sampler_lfo_freq_callback(GtkSpinButton *spin_button, AgsPitchSampler *pitch_sampler)
197 {
198 AgsAudio *audio;
199 AgsChannel *start_input;
200 AgsChannel *channel, *next_channel;
201 AgsPort *port;
202
203 GList *start_play, *play;
204 GList *start_recall, *recall;
205
206 audio = AGS_MACHINE(pitch_sampler)->audio;
207
208 /* get some fields */
209 g_object_get(audio,
210 "input", &start_input,
211 NULL);
212
213 channel = start_input;
214
215 while(channel != NULL){
216 g_object_get(channel,
217 "play", &start_play,
218 "recall", &start_recall,
219 NULL);
220
221 /* play */
222 play = ags_recall_find_type(start_play,
223 AGS_TYPE_FX_LFO_CHANNEL);
224
225 if(play != NULL){
226 GValue value = {0};
227
228 g_object_get(play->data,
229 "lfo-freq", &port,
230 NULL);
231
232 g_value_init(&value,
233 G_TYPE_FLOAT);
234 g_value_set_float(&value,
235 gtk_spin_button_get_value(spin_button));
236
237 ags_port_safe_write(port,
238 &value);
239
240 g_object_unref(port);
241 }
242
243 g_list_free(start_play);
244
245 /* recall */
246 recall = ags_recall_find_type(start_recall,
247 AGS_TYPE_FX_LFO_CHANNEL);
248
249 if(recall != NULL){
250 GValue value = {0};
251
252 g_object_get(recall->data,
253 "lfo-freq", &port,
254 NULL);
255
256 g_value_init(&value,
257 G_TYPE_FLOAT);
258 g_value_set_float(&value,
259 gtk_spin_button_get_value(spin_button));
260
261 ags_port_safe_write(port,
262 &value);
263
264 g_object_unref(port);
265 }
266
267 g_list_free(start_recall);
268
269 /* iterate */
270 next_channel = ags_channel_next(channel);
271
272 g_object_unref(channel);
273
274 channel = next_channel;
275 }
276 }
277
278 void
ags_pitch_sampler_lfo_phase_callback(GtkSpinButton * spin_button,AgsPitchSampler * pitch_sampler)279 ags_pitch_sampler_lfo_phase_callback(GtkSpinButton *spin_button, AgsPitchSampler *pitch_sampler)
280 {
281 AgsAudio *audio;
282 AgsChannel *start_input;
283 AgsChannel *channel, *next_channel;
284 AgsPort *port;
285
286 GList *start_play, *play;
287 GList *start_recall, *recall;
288
289 audio = AGS_MACHINE(pitch_sampler)->audio;
290
291 /* get some fields */
292 g_object_get(audio,
293 "input", &start_input,
294 NULL);
295
296 channel = start_input;
297
298 while(channel != NULL){
299 g_object_get(channel,
300 "play", &start_play,
301 "recall", &start_recall,
302 NULL);
303
304 /* play */
305 play = ags_recall_find_type(start_play,
306 AGS_TYPE_FX_LFO_CHANNEL);
307
308 if(play != NULL){
309 GValue value = {0};
310
311 g_object_get(play->data,
312 "lfo-phase", &port,
313 NULL);
314
315 g_value_init(&value,
316 G_TYPE_FLOAT);
317 g_value_set_float(&value,
318 gtk_spin_button_get_value(spin_button));
319
320 ags_port_safe_write(port,
321 &value);
322
323 g_object_unref(port);
324 }
325
326 g_list_free(start_play);
327
328 /* recall */
329 recall = ags_recall_find_type(start_recall,
330 AGS_TYPE_FX_LFO_CHANNEL);
331
332 if(recall != NULL){
333 GValue value = {0};
334
335 g_object_get(recall->data,
336 "lfo-phase", &port,
337 NULL);
338
339 g_value_init(&value,
340 G_TYPE_FLOAT);
341 g_value_set_float(&value,
342 gtk_spin_button_get_value(spin_button));
343
344 ags_port_safe_write(port,
345 &value);
346
347 g_object_unref(port);
348 }
349
350 g_list_free(start_recall);
351
352 /* iterate */
353 next_channel = ags_channel_next(channel);
354
355 g_object_unref(channel);
356
357 channel = next_channel;
358 }
359 }
360
361 void
ags_pitch_sampler_lfo_depth_callback(GtkSpinButton * spin_button,AgsPitchSampler * pitch_sampler)362 ags_pitch_sampler_lfo_depth_callback(GtkSpinButton *spin_button, AgsPitchSampler *pitch_sampler)
363 {
364 AgsAudio *audio;
365 AgsChannel *start_input;
366 AgsChannel *channel, *next_channel;
367 AgsPort *port;
368
369 GList *start_play, *play;
370 GList *start_recall, *recall;
371
372 audio = AGS_MACHINE(pitch_sampler)->audio;
373
374 /* get some fields */
375 g_object_get(audio,
376 "input", &start_input,
377 NULL);
378
379 channel = start_input;
380
381 while(channel != NULL){
382 g_object_get(channel,
383 "play", &start_play,
384 "recall", &start_recall,
385 NULL);
386
387 /* play */
388 play = ags_recall_find_type(start_play,
389 AGS_TYPE_FX_LFO_CHANNEL);
390
391 if(play != NULL){
392 GValue value = {0};
393
394 g_object_get(play->data,
395 "lfo-depth", &port,
396 NULL);
397
398 g_value_init(&value,
399 G_TYPE_FLOAT);
400 g_value_set_float(&value,
401 gtk_spin_button_get_value(spin_button));
402
403 ags_port_safe_write(port,
404 &value);
405
406 g_object_unref(port);
407 }
408
409 g_list_free(start_play);
410
411 /* recall */
412 recall = ags_recall_find_type(start_recall,
413 AGS_TYPE_FX_LFO_CHANNEL);
414
415 if(recall != NULL){
416 GValue value = {0};
417
418 g_object_get(recall->data,
419 "lfo-depth", &port,
420 NULL);
421
422 g_value_init(&value,
423 G_TYPE_FLOAT);
424 g_value_set_float(&value,
425 gtk_spin_button_get_value(spin_button));
426
427 ags_port_safe_write(port,
428 &value);
429
430 g_object_unref(port);
431 }
432
433 g_list_free(start_recall);
434
435 /* iterate */
436 next_channel = ags_channel_next(channel);
437
438 g_object_unref(channel);
439
440 channel = next_channel;
441 }
442 }
443
444 void
ags_pitch_sampler_lfo_tuning_callback(GtkSpinButton * spin_button,AgsPitchSampler * pitch_sampler)445 ags_pitch_sampler_lfo_tuning_callback(GtkSpinButton *spin_button, AgsPitchSampler *pitch_sampler)
446 {
447 AgsAudio *audio;
448 AgsChannel *start_input;
449 AgsChannel *channel, *next_channel;
450 AgsPort *port;
451
452 GList *start_play, *play;
453 GList *start_recall, *recall;
454
455 audio = AGS_MACHINE(pitch_sampler)->audio;
456
457 /* get some fields */
458 g_object_get(audio,
459 "input", &start_input,
460 NULL);
461
462 channel = start_input;
463
464 while(channel != NULL){
465 g_object_get(channel,
466 "play", &start_play,
467 "recall", &start_recall,
468 NULL);
469
470 /* play */
471 play = ags_recall_find_type(start_play,
472 AGS_TYPE_FX_LFO_CHANNEL);
473
474 if(play != NULL){
475 GValue value = {0};
476
477 g_object_get(play->data,
478 "lfo-tuning", &port,
479 NULL);
480
481 g_value_init(&value,
482 G_TYPE_FLOAT);
483 g_value_set_float(&value,
484 gtk_spin_button_get_value(spin_button));
485
486 ags_port_safe_write(port,
487 &value);
488
489 g_object_unref(port);
490 }
491
492 g_list_free(start_play);
493
494 /* recall */
495 recall = ags_recall_find_type(start_recall,
496 AGS_TYPE_FX_LFO_CHANNEL);
497
498 if(recall != NULL){
499 GValue value = {0};
500
501 g_object_get(recall->data,
502 "lfo-tuning", &port,
503 NULL);
504
505 g_value_init(&value,
506 G_TYPE_FLOAT);
507 g_value_set_float(&value,
508 gtk_spin_button_get_value(spin_button));
509
510 ags_port_safe_write(port,
511 &value);
512
513 g_object_unref(port);
514 }
515
516 g_list_free(start_recall);
517
518 /* iterate */
519 next_channel = ags_channel_next(channel);
520
521 g_object_unref(channel);
522
523 channel = next_channel;
524 }
525 }
526
527 void
ags_pitch_sampler_enable_aliase_callback(GtkWidget * widget,AgsPitchSampler * pitch_sampler)528 ags_pitch_sampler_enable_aliase_callback(GtkWidget *widget, AgsPitchSampler *pitch_sampler)
529 {
530 AgsChannel *start_input;
531 AgsChannel *channel;
532
533 GList *start_play, *start_recall, *recall;
534
535 gfloat enabled;
536
537 enabled = gtk_toggle_button_get_active(widget) ? 1.0: 0.0;
538
539 start_input = NULL;
540
541 g_object_get(AGS_MACHINE(pitch_sampler)->audio,
542 "input", &start_input,
543 NULL);
544
545 channel = start_input;
546
547 if(channel != NULL){
548 g_object_ref(channel);
549 }
550
551 while(channel != NULL){
552 AgsChannel *next;
553
554 start_play = ags_channel_get_play(channel);
555 start_recall = ags_channel_get_recall(channel);
556
557 recall =
558 start_recall = g_list_concat(start_play, start_recall);
559
560 while((recall = ags_recall_find_type(recall, AGS_TYPE_FX_TWO_PASS_ALIASE_CHANNEL) ) != NULL){
561 AgsPort *port;
562
563 port = NULL;
564
565 g_object_get(recall->data,
566 "enabled", &port,
567 NULL);
568
569 if(port != NULL){
570 GValue value = G_VALUE_INIT;
571
572 g_value_init(&value,
573 G_TYPE_FLOAT);
574
575 g_value_set_float(&value,
576 enabled);
577
578 ags_port_safe_write(port,
579 &value);
580
581 g_object_unref(port);
582 }
583
584 /* iterate */
585 recall = recall->next;
586 }
587
588 g_list_free_full(start_recall,
589 (GDestroyNotify) g_object_unref);
590
591 /* iterate */
592 next = ags_channel_next(channel);
593
594 g_object_unref(channel);
595
596 channel = next;
597 }
598
599 if(start_input != NULL){
600 g_object_unref(start_input);
601 }
602 }
603
604 void
ags_pitch_sampler_aliase_a_amount_callback(AgsDial * dial,AgsPitchSampler * pitch_sampler)605 ags_pitch_sampler_aliase_a_amount_callback(AgsDial *dial, AgsPitchSampler *pitch_sampler)
606 {
607 AgsChannel *start_input;
608 AgsChannel *channel;
609
610 GList *start_play, *start_recall, *recall;
611
612 gfloat amount;
613
614 amount = gtk_adjustment_get_value(ags_dial_get_adjustment(dial));
615
616 start_input = NULL;
617
618 g_object_get(AGS_MACHINE(pitch_sampler)->audio,
619 "input", &start_input,
620 NULL);
621
622 channel = start_input;
623
624 if(channel != NULL){
625 g_object_ref(channel);
626 }
627
628 while(channel != NULL){
629 AgsChannel *next;
630
631 start_play = ags_channel_get_play(channel);
632 start_recall = ags_channel_get_recall(channel);
633
634 recall =
635 start_recall = g_list_concat(start_play, start_recall);
636
637 while((recall = ags_recall_find_type(recall, AGS_TYPE_FX_TWO_PASS_ALIASE_CHANNEL) ) != NULL){
638 AgsPort *port;
639
640 port = NULL;
641
642 g_object_get(recall->data,
643 "a-amount", &port,
644 NULL);
645
646 if(port != NULL){
647 GValue value = G_VALUE_INIT;
648
649 g_value_init(&value,
650 G_TYPE_FLOAT);
651
652 g_value_set_float(&value,
653 amount);
654
655 ags_port_safe_write(port,
656 &value);
657
658 g_object_unref(port);
659 }
660
661 /* iterate */
662 recall = recall->next;
663 }
664
665 g_list_free_full(start_recall,
666 (GDestroyNotify) g_object_unref);
667
668 /* iterate */
669 next = ags_channel_next(channel);
670
671 g_object_unref(channel);
672
673 channel = next;
674 }
675
676 if(start_input != NULL){
677 g_object_unref(start_input);
678 }
679 }
680
681 void
ags_pitch_sampler_aliase_a_phase_callback(AgsDial * dial,AgsPitchSampler * pitch_sampler)682 ags_pitch_sampler_aliase_a_phase_callback(AgsDial *dial, AgsPitchSampler *pitch_sampler)
683 {
684 AgsChannel *start_input;
685 AgsChannel *channel;
686
687 GList *start_play, *start_recall, *recall;
688
689 gfloat phase;
690
691 phase = gtk_adjustment_get_value(ags_dial_get_adjustment(dial));
692
693 start_input = NULL;
694
695 g_object_get(AGS_MACHINE(pitch_sampler)->audio,
696 "input", &start_input,
697 NULL);
698
699 channel = start_input;
700
701 if(channel != NULL){
702 g_object_ref(channel);
703 }
704
705 while(channel != NULL){
706 AgsChannel *next;
707
708 start_play = ags_channel_get_play(channel);
709 start_recall = ags_channel_get_recall(channel);
710
711 recall =
712 start_recall = g_list_concat(start_play, start_recall);
713
714 while((recall = ags_recall_find_type(recall, AGS_TYPE_FX_TWO_PASS_ALIASE_CHANNEL) ) != NULL){
715 AgsPort *port;
716
717 port = NULL;
718
719 g_object_get(recall->data,
720 "a-phase", &port,
721 NULL);
722
723 if(port != NULL){
724 GValue value = G_VALUE_INIT;
725
726 g_value_init(&value,
727 G_TYPE_FLOAT);
728
729 g_value_set_float(&value,
730 phase);
731
732 ags_port_safe_write(port,
733 &value);
734
735 g_object_unref(port);
736 }
737
738 /* iterate */
739 recall = recall->next;
740 }
741
742 g_list_free_full(start_recall,
743 (GDestroyNotify) g_object_unref);
744
745 /* iterate */
746 next = ags_channel_next(channel);
747
748 g_object_unref(channel);
749
750 channel = next;
751 }
752
753 if(start_input != NULL){
754 g_object_unref(start_input);
755 }
756 }
757
758 void
ags_pitch_sampler_aliase_b_amount_callback(AgsDial * dial,AgsPitchSampler * pitch_sampler)759 ags_pitch_sampler_aliase_b_amount_callback(AgsDial *dial, AgsPitchSampler *pitch_sampler)
760 {
761 AgsChannel *start_input;
762 AgsChannel *channel;
763
764 GList *start_play, *start_recall, *recall;
765
766 gfloat amount;
767
768 amount = gtk_adjustment_get_value(ags_dial_get_adjustment(dial));
769
770 start_input = NULL;
771
772 g_object_get(AGS_MACHINE(pitch_sampler)->audio,
773 "input", &start_input,
774 NULL);
775
776 channel = start_input;
777
778 if(channel != NULL){
779 g_object_ref(channel);
780 }
781
782 while(channel != NULL){
783 AgsChannel *next;
784
785 start_play = ags_channel_get_play(channel);
786 start_recall = ags_channel_get_recall(channel);
787
788 recall =
789 start_recall = g_list_concat(start_play, start_recall);
790
791 while((recall = ags_recall_find_type(recall, AGS_TYPE_FX_TWO_PASS_ALIASE_CHANNEL) ) != NULL){
792 AgsPort *port;
793
794 port = NULL;
795
796 g_object_get(recall->data,
797 "b-amount", &port,
798 NULL);
799
800 if(port != NULL){
801 GValue value = G_VALUE_INIT;
802
803 g_value_init(&value,
804 G_TYPE_FLOAT);
805
806 g_value_set_float(&value,
807 amount);
808
809 ags_port_safe_write(port,
810 &value);
811
812 g_object_unref(port);
813 }
814
815 /* iterate */
816 recall = recall->next;
817 }
818
819 g_list_free_full(start_recall,
820 (GDestroyNotify) g_object_unref);
821
822 /* iterate */
823 next = ags_channel_next(channel);
824
825 g_object_unref(channel);
826
827 channel = next;
828 }
829
830 if(start_input != NULL){
831 g_object_unref(start_input);
832 }
833 }
834
835 void
ags_pitch_sampler_aliase_b_phase_callback(AgsDial * dial,AgsPitchSampler * pitch_sampler)836 ags_pitch_sampler_aliase_b_phase_callback(AgsDial *dial, AgsPitchSampler *pitch_sampler)
837 {
838 AgsChannel *start_input;
839 AgsChannel *channel;
840
841 GList *start_play, *start_recall, *recall;
842
843 gfloat phase;
844
845 phase = gtk_adjustment_get_value(ags_dial_get_adjustment(dial));
846
847 start_input = NULL;
848
849 g_object_get(AGS_MACHINE(pitch_sampler)->audio,
850 "input", &start_input,
851 NULL);
852
853 channel = start_input;
854
855 if(channel != NULL){
856 g_object_ref(channel);
857 }
858
859 while(channel != NULL){
860 AgsChannel *next;
861
862 start_play = ags_channel_get_play(channel);
863 start_recall = ags_channel_get_recall(channel);
864
865 recall =
866 start_recall = g_list_concat(start_play, start_recall);
867
868 while((recall = ags_recall_find_type(recall, AGS_TYPE_FX_TWO_PASS_ALIASE_CHANNEL) ) != NULL){
869 AgsPort *port;
870
871 port = NULL;
872
873 g_object_get(recall->data,
874 "b-phase", &port,
875 NULL);
876
877 if(port != NULL){
878 GValue value = G_VALUE_INIT;
879
880 g_value_init(&value,
881 G_TYPE_FLOAT);
882
883 g_value_set_float(&value,
884 phase);
885
886 ags_port_safe_write(port,
887 &value);
888
889 g_object_unref(port);
890 }
891
892 /* iterate */
893 recall = recall->next;
894 }
895
896 g_list_free_full(start_recall,
897 (GDestroyNotify) g_object_unref);
898
899 /* iterate */
900 next = ags_channel_next(channel);
901
902 g_object_unref(channel);
903
904 channel = next;
905 }
906
907 if(start_input != NULL){
908 g_object_unref(start_input);
909 }
910 }
911
912 void
ags_pitch_sampler_volume_callback(GtkRange * range,AgsPitchSampler * pitch_sampler)913 ags_pitch_sampler_volume_callback(GtkRange *range, AgsPitchSampler *pitch_sampler)
914 {
915 AgsChannel *start_input;
916 AgsChannel *channel;
917
918 GList *start_play, *start_recall, *recall;
919
920 gfloat volume;
921
922 volume = (gfloat) gtk_range_get_value(range);
923
924 start_input = NULL;
925
926 g_object_get(AGS_MACHINE(pitch_sampler)->audio,
927 "input", &start_input,
928 NULL);
929
930 channel = start_input;
931
932 if(channel != NULL){
933 g_object_ref(channel);
934 }
935
936 while(channel != NULL){
937 AgsChannel *next;
938
939 start_play = ags_channel_get_play(channel);
940 start_recall = ags_channel_get_recall(channel);
941
942 recall =
943 start_recall = g_list_concat(start_play, start_recall);
944
945 while((recall = ags_recall_find_type(recall, AGS_TYPE_FX_VOLUME_CHANNEL)) != NULL){
946 AgsPort *port;
947
948 port = NULL;
949
950 g_object_get(recall->data,
951 "volume", &port,
952 NULL);
953
954 if(port != NULL){
955 GValue value = G_VALUE_INIT;
956
957 g_value_init(&value,
958 G_TYPE_FLOAT);
959
960 g_value_set_float(&value,
961 volume);
962
963 ags_port_safe_write(port,
964 &value);
965
966 g_object_unref(port);
967 }
968
969 /* iterate */
970 recall = recall->next;
971 }
972
973 g_list_free_full(start_recall,
974 (GDestroyNotify) g_object_unref);
975
976 /* iterate */
977 next = ags_channel_next(channel);
978
979 g_object_unref(channel);
980
981 channel = next;
982 }
983
984 if(start_input != NULL){
985 g_object_unref(start_input);
986 }
987 }
988