1 /* GSequencer - Advanced GTK Sequencer
2 * Copyright (C) 2005-2019 Joël Krähemann
3 *
4 * This file is part of GSequencer.
5 *
6 * GSequencer is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * GSequencer is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GSequencer. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <ags/X/machine/ags_synth_input_line_callbacks.h>
21 #include <ags/X/machine/ags_synth.h>
22
23 void
ags_synth_input_line_samplerate_changed_callback(AgsLine * line,guint samplerate,guint old_samplerate,gpointer user_data)24 ags_synth_input_line_samplerate_changed_callback(AgsLine *line,
25 guint samplerate, guint old_samplerate,
26 gpointer user_data)
27 {
28 AgsOscillator *oscillator;
29
30 guint i;
31
32 oscillator = AGS_SYNTH_INPUT_LINE(line)->oscillator;
33
34 gtk_spin_button_set_value(oscillator->attack,
35 samplerate * (gtk_spin_button_get_value(oscillator->attack) / old_samplerate));
36
37 gtk_spin_button_set_value(oscillator->frame_count,
38 samplerate * (gtk_spin_button_get_value(oscillator->frame_count) / old_samplerate));
39
40 gtk_spin_button_set_value(oscillator->phase,
41 samplerate * (gtk_spin_button_get_value(oscillator->phase) / old_samplerate));
42
43 for(i = 0; i < oscillator->sync_point_count; i++){
44 gtk_spin_button_set_value(oscillator->sync_point[i * 2],
45 samplerate * (gtk_spin_button_get_value(oscillator->sync_point[i * 2]) / old_samplerate));
46
47 gtk_spin_button_set_value(oscillator->sync_point[i * 2 + 1],
48 samplerate * (gtk_spin_button_get_value(oscillator->sync_point[i * 2 + 1]) / old_samplerate));
49 }
50 }
51
52 void
ags_synth_input_line_oscillator_control_changed_callback(AgsOscillator * oscillator,AgsSynthInputLine * synth_input_line)53 ags_synth_input_line_oscillator_control_changed_callback(AgsOscillator *oscillator,
54 AgsSynthInputLine *synth_input_line)
55 {
56 AgsSynth *synth;
57
58 synth = (AgsSynth *) gtk_widget_get_ancestor((GtkWidget *) synth_input_line,
59 AGS_TYPE_SYNTH);
60
61 if(ags_synth_test_flags(synth, AGS_SYNTH_AUTO_UPDATE)){
62 ags_synth_update(synth);
63 }
64 }
65