| 1 | #ifndef _KlattGridEditors_h_ |
| 2 | #define _KlattGridEditors_h_ |
| 3 | /* KlattGridEditors.h |
| 4 | * |
| 5 | * Copyright (C) 2009-2011 David Weenink, 2017,2022 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 "KlattGridAreas.h" |
| 22 | #include "PitchTierArea.h" |
| 23 | #include "IntensityTier.h" |
| 24 | #include "RealTierEditor.h" |
| 25 | #include "FormantGridEditor.h" |
| 26 | |
| 27 | Thing_define (KlattGrid_RealTierEditor, RealTierEditor) { |
| 28 | KlattGrid klattgrid() { return static_cast <KlattGrid> (our data()); } |
| 29 | |
| 30 | void v_createMenuItems_help (EditorMenu menu) |
| 31 | override; |
| 32 | void v_play (double startTime, double endTime) |
| 33 | override; |
| 34 | }; |
| 35 | |
| 36 | Thing_define (KlattGrid_IntensityTierEditor, KlattGrid_RealTierEditor) { |
| 37 | void v_createMenuItems_help (EditorMenu menu) |
| 38 | override; |
| 39 | }; |
| 40 | void KlattGrid_IntensityTierEditor_init (KlattGrid_IntensityTierEditor me, autoKlattGrid_IntensityTierArea area, conststring32 title, KlattGrid klattgrid); |
| 41 | |
| 42 | |
| 43 | # pragma mark - KlattGrid_PitchTierEditor |
| 44 | |
| 45 | Thing_define (KlattGrid_PitchTierEditor, KlattGrid_RealTierEditor) { |
| 46 | void v1_dataChanged (Editor sender) override { |
| 47 | our structFunctionEditor :: v1_dataChanged (sender); |
| 48 | our realTierArea() -> functionChanged (our klattgrid() -> phonation -> pitch.get()); |
| 49 | } |
| 50 | void v_createMenuItems_help (EditorMenu menu) |
| 51 | override; |
| 52 | void v_drawLegends () override { |
| 53 | FunctionArea_drawLegend (our realTierArea().get(), |
| 54 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable pitch tier", |
| 55 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 56 | ); |
| 57 | } |
| 58 | }; |
| 59 | autoKlattGrid_PitchTierEditor KlattGrid_PitchTierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 60 | |
| 61 | |
| 62 | #pragma mark - KlattGrid_VoicingAmplitudeTierEditor |
| 63 | |
| 64 | Thing_define (KlattGrid_VoicingAmplitudeTierEditor, KlattGrid_IntensityTierEditor) { |
| 65 | void v1_dataChanged (Editor sender) override { |
| 66 | our structFunctionEditor :: v1_dataChanged (sender); |
| 67 | our realTierArea() -> functionChanged (our klattgrid() -> phonation -> voicingAmplitude.get()); |
| 68 | } |
| 69 | void v_drawLegends () override { |
| 70 | FunctionArea_drawLegend (our realTierArea().get(), |
| 71 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable voicing amplitude tier", |
| 72 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 73 | ); |
| 74 | } |
| 75 | }; |
| 76 | autoKlattGrid_VoicingAmplitudeTierEditor KlattGrid_VoicingAmplitudeTierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 77 | |
| 78 | |
| 79 | #pragma mark - KlattGrid_FlutterTierEditor |
| 80 | |
| 81 | Thing_define (KlattGrid_FlutterTierEditor, KlattGrid_RealTierEditor) { |
| 82 | void v1_dataChanged (Editor sender) override { |
| 83 | our structFunctionEditor :: v1_dataChanged (sender); |
| 84 | our realTierArea() -> functionChanged (our klattgrid() -> phonation -> flutter.get()); |
| 85 | } |
| 86 | void v_drawLegends () override { |
| 87 | FunctionArea_drawLegend (our realTierArea().get(), |
| 88 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable flutter tier", |
| 89 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 90 | ); |
| 91 | } |
| 92 | }; |
| 93 | autoKlattGrid_FlutterTierEditor KlattGrid_FlutterTierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 94 | |
| 95 | |
| 96 | #pragma mark - KlattGrid_Power1TierEditor |
| 97 | |
| 98 | Thing_define (KlattGrid_Power1TierEditor, KlattGrid_RealTierEditor) { |
| 99 | void v1_dataChanged (Editor sender) override { |
| 100 | our structFunctionEditor :: v1_dataChanged (sender); |
| 101 | our realTierArea() -> functionChanged (our klattgrid() -> phonation -> power1.get()); |
| 102 | } |
| 103 | void v_drawLegends () override { |
| 104 | FunctionArea_drawLegend (our realTierArea().get(), |
| 105 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable power1 tier", |
| 106 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 107 | ); |
| 108 | } |
| 109 | }; |
| 110 | autoKlattGrid_Power1TierEditor KlattGrid_Power1TierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 111 | |
| 112 | |
| 113 | #pragma mark - KlattGrid_Power2TierEditor |
| 114 | |
| 115 | Thing_define (KlattGrid_Power2TierEditor, KlattGrid_RealTierEditor) { |
| 116 | void v1_dataChanged (Editor sender) override { |
| 117 | our structFunctionEditor :: v1_dataChanged (sender); |
| 118 | our realTierArea() -> functionChanged (our klattgrid() -> phonation -> power2.get()); |
| 119 | } |
| 120 | void v_drawLegends () override { |
| 121 | FunctionArea_drawLegend (our realTierArea().get(), |
| 122 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable power2 tier", |
| 123 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 124 | ); |
| 125 | } |
| 126 | }; |
| 127 | autoKlattGrid_Power2TierEditor KlattGrid_Power2TierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 128 | |
| 129 | |
| 130 | #pragma mark - KlattGrid_OpenPhaseTierEditor |
| 131 | |
| 132 | Thing_define (KlattGrid_OpenPhaseTierEditor, KlattGrid_RealTierEditor) { |
| 133 | void v1_dataChanged (Editor sender) override { |
| 134 | our structFunctionEditor :: v1_dataChanged (sender); |
| 135 | our realTierArea() -> functionChanged (our klattgrid() -> phonation -> openPhase.get()); |
| 136 | } |
| 137 | void v_drawLegends () override { |
| 138 | FunctionArea_drawLegend (our realTierArea().get(), |
| 139 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable open phase tier", |
| 140 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 141 | ); |
| 142 | } |
| 143 | }; |
| 144 | autoKlattGrid_OpenPhaseTierEditor KlattGrid_OpenPhaseTierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 145 | |
| 146 | |
| 147 | #pragma mark - KlattGrid_CollisionPhaseTierEditor |
| 148 | |
| 149 | Thing_define (KlattGrid_CollisionPhaseTierEditor, KlattGrid_RealTierEditor) { |
| 150 | void v1_dataChanged (Editor sender) override { |
| 151 | our structFunctionEditor :: v1_dataChanged (sender); |
| 152 | our realTierArea() -> functionChanged (our klattgrid() -> phonation -> collisionPhase.get()); |
| 153 | } |
| 154 | void v_drawLegends () override { |
| 155 | FunctionArea_drawLegend (our realTierArea().get(), |
| 156 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable collision phase tier", |
| 157 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 158 | ); |
| 159 | } |
| 160 | }; |
| 161 | autoKlattGrid_CollisionPhaseTierEditor KlattGrid_CollisionPhaseTierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 162 | |
| 163 | |
| 164 | #pragma mark - KlattGrid_DoublePulsingTierEditor |
| 165 | |
| 166 | Thing_define (KlattGrid_DoublePulsingTierEditor, KlattGrid_RealTierEditor) { |
| 167 | void v1_dataChanged (Editor sender) override { |
| 168 | our structFunctionEditor :: v1_dataChanged (sender); |
| 169 | our realTierArea() -> functionChanged (our klattgrid() -> phonation -> doublePulsing.get()); |
| 170 | } |
| 171 | void v_drawLegends () override { |
| 172 | FunctionArea_drawLegend (our realTierArea().get(), |
| 173 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable double pulsing tier", |
| 174 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 175 | ); |
| 176 | } |
| 177 | }; |
| 178 | autoKlattGrid_DoublePulsingTierEditor KlattGrid_DoublePulsingTierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 179 | |
| 180 | |
| 181 | #pragma mark - KlattGrid_SpectralTiltTierEditor |
| 182 | |
| 183 | Thing_define (KlattGrid_SpectralTiltTierEditor, KlattGrid_IntensityTierEditor) { |
| 184 | void v1_dataChanged (Editor sender) override { |
| 185 | our structFunctionEditor :: v1_dataChanged (sender); |
| 186 | our realTierArea() -> functionChanged (our klattgrid() -> phonation -> spectralTilt.get()); |
| 187 | } |
| 188 | void v_drawLegends () override { |
| 189 | FunctionArea_drawLegend (our realTierArea().get(), |
| 190 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable spectral tilt tier", |
| 191 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 192 | ); |
| 193 | } |
| 194 | }; |
| 195 | autoKlattGrid_SpectralTiltTierEditor KlattGrid_SpectralTiltTierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 196 | |
| 197 | |
| 198 | #pragma mark - KlattGrid_AspirationAmplitudeTierEditor |
| 199 | |
| 200 | Thing_define (KlattGrid_AspirationAmplitudeTierEditor, KlattGrid_IntensityTierEditor) { |
| 201 | void v1_dataChanged (Editor sender) override { |
| 202 | our structFunctionEditor :: v1_dataChanged (sender); |
| 203 | our realTierArea() -> functionChanged (our klattgrid() -> phonation -> aspirationAmplitude.get()); |
| 204 | } |
| 205 | void v_drawLegends () override { |
| 206 | FunctionArea_drawLegend (our realTierArea().get(), |
| 207 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable aspiration amplitude tier", |
| 208 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 209 | ); |
| 210 | } |
| 211 | }; |
| 212 | autoKlattGrid_AspirationAmplitudeTierEditor KlattGrid_AspirationAmplitudeTierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 213 | |
| 214 | |
| 215 | #pragma mark - KlattGrid_BreathinessAmplitudeTierEditor |
| 216 | |
| 217 | Thing_define (KlattGrid_BreathinessAmplitudeTierEditor, KlattGrid_IntensityTierEditor) { |
| 218 | void v1_dataChanged (Editor sender) override { |
| 219 | our structFunctionEditor :: v1_dataChanged (sender); |
| 220 | our realTierArea() -> functionChanged (our klattgrid() -> phonation -> breathinessAmplitude.get()); |
| 221 | } |
| 222 | void v_drawLegends () override { |
| 223 | FunctionArea_drawLegend (our realTierArea().get(), |
| 224 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable breathiness amplitude tier", |
| 225 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 226 | ); |
| 227 | } |
| 228 | }; |
| 229 | autoKlattGrid_BreathinessAmplitudeTierEditor KlattGrid_BreathinessAmplitudeTierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 230 | |
| 231 | |
| 232 | #pragma mark - KlattGrid_DecibelTierEditor |
| 233 | |
| 234 | Thing_define (KlattGrid_DecibelTierEditor, KlattGrid_IntensityTierEditor) { |
| 235 | kKlattGridFormantType formantType; |
| 236 | integer iformant; |
| 237 | void v1_dataChanged (Editor sender) override { |
| 238 | our structFunctionEditor :: v1_dataChanged (sender); |
| 239 | our realTierArea() -> functionChanged ( |
| 240 | KlattGrid_getAddressOfAmplitudes (our klattgrid(), our formantType)->at [our iformant]); |
| 241 | } |
| 242 | void v_drawLegends () override { |
| 243 | FunctionArea_drawLegend (our realTierArea().get(), |
| 244 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable formant amplitude tier", |
| 245 | DataGui_defaultForegroundColour (our realTierArea().get(), false) // BUG: make more specific |
| 246 | ); |
| 247 | } |
| 248 | }; |
| 249 | autoKlattGrid_DecibelTierEditor KlattGrid_DecibelTierEditor_create (conststring32 title, KlattGrid klattgrid, |
| 250 | kKlattGridFormantType formantType, integer iformant); |
| 251 | |
| 252 | |
| 253 | #pragma mark - KlattGrid_FricationBypassTierEditor |
| 254 | |
| 255 | Thing_define (KlattGrid_FricationBypassTierEditor, KlattGrid_IntensityTierEditor) { |
| 256 | void v1_dataChanged (Editor sender) override { |
| 257 | our structFunctionEditor :: v1_dataChanged (sender); |
| 258 | our realTierArea() -> functionChanged (our klattgrid() -> frication -> bypass.get()); |
| 259 | } |
| 260 | void v_drawLegends () override { |
| 261 | FunctionArea_drawLegend (our realTierArea().get(), |
| 262 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable frication bypass tier", |
| 263 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 264 | ); |
| 265 | } |
| 266 | }; |
| 267 | autoKlattGrid_FricationBypassTierEditor KlattGrid_FricationBypassTierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 268 | |
| 269 | |
| 270 | #pragma mark - KlattGrid_FricationAmplitudeTierArea |
| 271 | |
| 272 | Thing_define (KlattGrid_FricationAmplitudeTierEditor, KlattGrid_IntensityTierEditor) { |
| 273 | void v1_dataChanged (Editor sender) override { |
| 274 | our structFunctionEditor :: v1_dataChanged (sender); |
| 275 | our realTierArea() -> functionChanged (our klattgrid() -> frication -> fricationAmplitude.get()); |
| 276 | } |
| 277 | void v_drawLegends () override { |
| 278 | FunctionArea_drawLegend (our realTierArea().get(), |
| 279 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable frication amplitude tier", |
| 280 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 281 | ); |
| 282 | } |
| 283 | }; |
| 284 | autoKlattGrid_FricationAmplitudeTierEditor KlattGrid_FricationAmplitudeTierEditor_create (conststring32 title, KlattGrid klattgrid); |
| 285 | |
| 286 | |
| 287 | #pragma mark - KlattGrid_FormantGridEditor |
| 288 | |
| 289 | Thing_define (KlattGrid_FormantGridEditor, FormantGridEditor) { |
| 290 | KlattGrid klattgrid() { return static_cast <KlattGrid> (our data()); } |
| 291 | kKlattGridFormantType formantType; |
| 292 | |
| 293 | void v1_dataChanged (Editor sender) override { |
| 294 | our structFunctionEditor :: v1_dataChanged (sender); |
| 295 | our formantGridArea() -> _formantGrid = KlattGrid_getAddressOfFormantGrid (our klattgrid(), our formantType)->get(); |
| 296 | OrderedOf<structRealTier>* tiers = |
| 297 | ( our formantGridArea() -> editingBandwidths ? & our formantGridArea() -> _formantGrid -> bandwidths : & our formantGridArea() -> _formantGrid -> formants ); |
| 298 | RealTier tier = tiers->at [our formantGridArea() -> selectedFormant]; |
| 299 | our formantGridArea() -> functionChanged (tier); |
| 300 | } |
| 301 | void v_play (double startTime, double endTime) |
| 302 | override; |
| 303 | void v_drawLegends () override { |
| 304 | FunctionArea_drawLegend (our formantGridArea().get(), |
| 305 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable formant grid", |
| 306 | DataGui_defaultForegroundColour (our formantGridArea().get(), false) // BUG: should split up |
| 307 | ); |
| 308 | } |
| 309 | }; |
| 310 | autoKlattGrid_FormantGridEditor KlattGrid_FormantGridEditor_create (conststring32 title, KlattGrid data, kKlattGridFormantType formantType); |
| 311 | |
| 312 | /* End of file KlattGridEditors.h */ |
| 313 | #endif |