Debian Codegraph @

foned/ManipulationEditor.h

raw
1 #ifndef _ManipulationEditor_h_
2 #define _ManipulationEditor_h_
3 /* ManipulationEditor.h
4 *
5 * Copyright (C) 1992-2005,2007,2009-2013,2015,2016,2018,2020-2023 Paul Boersma
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 *
12 * This code is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this work. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "FunctionEditor.h"
22 #include "SoundArea.h"
23 #include "PointArea.h"
24 #include "PitchTierArea.h"
25 #include "DurationTierArea.h"
26 #include "Manipulation.h"
27
28 #include "ManipulationEditor_enums.h"
29
30 Thing_define (ManipulationSoundArea, SoundArea) {
31 };
32 DEFINE_FunctionArea_create (ManipulationSoundArea, Sound)
33
34 Thing_define (ManipulationPulsesArea, PointArea) {
35 PointProcess pulses() { return static_cast <PointProcess> (our function()); }
36 void v_createMenus ()
37 override;
38 };
39 DEFINE_FunctionArea_create (ManipulationPulsesArea, PointProcess)
40
41 Thing_define (ManipulationPitchTierArea, PitchTierArea) {
42 PitchTier pitch() { return static_cast <PitchTier> (our function()); }
43 ManipulationPulsesArea borrowedPulsesArea;
44 void v_drawInside ()
45 override;
46 void v_createMenus ()
47 override;
48 #include "ManipulationEditor_prefs.h"
49 };
50 DEFINE_FunctionArea_create (ManipulationPitchTierArea, PitchTier)
51
52 Thing_define (ManipulationDurationTierArea, DurationTierArea) {
53 DurationTier duration() { return static_cast <DurationTier> (our function()); }
54 void v_drawInside ()
55 override;
56 void v_createMenus ()
57 override;
58 };
59 DEFINE_FunctionArea_create (ManipulationDurationTierArea, DurationTier)
60
61
62 Thing_define (ManipulationEditor, FunctionEditor) {
63 DEFINE_FunctionArea (1, ManipulationSoundArea, soundArea)
64 DEFINE_FunctionArea (2, ManipulationPitchTierArea, pitchTierArea)
65 DEFINE_FunctionArea (3, ManipulationDurationTierArea, durationTierArea)
66 DEFINE_FunctionArea (4, ManipulationPulsesArea, pulsesArea)
67
68 Manipulation manipulation() { return static_cast <Manipulation> (our data()); }
69
70 void v1_dataChanged (Editor sender) override {
71 ManipulationEditor_Parent :: v1_dataChanged (sender);
72 our soundArea() -> functionChanged (our manipulation() -> sound.get());
73 our pitchTierArea() -> functionChanged (our manipulation() -> pitch.get());
74 if (! our manipulation() -> duration) // repair an old-fashioned Manipulation that has a PitchTier only
75 our manipulation() -> duration = DurationTier_create (our manipulation() -> xmin, our manipulation() -> xmax);
76 our durationTierArea() -> functionChanged (our manipulation() -> duration.get());
77 our pulsesArea() -> functionChanged (our manipulation() -> pulses.get());
78 }
79
80 autoPointProcess previousPulses;
81 autoPitchTier previousPitch;
82 autoDurationTier previousDuration;
83 int synthesisMethod;
84 GuiMenuItem synthPulsesButton, synthPulsesHumButton;
85 GuiMenuItem synthPulsesLpcButton;
86 GuiMenuItem synthPitchButton, synthPitchHumButton;
87 GuiMenuItem synthPulsesPitchButton, synthPulsesPitchHumButton;
88 GuiMenuItem synthOverlapAddNodurButton, synthOverlapAddButton;
89 GuiMenuItem synthPitchLpcButton;
90
91 Graphics_Viewport inset;
92
93 void v_createMenus ()
94 override;
95 void v_createMenuItems_help (EditorMenu menu)
96 override;
97 void v_distributeAreas () override {
98 our pulsesArea() -> setGlobalYRange_fraction (0.67, 1.00);
99 our soundArea() -> setGlobalYRange_fraction (0.67, 1.00);
100 our pitchTierArea() -> setGlobalYRange_fraction (0.17, 0.67);
101 our durationTierArea() -> setGlobalYRange_fraction (0.0, 0.17);
102 }
103 void v_draw () override {
104 FunctionArea_drawTwo (our pulsesArea().get(), our soundArea().get());
105 FunctionArea_drawOne (our pitchTierArea().get());
106 FunctionArea_drawOne (our durationTierArea().get());
107 }
108 void v_updateMenuItems ()
109 override;
110 void v_play (double tmin, double tmax)
111 override;
112 void v_drawLegends () override {
113 FunctionArea_drawLegend (our soundArea().get(),
114 FunctionArea_legend_WAVEFORM U" %%non-modifiable mono copy of sound",
115 DataGui_defaultForegroundColour (our soundArea().get(), false),
116 FunctionArea_legend_POLES U" ##modifiable pulses",
117 DataGui_defaultForegroundColour (our pulsesArea().get(), false)
118 );
119 FunctionArea_drawLegend (our pitchTierArea().get(),
120 FunctionArea_legend_SPECKLES U" %%pitch derived from pulses",
121 Melder_GREY,
122 FunctionArea_legend_LINES_SPECKLES U" ##manipulatable pitch",
123 DataGui_defaultForegroundColour (our pitchTierArea().get(), false)
124 );
125 FunctionArea_drawLegend (our durationTierArea().get(),
126 FunctionArea_legend_LINES_SPECKLES U" ##manipulatable duration",
127 DataGui_defaultForegroundColour (our durationTierArea().get(), false)
128 );
129 }
130 };
131
132 autoManipulationEditor ManipulationEditor_create (conststring32 title, Manipulation manipulation);
133
134 /* End of file ManipulationEditor.h */
135 #endif