| 1 | /* ManipulationEditor.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2024,2026 Paul Boersma |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This code is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | * See the GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #include "ManipulationEditor.h"cxx . . $ `<file>/foned/ManipulationEditor.h`/ |
| 20 | #include "PitchTier_to_PointProcess.h"cxx . . $ `<file>/fon/PitchTier_to_PointProcess.h`/ |
| 21 | #include "Sound_to_PointProcess.h"cxx . . $ `<file>/fon/Sound_to_PointProcess.h`/ |
| 22 | #include "Sound_to_Pitch.h"cxx . . $ `<file>/fon/Sound_to_Pitch.h`/ |
| 23 | #include "Pitch_to_PitchTier.h"cxx . . $ `<file>/fon/Pitch_to_PitchTier.h`/ |
| 24 | #include "Pitch_to_PointProcess.h"cxx . . $ `<file>/fon/Pitch_to_PointProcess.h`/ |
| 25 | #include "EditorM.h"cxx . . $ `<file>/sys/EditorM.h`/ |
| 26 | |
| 27 | |
| 28 | #pragma mark - ManipPulsesArea |
| 29 | |
| 30 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (ManipulationPulsesArea, PointArea, 0); |
| 31 | |
| 32 | |
| 33 | #pragma mark - ManipPulsesArea Modify |
| 34 | |
| 35 | static void menu_cb_removePulsescxx . . $ menu_cb_removePulses(6a6677c38ef23337). (ManipulationPulsesAreacxx . . $ ManipulationPulsesArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 36 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Remove pulse(s)") |
| 37 | if (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() == mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()) |
| 38 | PointProcess_removePointNearcxx . . $ PointProcess_removePointNear(29f3b64796387061). (mycxx . . $ `melder/melder.h:44:9`! pulsescxx . . $ structManipulationPulsesArea#pulses(43db3c50dce602ea).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).()); |
| 39 | else |
| 40 | PointProcess_removePointsBetweencxx . . $ PointProcess_removePointsBetween(e9a5a3516f592d43). (mycxx . . $ `melder/melder.h:44:9`! pulsescxx . . $ structManipulationPulsesArea#pulses(43db3c50dce602ea).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()); |
| 41 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 42 | } |
| 43 | static void menu_cb_addPulseAtCursorcxx . . $ menu_cb_addPulseAtCursor(6a6677c38ef23337). (ManipulationPulsesAreacxx . . $ ManipulationPulsesArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 44 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Add pulse") |
| 45 | PointProcess_addPointcxx . . $ PointProcess_addPoint(29f3b64796387061). (mycxx . . $ `melder/melder.h:44:9`! pulsescxx . . $ structManipulationPulsesArea#pulses(43db3c50dce602ea).(), 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() + mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).())); |
| 46 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 47 | } |
| 48 | static void menu_cb_addPulseAtcxx . . $ menu_cb_addPulseAt(6a6677c38ef23337). (ManipulationPulsesAreacxx . . $ ManipulationPulsesArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 49 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Add pulse", nullptr) |
| 50 | REALcxx . . $ `sys/EditorM.h:95:9`! (position, U"Position (s)", U"0.0") |
| 51 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 52 | SET_REALcxx . . $ `sys/EditorM.h:462:9`! (position, 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelection() + mycxx . . $ `melder/melder.h:44:9`! endSelection())) |
| 53 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 54 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Add pulse") |
| 55 | PointProcess_addPointcxx . . $ PointProcess_addPoint(29f3b64796387061). (mycxx . . $ `melder/melder.h:44:9`! pulsescxx . . $ structManipulationPulsesArea#pulses(43db3c50dce602ea).(), position); |
| 56 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 57 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 58 | } |
| 59 | |
| 60 | |
| 61 | #pragma mark - ManipPulsesArea all menus |
| 62 | |
| 63 | void structManipulationPulsesAreacxx . . $ structManipulationPulsesArea# :: v_createMenuscxx . . $ structManipulationPulsesArea#v_createMenus(49f6e7a06ebc5aa8). () { |
| 64 | EditorMenucxx . . $ EditorMenu# menu = Editor_addMenucxx . . $ Editor_addMenu(8b39ac34ca8e016f). (ourcxx . . $ `melder/melder.h:42:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).(), U"Pulse", 0); |
| 65 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Add pulse at cursor", 'P', |
| 66 | menu_cb_addPulseAtCursorcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 67 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Add pulse at...", 0, |
| 68 | menu_cb_addPulseAtcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 69 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"-- remove pulses --", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this); |
| 70 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Remove pulse(s)", GuiMenu_COMMAND_EXTRAcxx . . $ `sys/Gui.h:816:10`! | 'P', |
| 71 | menu_cb_removePulsescxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 72 | } |
| 73 | |
| 74 | |
| 75 | #pragma mark - ManipulationSoundArea |
| 76 | |
| 77 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (ManipulationSoundArea, SoundArea, 0); |
| 78 | |
| 79 | |
| 80 | #pragma mark - ManipPitchTierArea |
| 81 | |
| 82 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (ManipulationPitchTierArea, PitchTierArea, 0); |
| 83 | |
| 84 | #include "enums_getText.h"cxx . . $ `<file>/melder/enums_getText.h`/ |
| 85 | #include "ManipulationEditor_enums.h"cxx . . $ `<file>/foned/ManipulationEditor_enums.h`/ |
| 86 | #include "enums_getValue.h"cxx . . $ `<file>/melder/enums_getValue.h`/ |
| 87 | #include "ManipulationEditor_enums.h"cxx . . $ `<file>/foned/ManipulationEditor_enums.h`/ |
| 88 | |
| 89 | #include "Prefs_define.h"cxx . . $ `<file>/sys/Prefs_define.h`/ |
| 90 | #include "ManipulationEditor_prefs.h"cxx . . $ `<file>/foned/ManipulationEditor_prefs.h`/ |
| 91 | #include "Prefs_install.h"cxx . . $ `<file>/sys/Prefs_install.h`/ |
| 92 | #include "ManipulationEditor_prefs.h"cxx . . $ `<file>/foned/ManipulationEditor_prefs.h`/ |
| 93 | #include "Prefs_copyToInstance.h"cxx . . $ `<file>/sys/Prefs_copyToInstance.h`/ |
| 94 | #include "ManipulationEditor_prefs.h"cxx . . $ `<file>/foned/ManipulationEditor_prefs.h`/ |
| 95 | |
| 96 | |
| 97 | #pragma mark - ManipPitchTierArea Modify |
| 98 | |
| 99 | static void menu_cb_removePitchPointscxx . . $ menu_cb_removePitchPoints(714830c0c7b327fe). (ManipulationPitchTierAreacxx . . $ ManipulationPitchTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 100 | if (! mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()) |
| 101 | return; |
| 102 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Remove pitch point(s)") |
| 103 | if (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() == mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()) |
| 104 | AnyTier_removePointNearcxx . . $ AnyTier_removePointNear(b9141c6a676b04b9). (mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()->asAnyTiercxx . . $ structRealTier#asAnyTier(2fecc017ee6dfbab).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).()); |
| 105 | else |
| 106 | AnyTier_removePointsBetweencxx . . $ AnyTier_removePointsBetween(15327dad64b67f1a). (mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()->asAnyTiercxx . . $ structRealTier#asAnyTier(2fecc017ee6dfbab).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()); |
| 107 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 108 | } |
| 109 | static void menu_cb_addPitchPointAtCursorcxx . . $ menu_cb_addPitchPointAtCursor(714830c0c7b327fe). (ManipulationPitchTierAreacxx . . $ ManipulationPitchTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 110 | if (! mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()) |
| 111 | return; |
| 112 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Add pitch point") |
| 113 | RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).(), 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() + mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()), mycxx . . $ `melder/melder.h:44:9`! ycursorcxx . . $ structRealTierArea#ycursor.); |
| 114 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 115 | } |
| 116 | static void menu_cb_addPitchPointAtSlicecxx . . $ menu_cb_addPitchPointAtSlice(714830c0c7b327fe). (ManipulationPitchTierAreacxx . . $ ManipulationPitchTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 117 | if (! mycxx . . $ `melder/melder.h:44:9`! borrowedPulsesAreacxx . . $ structManipulationPitchTierArea#borrowedPulsesArea. || ! mycxx . . $ `melder/melder.h:44:9`! borrowedPulsesAreacxx . . $ structManipulationPitchTierArea#borrowedPulsesArea. -> pulsescxx . . $ structManipulationPulsesArea#pulses(43db3c50dce602ea).()) |
| 118 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"There are no pulses."); |
| 119 | if (! mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()) |
| 120 | return; |
| 121 | const integercxx . . $ integer# ileft = PointProcess_getLowIndexcxx . . $ PointProcess_getLowIndex(530dc1bca782083d). (mycxx . . $ `melder/melder.h:44:9`! borrowedPulsesAreacxx . . $ structManipulationPitchTierArea#borrowedPulsesArea. -> pulsescxx . . $ structManipulationPulsesArea#pulses(43db3c50dce602ea).(), 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() + mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).())); |
| 122 | const integercxx . . $ integer# iright = ileft + 1, nt = mycxx . . $ `melder/melder.h:44:9`! borrowedPulsesAreacxx . . $ structManipulationPitchTierArea#borrowedPulsesArea. -> pulsescxx . . $ structManipulationPulsesArea#pulses(43db3c50dce602ea).() -> ntcxx . . $ structPointProcess#nt.; |
| 123 | constVECcxx . . $ constVEC# t = mycxx . . $ `melder/melder.h:44:9`! borrowedPulsesAreacxx . . $ structManipulationPitchTierArea#borrowedPulsesArea. -> pulsescxx . . $ structManipulationPulsesArea#pulses(43db3c50dce602ea).() -> tcxx . . $ structPointProcess#t..getcxx . . $ autovector#get(e8d1da7fe68a6585).(); |
| 124 | double desiredY = mycxx . . $ `melder/melder.h:44:9`! ycursorcxx . . $ structRealTierArea#ycursor.; // default |
| 125 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Add pitch point") |
| 126 | if (nt <= 1) { |
| 127 | /* Ignore. */ |
| 128 | } else if (ileft <= 0) { |
| 129 | double tright = t [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).2] - t [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).1]; |
| 130 | if (tright > 0.0 && tright <= 0.02) |
| 131 | desiredY = 1.0 / tright; |
| 132 | } else if (iright > nt) { |
| 133 | double tleft = t [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).nt] - t [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).nt - 1]; |
| 134 | if (tleft > 0.0 && tleft <= 0.02) |
| 135 | desiredY = 1.0 / tleft; |
| 136 | } else { // three-period median |
| 137 | double tmid = t [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).iright] - t [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).ileft], tleft = 0.0, tright = 0.0; |
| 138 | if (ileft > 1) |
| 139 | tleft = t [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).ileft] - t [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).ileft - 1]; |
| 140 | if (iright < nt) |
| 141 | tright = t [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).iright + 1] - t [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).iright]; |
| 142 | if (tleft > 0.02) |
| 143 | tleft = 0.0; |
| 144 | if (tmid > 0.02) |
| 145 | tmid = 0.0; |
| 146 | if (tright > 0.02) |
| 147 | tright = 0.0; |
| 148 | /* Bubble-sort. */ |
| 149 | Melder_sortcxx . . $ Melder_sort(80e3bfca93a78d58). (& tleft, & tmid); |
| 150 | Melder_sortcxx . . $ Melder_sort(80e3bfca93a78d58). (& tleft, & tright); |
| 151 | Melder_sortcxx . . $ Melder_sort(80e3bfca93a78d58). (& tmid, & tright); |
| 152 | if (tleft != 0.0) |
| 153 | desiredY = 1.0 / tmid; // median of 3 |
| 154 | else if (tmid != 0.0) |
| 155 | desiredY = 2.0 / (tmid + tright); // median of 2 |
| 156 | else if (tright != 0.0) |
| 157 | desiredY = 1.0 / tright; // median of 1 |
| 158 | } |
| 159 | RealTierArea_addPointAtcxx . . $ RealTierArea_addPointAt(624837917fe0a142). (me, 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() + mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()), desiredY); |
| 160 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 161 | } |
| 162 | static void menu_cb_addPitchPointAtcxx . . $ menu_cb_addPitchPointAt(714830c0c7b327fe). (ManipulationPitchTierAreacxx . . $ ManipulationPitchTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 163 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Add pitch point", nullptr) |
| 164 | REALcxx . . $ `sys/EditorM.h:95:9`! (time, U"Time (s)", U"0.0") |
| 165 | REALcxx . . $ `sys/EditorM.h:95:9`! (frequency, U"Frequency (Hz or st)", U"100.0") |
| 166 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 167 | SET_REALcxx . . $ `sys/EditorM.h:462:9`! (time, 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelection() + mycxx . . $ `melder/melder.h:44:9`! endSelection())) |
| 168 | SET_REALcxx . . $ `sys/EditorM.h:462:9`! (frequency, mycxx . . $ `melder/melder.h:44:9`! ycursor) |
| 169 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 170 | if (! mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()) |
| 171 | return; |
| 172 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Add pitch point") |
| 173 | RealTierArea_addPointAtcxx . . $ RealTierArea_addPointAt(624837917fe0a142). (me, time, frequency); |
| 174 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 175 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 176 | } |
| 177 | static void menu_cb_stylizePitchcxx . . $ menu_cb_stylizePitch(714830c0c7b327fe). (ManipulationPitchTierAreacxx . . $ ManipulationPitchTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 178 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Stylize pitch", U"PitchTier: Stylize...") |
| 179 | REALcxx . . $ `sys/EditorM.h:95:9`! (frequencyResolution, U"Frequency resolution", mycxx . . $ `melder/melder.h:44:9`! default_pitch_stylize_frequencyResolution ()) |
| 180 | CHOICEcxx . . $ `sys/EditorM.h:361:9`! (units, U"Units", mycxx . . $ `melder/melder.h:44:9`! default_pitch_stylize_useSemitones () + 1) |
| 181 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"Hertz") |
| 182 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"semitones") |
| 183 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 184 | SET_REALcxx . . $ `sys/EditorM.h:462:9`! (frequencyResolution, mycxx . . $ `melder/melder.h:44:9`! instancePref_pitch_stylize_frequencyResolution()) |
| 185 | SET_OPTIONcxx . . $ `sys/EditorM.h:474:9`! (units, mycxx . . $ `melder/melder.h:44:9`! instancePref_pitch_stylize_useSemitones() + 1) |
| 186 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 187 | if (! mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()) |
| 188 | return; |
| 189 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Stylize pitch") |
| 190 | mycxx . . $ `melder/melder.h:44:9`! setInstancePref_pitch_stylize_frequencyResolutioncxx . . $ structManipulationPitchTierArea#setInstancePref_pitch_stylize_frequencyResolution(ba8836b59fb42830). (frequencyResolution); |
| 191 | mycxx . . $ `melder/melder.h:44:9`! setInstancePref_pitch_stylize_useSemitonescxx . . $ structManipulationPitchTierArea#setInstancePref_pitch_stylize_useSemitones(b45ddcbc8423892c). (units - 1); |
| 192 | PitchTier_stylizecxx . . $ PitchTier_stylize(25fef68f768d10e5). (mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).(), frequencyResolution, mycxx . . $ `melder/melder.h:44:9`! instancePref_pitch_stylize_useSemitonescxx . . $ structManipulationPitchTierArea#instancePref_pitch_stylize_useSemitones(50ce9a9e25b4a850).()); |
| 193 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 194 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 195 | } |
| 196 | static void menu_cb_stylizePitch_2stcxx . . $ menu_cb_stylizePitch_2st(714830c0c7b327fe). (ManipulationPitchTierAreacxx . . $ ManipulationPitchTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 197 | if (! mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()) |
| 198 | return; |
| 199 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Stylize pitch") |
| 200 | PitchTier_stylizecxx . . $ PitchTier_stylize(25fef68f768d10e5). (mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).(), 2.0, true); |
| 201 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 202 | } |
| 203 | static void menu_cb_interpolateQuadraticallycxx . . $ menu_cb_interpolateQuadratically(714830c0c7b327fe). (ManipulationPitchTierAreacxx . . $ ManipulationPitchTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 204 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Interpolate quadratically", nullptr) |
| 205 | NATURALcxx . . $ `sys/EditorM.h:173:9`! (numberOfPointsPerParabola, U"Number of points per parabola", mycxx . . $ `melder/melder.h:44:9`! default_pitch_interpolateQuadratically_numberOfPointsPerParabola ()) |
| 206 | CHOICEcxx . . $ `sys/EditorM.h:361:9`! (units, U"Units", mycxx . . $ `melder/melder.h:44:9`! default_pitch_stylize_useSemitones () + 1) |
| 207 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"Hertz") |
| 208 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"semitones") |
| 209 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 210 | SET_INTEGERcxx . . $ `sys/EditorM.h:465:9`! (numberOfPointsPerParabola, mycxx . . $ `melder/melder.h:44:9`! instancePref_pitch_interpolateQuadratically_numberOfPointsPerParabola()) |
| 211 | SET_OPTIONcxx . . $ `sys/EditorM.h:474:9`! (units, mycxx . . $ `melder/melder.h:44:9`! instancePref_pitch_stylize_useSemitones() + 1) |
| 212 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 213 | if (! mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()) |
| 214 | return; |
| 215 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Interpolate quadratically") |
| 216 | mycxx . . $ `melder/melder.h:44:9`! setInstancePref_pitch_interpolateQuadratically_numberOfPointsPerParabolacxx . . $ structManipulationPitchTierArea#setInstancePref_pitch_interpolateQuadratically_numberOfPointsPerParabola(1624ee8275b10bda). (numberOfPointsPerParabola); |
| 217 | mycxx . . $ `melder/melder.h:44:9`! setInstancePref_pitch_stylize_useSemitonescxx . . $ structManipulationPitchTierArea#setInstancePref_pitch_stylize_useSemitones(b45ddcbc8423892c). (units - 1); |
| 218 | RealTier_interpolateQuadraticallycxx . . $ RealTier_interpolateQuadratically(cd1344c7fba97ae9). (mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).(), numberOfPointsPerParabola, mycxx . . $ `melder/melder.h:44:9`! instancePref_pitch_stylize_useSemitonescxx . . $ structManipulationPitchTierArea#instancePref_pitch_stylize_useSemitones(50ce9a9e25b4a850).()); |
| 219 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 220 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 221 | } |
| 222 | static void menu_cb_shiftPitchFrequenciescxx . . $ menu_cb_shiftPitchFrequencies(714830c0c7b327fe). (ManipulationPitchTierAreacxx . . $ ManipulationPitchTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 223 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Shift pitch frequencies", nullptr) |
| 224 | REALcxx . . $ `sys/EditorM.h:95:9`! (frequencyShift, U"Frequency shift", U"-20.0") |
| 225 | OPTIONMENUcxx . . $ `sys/EditorM.h:377:9`! (unit_i, U"Unit", 1) |
| 226 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"Hertz") |
| 227 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"mel") |
| 228 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"logHertz") |
| 229 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"semitones") |
| 230 | OPTIONcxx . . $ `sys/EditorM.h:387:9`! (U"ERB") |
| 231 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 232 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 233 | kPitch_unitcxx . . $ kPitch_unit# unit = |
| 234 | unit_i == 1 ? kPitch_unitcxx . . $ kPitch_unit#::HERTZcxx . . $ kPitch_unit#HERTZ. : |
| 235 | unit_i == 2 ? kPitch_unitcxx . . $ kPitch_unit#::MELcxx . . $ kPitch_unit#MEL. : |
| 236 | unit_i == 3 ? kPitch_unitcxx . . $ kPitch_unit#::LOG_HERTZcxx . . $ kPitch_unit#LOG_HERTZ. : |
| 237 | unit_i == 4 ? kPitch_unitcxx . . $ kPitch_unit#::SEMITONES_1cxx . . $ kPitch_unit#SEMITONES_1. : |
| 238 | kPitch_unitcxx . . $ kPitch_unit#::ERBcxx . . $ kPitch_unit#ERB.; |
| 239 | if (! mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()) |
| 240 | return; |
| 241 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Shift pitch frequencies") |
| 242 | try { |
| 243 | PitchTier_shiftFrequenciescxx . . $ PitchTier_shiftFrequencies(233d64163071de58). (mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), frequencyShift, unit); |
| 244 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 245 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 246 | // the PitchTier may have partially changed |
| 247 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 248 | throw; |
| 249 | } |
| 250 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 251 | } |
| 252 | static void menu_cb_multiplyPitchFrequenciescxx . . $ menu_cb_multiplyPitchFrequencies(714830c0c7b327fe). (ManipulationPitchTierAreacxx . . $ ManipulationPitchTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 253 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Multiply pitch frequencies", nullptr) |
| 254 | POSITIVEcxx . . $ `sys/EditorM.h:117:9`! (factor, U"Factor", U"1.2") |
| 255 | COMMENTcxx . . $ `sys/EditorM.h:237:9`! (U"The multiplication is always done in hertz.") |
| 256 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 257 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 258 | if (! mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()) |
| 259 | return; |
| 260 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Multiply pitch frequencies") |
| 261 | PitchTier_multiplyFrequenciescxx . . $ PitchTier_multiplyFrequencies(f6b3a312c6578774). (mycxx . . $ `melder/melder.h:44:9`! pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), factor); |
| 262 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 263 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 264 | } |
| 265 | static void menu_cb_setPitchRangecxx . . $ menu_cb_setPitchRange(714830c0c7b327fe). (ManipulationPitchTierAreacxx . . $ ManipulationPitchTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 266 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Set pitch range", nullptr) |
| 267 | REALcxx . . $ `sys/EditorM.h:95:9`! (dataFreeMinimum, U"Data-free minimum (Hz)", mycxx . . $ `melder/melder.h:44:9`! default_dataFreeMinimum()) |
| 268 | REALcxx . . $ `sys/EditorM.h:95:9`! (dataFreeMaximum, U"Data-free maximum (Hz)", mycxx . . $ `melder/melder.h:44:9`! default_dataFreeMaximum()) |
| 269 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 270 | SET_REALcxx . . $ `sys/EditorM.h:462:9`! (dataFreeMinimum, mycxx . . $ `melder/melder.h:44:9`! instancePref_dataFreeMinimum()) |
| 271 | SET_REALcxx . . $ `sys/EditorM.h:462:9`! (dataFreeMaximum, mycxx . . $ `melder/melder.h:44:9`! instancePref_dataFreeMaximum()) |
| 272 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 273 | mycxx . . $ `melder/melder.h:44:9`! setInstancePref_dataFreeMinimumcxx . . $ structRealTierArea#setInstancePref_dataFreeMinimum(ba8836b59fb42830). (dataFreeMinimum); |
| 274 | mycxx . . $ `melder/melder.h:44:9`! setInstancePref_dataFreeMaximumcxx . . $ structRealTierArea#setInstancePref_dataFreeMaximum(ba8836b59fb42830). (dataFreeMaximum); |
| 275 | mycxx . . $ `melder/melder.h:44:9`! v_updateScalingcxx . . $ structRealTierArea#v_updateScaling(49f6e7a06ebc5aa8). (); // BUG: should be viewChanged() |
| 276 | FunctionEditor_redrawcxx . . $ FunctionEditor_redraw(8d3b84f45830d365). (mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).()); |
| 277 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 278 | } |
| 279 | void structManipulationPitchTierAreacxx . . $ structManipulationPitchTierArea# :: v_createMenuscxx . . $ structManipulationPitchTierArea#v_createMenus(49f6e7a06ebc5aa8). () { |
| 280 | EditorMenucxx . . $ EditorMenu# menu = Editor_addMenucxx . . $ Editor_addMenu(8b39ac34ca8e016f). (ourcxx . . $ `melder/melder.h:42:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).(), U"Pitch", 0); |
| 281 | |
| 282 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Set pitch range...", 0, |
| 283 | menu_cb_setPitchRangecxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 284 | |
| 285 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"- Edit pitch:", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this); |
| 286 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Add pitch point at cursor", 'T' | GuiMenu_DEPTH_1cxx . . $ `sys/Gui.h:862:9`!, |
| 287 | menu_cb_addPitchPointAtCursorcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 288 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Add pitch point at time slice", 1, |
| 289 | menu_cb_addPitchPointAtSlicecxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 290 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Add pitch point at...", 1, |
| 291 | menu_cb_addPitchPointAtcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 292 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Remove pitch point(s)", GuiMenu_COMMAND_EXTRAcxx . . $ `sys/Gui.h:816:10`! | 'T' | GuiMenu_DEPTH_1cxx . . $ `sys/Gui.h:862:9`!, |
| 293 | menu_cb_removePitchPointscxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 294 | |
| 295 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"- Modify selected pitch:", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this); |
| 296 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Shift pitch frequencies...", 1, |
| 297 | menu_cb_shiftPitchFrequenciescxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 298 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Multiply pitch frequencies...", 1, |
| 299 | menu_cb_multiplyPitchFrequenciescxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 300 | |
| 301 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"- Modify whole pitch:", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this); |
| 302 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Stylize pitch...", 1, |
| 303 | menu_cb_stylizePitchcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 304 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Stylize pitch (2 st)", '2' | GuiMenu_DEPTH_1cxx . . $ `sys/Gui.h:862:9`!, |
| 305 | menu_cb_stylizePitch_2stcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 306 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Interpolate quadratically...", 1, |
| 307 | menu_cb_interpolateQuadraticallycxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 308 | } |
| 309 | |
| 310 | |
| 311 | #pragma mark - ManipDurationTierArea |
| 312 | |
| 313 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (ManipulationDurationTierArea, DurationTierArea, 0); |
| 314 | |
| 315 | static void menu_cb_setDurationRangecxx . . $ menu_cb_setDurationRange(fb588d0f8a67f61b). (ManipulationDurationTierAreacxx . . $ ManipulationDurationTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 316 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Set duration range", nullptr) |
| 317 | REALcxx . . $ `sys/EditorM.h:95:9`! (dataFreeMinimum, U"Data-free minimum", mycxx . . $ `melder/melder.h:44:9`! default_dataFreeMinimum()) |
| 318 | REALcxx . . $ `sys/EditorM.h:95:9`! (dataFreeMaximum, U"Data-free maximum", mycxx . . $ `melder/melder.h:44:9`! default_dataFreeMaximum()) |
| 319 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 320 | SET_REALcxx . . $ `sys/EditorM.h:462:9`! (dataFreeMinimum, mycxx . . $ `melder/melder.h:44:9`! instancePref_dataFreeMinimum()) |
| 321 | SET_REALcxx . . $ `sys/EditorM.h:462:9`! (dataFreeMaximum, mycxx . . $ `melder/melder.h:44:9`! instancePref_dataFreeMaximum()) |
| 322 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 323 | if (dataFreeMinimum > 1.0) |
| 324 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Minimum relative duration should not be greater than 1."); |
| 325 | if (dataFreeMaximum < 1.0) |
| 326 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Maximum relative duration should not be less than 1."); |
| 327 | if (dataFreeMinimum >= dataFreeMaximum) |
| 328 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Maximum relative duration should be greater than minimum."); |
| 329 | mycxx . . $ `melder/melder.h:44:9`! setInstancePref_dataFreeMinimumcxx . . $ structRealTierArea#setInstancePref_dataFreeMinimum(ba8836b59fb42830). (dataFreeMinimum); |
| 330 | mycxx . . $ `melder/melder.h:44:9`! setInstancePref_dataFreeMaximumcxx . . $ structRealTierArea#setInstancePref_dataFreeMaximum(ba8836b59fb42830). (dataFreeMaximum); |
| 331 | mycxx . . $ `melder/melder.h:44:9`! v_updateScalingcxx . . $ structRealTierArea#v_updateScaling(49f6e7a06ebc5aa8). (); |
| 332 | FunctionEditor_redrawcxx . . $ FunctionEditor_redraw(8d3b84f45830d365). (mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).()); |
| 333 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 334 | } |
| 335 | static void menu_cb_removeDurationPointscxx . . $ menu_cb_removeDurationPoints(fb588d0f8a67f61b). (ManipulationDurationTierAreacxx . . $ ManipulationDurationTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 336 | if (! mycxx . . $ `melder/melder.h:44:9`! durationcxx . . $ structManipulationDurationTierArea#duration(aaa64ef72daaef5f).()) |
| 337 | return; |
| 338 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Remove duration point(s)") |
| 339 | if (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() == mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()) |
| 340 | AnyTier_removePointNearcxx . . $ AnyTier_removePointNear(b9141c6a676b04b9). (mycxx . . $ `melder/melder.h:44:9`! durationcxx . . $ structManipulationDurationTierArea#duration(aaa64ef72daaef5f).()->asAnyTiercxx . . $ structRealTier#asAnyTier(2fecc017ee6dfbab).(), 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() + mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).())); |
| 341 | else |
| 342 | AnyTier_removePointsBetweencxx . . $ AnyTier_removePointsBetween(15327dad64b67f1a). (mycxx . . $ `melder/melder.h:44:9`! durationcxx . . $ structManipulationDurationTierArea#duration(aaa64ef72daaef5f).()->asAnyTiercxx . . $ structRealTier#asAnyTier(2fecc017ee6dfbab).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()); |
| 343 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 344 | } |
| 345 | static void menu_cb_addDurationPointAtCursorcxx . . $ menu_cb_addDurationPointAtCursor(fb588d0f8a67f61b). (ManipulationDurationTierAreacxx . . $ ManipulationDurationTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 346 | if (! mycxx . . $ `melder/melder.h:44:9`! durationcxx . . $ structManipulationDurationTierArea#duration(aaa64ef72daaef5f).()) |
| 347 | return; |
| 348 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Add duration point") |
| 349 | RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (mycxx . . $ `melder/melder.h:44:9`! durationcxx . . $ structManipulationDurationTierArea#duration(aaa64ef72daaef5f).(), 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() + mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()), mycxx . . $ `melder/melder.h:44:9`! ycursorcxx . . $ structRealTierArea#ycursor.); |
| 350 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 351 | } |
| 352 | static void menu_cb_addDurationPointAtcxx . . $ menu_cb_addDurationPointAt(fb588d0f8a67f61b). (ManipulationDurationTierAreacxx . . $ ManipulationDurationTierArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 353 | EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Add duration point", nullptr) |
| 354 | REALcxx . . $ `sys/EditorM.h:95:9`! (time, U"Time (s)", U"0.0"); |
| 355 | REALcxx . . $ `sys/EditorM.h:95:9`! (relativeDuration, U"Relative duration", U"1.0"); |
| 356 | EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`! |
| 357 | SET_REALcxx . . $ `sys/EditorM.h:462:9`! (time, 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelection() + mycxx . . $ `melder/melder.h:44:9`! endSelection())) |
| 358 | EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`! |
| 359 | if (! mycxx . . $ `melder/melder.h:44:9`! durationcxx . . $ structManipulationDurationTierArea#duration(aaa64ef72daaef5f).()) |
| 360 | return; |
| 361 | MODIFY_DATAcxx . . $ `sys/EditorM.h:611:9`! (U"Add duration point") |
| 362 | RealTierArea_addPointAtcxx . . $ RealTierArea_addPointAt(624837917fe0a142). (me, time, relativeDuration); |
| 363 | MODIFY_DATA_ENDcxx . . $ `sys/EditorM.h:613:9`! |
| 364 | EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`! |
| 365 | } |
| 366 | void structManipulationDurationTierAreacxx . . $ structManipulationDurationTierArea# :: v_createMenuscxx . . $ structManipulationDurationTierArea#v_createMenus(49f6e7a06ebc5aa8). () { |
| 367 | EditorMenucxx . . $ EditorMenu# menu = Editor_addMenucxx . . $ Editor_addMenu(8b39ac34ca8e016f). (ourcxx . . $ `melder/melder.h:42:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).(), U"Dur", 0); |
| 368 | |
| 369 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Set duration range...", 0, |
| 370 | menu_cb_setDurationRangecxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 371 | |
| 372 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"- Edit duration:", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this); |
| 373 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Add duration point at cursor", 'D' | GuiMenu_DEPTH_1cxx . . $ `sys/Gui.h:862:9`!, |
| 374 | menu_cb_addDurationPointAtCursorcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 375 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Add duration point at...", 1, |
| 376 | menu_cb_addDurationPointAtcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 377 | FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Remove duration point(s)", GuiMenu_COMMAND_EXTRAcxx . . $ `sys/Gui.h:816:10`! | 'D' | GuiMenu_DEPTH_1cxx . . $ `sys/Gui.h:862:9`!, |
| 378 | menu_cb_removeDurationPointscxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this); |
| 379 | } |
| 380 | |
| 381 | #pragma mark - ManipulationEditor |
| 382 | |
| 383 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (ManipulationEditor, FunctionEditor, 0); |
| 384 | |
| 385 | /* |
| 386 | * How to add a synthesis method (in an interruptable order): |
| 387 | * 1. add an Manipulation_ #define in Manipulation.h; |
| 388 | * 2. add a synthesize_ routine in Manipulation.cpp, and a reference to it in Manipulation_to_Sound; |
| 389 | * 3. add a button in ManipulationEditor.h; |
| 390 | * 4. add a cb_Synth_ callback. |
| 391 | * 5. create the button in createMenus and update updateMenus; |
| 392 | */ |
| 393 | |
| 394 | static const conststring32cxx . . $ conststring32# units_stringscxx . . $ units_strings. [] = { 0, U"Hz", U"st" }; |
| 395 | |
| 396 | static int prefs_synthesisMethodcxx . . $ prefs_synthesisMethod. = Manipulation_OVERLAPADDcxx . . $ `fon/Manipulation.h:53:9`!; /* Remembered across editor creations, not across Praat sessions. */ |
| 397 | |
| 398 | void structManipulationEditorcxx . . $ structManipulationEditor# :: v_updateMenuItemscxx . . $ structManipulationEditor#v_updateMenuItems(49f6e7a06ebc5aa8). () { |
| 399 | ManipulationEditor_Parentcxx . . $ ManipulationEditor_Parent# :: v_updateMenuItemscxx . . $ structFunctionEditor#v_updateMenuItems(49f6e7a06ebc5aa8). (); |
| 400 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (ourcxx . . $ `melder/melder.h:42:9`! synthPulsesButton); |
| 401 | GuiMenuItem_checkcxx . . $ GuiMenuItem_check(9c76b7451f460a69). (ourcxx . . $ `melder/melder.h:42:9`! synthPulsesButtoncxx . . $ structManipulationEditor#synthPulsesButton., ourcxx . . $ `melder/melder.h:42:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod. == Manipulation_PULSEScxx . . $ `fon/Manipulation.h:54:9`!); |
| 402 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (ourcxx . . $ `melder/melder.h:42:9`! synthPulsesHumButton); |
| 403 | GuiMenuItem_checkcxx . . $ GuiMenuItem_check(9c76b7451f460a69). (ourcxx . . $ `melder/melder.h:42:9`! synthPulsesHumButtoncxx . . $ structManipulationEditor#synthPulsesHumButton., ourcxx . . $ `melder/melder.h:42:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod. == Manipulation_PULSES_HUMcxx . . $ `fon/Manipulation.h:55:9`!); |
| 404 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (ourcxx . . $ `melder/melder.h:42:9`! synthPulsesLpcButton); |
| 405 | GuiMenuItem_checkcxx . . $ GuiMenuItem_check(9c76b7451f460a69). (ourcxx . . $ `melder/melder.h:42:9`! synthPulsesLpcButtoncxx . . $ structManipulationEditor#synthPulsesLpcButton., ourcxx . . $ `melder/melder.h:42:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod. == Manipulation_PULSES_LPCcxx . . $ `fon/Manipulation.h:63:9`!); |
| 406 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (ourcxx . . $ `melder/melder.h:42:9`! synthPitchButton); |
| 407 | GuiMenuItem_checkcxx . . $ GuiMenuItem_check(9c76b7451f460a69). (ourcxx . . $ `melder/melder.h:42:9`! synthPitchButtoncxx . . $ structManipulationEditor#synthPitchButton., ourcxx . . $ `melder/melder.h:42:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod. == Manipulation_PITCHcxx . . $ `fon/Manipulation.h:56:9`!); |
| 408 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (ourcxx . . $ `melder/melder.h:42:9`! synthPitchHumButton); |
| 409 | GuiMenuItem_checkcxx . . $ GuiMenuItem_check(9c76b7451f460a69). (ourcxx . . $ `melder/melder.h:42:9`! synthPitchHumButtoncxx . . $ structManipulationEditor#synthPitchHumButton., ourcxx . . $ `melder/melder.h:42:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod. == Manipulation_PITCH_HUMcxx . . $ `fon/Manipulation.h:57:9`!); |
| 410 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (ourcxx . . $ `melder/melder.h:42:9`! synthPulsesPitchButton); |
| 411 | GuiMenuItem_checkcxx . . $ GuiMenuItem_check(9c76b7451f460a69). (ourcxx . . $ `melder/melder.h:42:9`! synthPulsesPitchButtoncxx . . $ structManipulationEditor#synthPulsesPitchButton., ourcxx . . $ `melder/melder.h:42:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod. == Manipulation_PULSES_PITCHcxx . . $ `fon/Manipulation.h:58:9`!); |
| 412 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (ourcxx . . $ `melder/melder.h:42:9`! synthPulsesPitchHumButton); |
| 413 | GuiMenuItem_checkcxx . . $ GuiMenuItem_check(9c76b7451f460a69). (ourcxx . . $ `melder/melder.h:42:9`! synthPulsesPitchHumButtoncxx . . $ structManipulationEditor#synthPulsesPitchHumButton., ourcxx . . $ `melder/melder.h:42:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod. == Manipulation_PULSES_PITCH_HUMcxx . . $ `fon/Manipulation.h:59:9`!); |
| 414 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (ourcxx . . $ `melder/melder.h:42:9`! synthOverlapAddButton); |
| 415 | GuiMenuItem_checkcxx . . $ GuiMenuItem_check(9c76b7451f460a69). (ourcxx . . $ `melder/melder.h:42:9`! synthOverlapAddButtoncxx . . $ structManipulationEditor#synthOverlapAddButton., ourcxx . . $ `melder/melder.h:42:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod. == Manipulation_OVERLAPADDcxx . . $ `fon/Manipulation.h:53:9`!); |
| 416 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (ourcxx . . $ `melder/melder.h:42:9`! synthPitchLpcButton); |
| 417 | GuiMenuItem_checkcxx . . $ GuiMenuItem_check(9c76b7451f460a69). (ourcxx . . $ `melder/melder.h:42:9`! synthPitchLpcButtoncxx . . $ structManipulationEditor#synthPitchLpcButton., ourcxx . . $ `melder/melder.h:42:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod. == Manipulation_PITCH_LPCcxx . . $ `fon/Manipulation.h:65:9`!); |
| 418 | } |
| 419 | |
| 420 | /***** FILE MENU *****/ |
| 421 | |
| 422 | static void CONVERT_DATA_TO_ONE__ExtractOriginalSoundcxx . . $ CONVERT_DATA_TO_ONE__ExtractOriginalSound(7b48418a016d3676). (ManipulationEditorcxx . . $ ManipulationEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 423 | CONVERT_DATA_TO_ONEcxx . . $ `sys/EditorM.h:616:9`! |
| 424 | autoSoundcxx . . $ autoSound# result = Data_copycxx . . $ Data_copy(97a542a26794c80e). (mycxx . . $ `melder/melder.h:44:9`! soundAreacxx . . $ structManipulationEditor#soundArea(c09f9c582d02a6ac).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). soundcxx . . $ structSoundArea#sound(f0b31236b65da120).()); |
| 425 | CONVERT_DATA_TO_ONE_ENDcxx . . $ `sys/EditorM.h:618:9`! (U"untitled") |
| 426 | } |
| 427 | |
| 428 | static void CONVERT_DATA_TO_ONE__ExtractPulsescxx . . $ CONVERT_DATA_TO_ONE__ExtractPulses(7b48418a016d3676). (ManipulationEditorcxx . . $ ManipulationEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 429 | CONVERT_DATA_TO_ONEcxx . . $ `sys/EditorM.h:616:9`! |
| 430 | autoPointProcesscxx . . $ autoPointProcess# result = Data_copycxx . . $ Data_copy(97a542a26794c80e). (mycxx . . $ `melder/melder.h:44:9`! pulsesAreacxx . . $ structManipulationEditor#pulsesArea(8fa00db8ac63068).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pulsescxx . . $ structManipulationPulsesArea#pulses(43db3c50dce602ea).()); |
| 431 | CONVERT_DATA_TO_ONE_ENDcxx . . $ `sys/EditorM.h:618:9`! (U"untitled") |
| 432 | } |
| 433 | |
| 434 | static void CONVERT_DATA_TO_ONE__ExtractPitchTiercxx . . $ CONVERT_DATA_TO_ONE__ExtractPitchTier(7b48418a016d3676). (ManipulationEditorcxx . . $ ManipulationEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 435 | CONVERT_DATA_TO_ONEcxx . . $ `sys/EditorM.h:616:9`! |
| 436 | autoPitchTiercxx . . $ autoPitchTier# result = Data_copycxx . . $ Data_copy(97a542a26794c80e). (mycxx . . $ `melder/melder.h:44:9`! pitchTierAreacxx . . $ structManipulationEditor#pitchTierArea(aa2ef5e81631f4e0).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). pitchcxx . . $ structManipulationPitchTierArea#pitch(f405ba4cd3cfcea5).()); |
| 437 | CONVERT_DATA_TO_ONE_ENDcxx . . $ `sys/EditorM.h:618:9`! (U"untitled") |
| 438 | } |
| 439 | |
| 440 | static void CONVERT_DATA_TO_ONE__ExtractDurationTiercxx . . $ CONVERT_DATA_TO_ONE__ExtractDurationTier(7b48418a016d3676). (ManipulationEditorcxx . . $ ManipulationEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 441 | CONVERT_DATA_TO_ONEcxx . . $ `sys/EditorM.h:616:9`! |
| 442 | autoDurationTiercxx . . $ autoDurationTier# result = Data_copycxx . . $ Data_copy(97a542a26794c80e). (mycxx . . $ `melder/melder.h:44:9`! durationTierAreacxx . . $ structManipulationEditor#durationTierArea(a389e7b6d5a427f5).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). durationcxx . . $ structManipulationDurationTierArea#duration(aaa64ef72daaef5f).()); |
| 443 | CONVERT_DATA_TO_ONE_ENDcxx . . $ `sys/EditorM.h:618:9`! (U"untitled") |
| 444 | } |
| 445 | |
| 446 | static void CONVERT_DATA_TO_ONE__ExtractManipulatedSoundcxx . . $ CONVERT_DATA_TO_ONE__ExtractManipulatedSound(7b48418a016d3676). (ManipulationEditorcxx . . $ ManipulationEditor# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { |
| 447 | CONVERT_DATA_TO_ONEcxx . . $ `sys/EditorM.h:616:9`! |
| 448 | autoSoundcxx . . $ autoSound# result = Manipulation_to_Soundcxx . . $ Manipulation_to_Sound(7deae98ef053e36b). (mycxx . . $ `melder/melder.h:44:9`! manipulationcxx . . $ structManipulationEditor#manipulation(67cfb20179997bdc).(), mycxx . . $ `melder/melder.h:44:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod.); |
| 449 | CONVERT_DATA_TO_ONE_ENDcxx . . $ `sys/EditorM.h:618:9`! (U"untitled") |
| 450 | } |
| 451 | |
| 452 | /***** EDIT MENU *****/ |
| 453 | |
| 454 | //void structManipulationEditor :: v_saveData () { |
| 455 | // our previousPulses = Data_copy (our manipulation() -> pulses.get()); // could be null |
| 456 | // our previousPitch = Data_copy (our manipulation() -> pitch.get()); // could be null |
| 457 | // our previousDuration = Data_copy (our manipulation() -> duration.get()); // could be null |
| 458 | //} |
| 459 | |
| 460 | //void structManipulationEditor :: v_restoreData () { |
| 461 | // std::swap (our manipulation() -> pulses, our previousPulses); // could be null |
| 462 | // std::swap (our manipulation() -> pitch, our previousPitch); // could be null |
| 463 | // std::swap (our manipulation() -> duration, our previousDuration); // could be null |
| 464 | //} |
| 465 | |
| 466 | |
| 467 | static void menu_cb_ManipulationEditorHelpcxx . . $ menu_cb_ManipulationEditorHelp(7b48418a016d3676). (ManipulationEditorcxx . . $ ManipulationEditor#, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { Melder_helpcxx . . $ Melder_help(ff00d524ab0355ec). (U"ManipulationEditor"); } |
| 468 | static void menu_cb_ManipulationHelpcxx . . $ menu_cb_ManipulationHelp(7b48418a016d3676). (ManipulationEditorcxx . . $ ManipulationEditor#, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { Melder_helpcxx . . $ Melder_help(ff00d524ab0355ec). (U"Manipulation"); } |
| 469 | |
| 470 | #define menu_cb_Synth_commoncxx . . $ `foned/ManipulationEditor.cpp:470:9`!(menu_cb,meth) \ |
| 471 | static void menu_cb (ManipulationEditor me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) { \ |
| 472 | prefs_synthesisMethod = mycxx . . $ `melder/melder.h:44:9`! synthesisMethod = meth; \ |
| 473 | mycxx . . $ `melder/melder.h:44:9`! v_updateMenuItems (); /* once this change should be reflected graphically, use FunctionEditor_redraw() instead */ \ |
| 474 | } |
| 475 | menu_cb_Synth_commoncxx . . $ `foned/ManipulationEditor.cpp:470:9`! (menu_cb_Synth_Pulses, Manipulation_PULSEScxx . . $ `fon/Manipulation.h:54:9`!) |
| 476 | menu_cb_Synth_commoncxx . . $ `foned/ManipulationEditor.cpp:470:9`! (menu_cb_Synth_Pulses_hum, Manipulation_PULSES_HUMcxx . . $ `fon/Manipulation.h:55:9`!) |
| 477 | menu_cb_Synth_commoncxx . . $ `foned/ManipulationEditor.cpp:470:9`! (menu_cb_Synth_Pulses_Lpc, Manipulation_PULSES_LPCcxx . . $ `fon/Manipulation.h:63:9`!) |
| 478 | menu_cb_Synth_commoncxx . . $ `foned/ManipulationEditor.cpp:470:9`! (menu_cb_Synth_Pitch, Manipulation_PITCHcxx . . $ `fon/Manipulation.h:56:9`!) |
| 479 | menu_cb_Synth_commoncxx . . $ `foned/ManipulationEditor.cpp:470:9`! (menu_cb_Synth_Pitch_hum, Manipulation_PITCH_HUMcxx . . $ `fon/Manipulation.h:57:9`!) |
| 480 | menu_cb_Synth_commoncxx . . $ `foned/ManipulationEditor.cpp:470:9`! (menu_cb_Synth_Pulses_Pitch, Manipulation_PULSES_PITCHcxx . . $ `fon/Manipulation.h:58:9`!) |
| 481 | menu_cb_Synth_commoncxx . . $ `foned/ManipulationEditor.cpp:470:9`! (menu_cb_Synth_Pulses_Pitch_hum, Manipulation_PULSES_PITCH_HUMcxx . . $ `fon/Manipulation.h:59:9`!) |
| 482 | menu_cb_Synth_commoncxx . . $ `foned/ManipulationEditor.cpp:470:9`! (menu_cb_Synth_OverlapAdd_nodur, Manipulation_OVERLAPADD_NODURcxx . . $ `fon/Manipulation.h:60:9`!) |
| 483 | menu_cb_Synth_commoncxx . . $ `foned/ManipulationEditor.cpp:470:9`! (menu_cb_Synth_OverlapAdd, Manipulation_OVERLAPADDcxx . . $ `fon/Manipulation.h:53:9`!) |
| 484 | menu_cb_Synth_commoncxx . . $ `foned/ManipulationEditor.cpp:470:9`! (menu_cb_Synth_Pitch_Lpc, Manipulation_PITCH_LPCcxx . . $ `fon/Manipulation.h:65:9`!) |
| 485 | |
| 486 | void structManipulationEditorcxx . . $ structManipulationEditor# :: v_createMenuscxx . . $ structManipulationEditor#v_createMenus(49f6e7a06ebc5aa8). () { |
| 487 | ManipulationEditor_Parentcxx . . $ ManipulationEditor_Parent# :: v_createMenuscxx . . $ structFunctionEditor#v_createMenus(49f6e7a06ebc5aa8). (); |
| 488 | |
| 489 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"File", U"Extract original sound", 0, |
| 490 | CONVERT_DATA_TO_ONE__ExtractOriginalSoundcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 491 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"File", U"Extract pulses", 0, |
| 492 | CONVERT_DATA_TO_ONE__ExtractPulsescxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 493 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"File", U"Extract pitch tier", 0, |
| 494 | CONVERT_DATA_TO_ONE__ExtractPitchTiercxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 495 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"File", U"Extract duration tier", 0, |
| 496 | CONVERT_DATA_TO_ONE__ExtractDurationTiercxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 497 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"File", U"Publish resynthesis", 0, |
| 498 | CONVERT_DATA_TO_ONE__ExtractManipulatedSoundcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 499 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"File", U"-- close --", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).); |
| 500 | |
| 501 | Editor_addMenucxx . . $ Editor_addMenu(8b39ac34ca8e016f). (this, U"Synth", 0); |
| 502 | ourcxx . . $ `melder/melder.h:42:9`! synthPulsesButtoncxx . . $ structManipulationEditor#synthPulsesButton. = Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Synth", U"Pulses --", GuiMenu_RADIO_FIRSTcxx . . $ `sys/Gui.h:857:9`!, menu_cb_Synth_Pulsescxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 503 | ourcxx . . $ `melder/melder.h:42:9`! synthPulsesHumButtoncxx . . $ structManipulationEditor#synthPulsesHumButton. = Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Synth", U"Pulses (hum) --", GuiMenu_RADIO_NEXTcxx . . $ `sys/Gui.h:858:9`!, menu_cb_Synth_Pulses_humcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 504 | |
| 505 | ourcxx . . $ `melder/melder.h:42:9`! synthPulsesLpcButtoncxx . . $ structManipulationEditor#synthPulsesLpcButton. = Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Synth", U"Pulses & LPC -- (\"LPC resynthesis\")", GuiMenu_RADIO_NEXTcxx . . $ `sys/Gui.h:858:9`!, menu_cb_Synth_Pulses_Lpccxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 506 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Synth", U"-- pitch resynth --", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).); |
| 507 | ourcxx . . $ `melder/melder.h:42:9`! synthPitchButtoncxx . . $ structManipulationEditor#synthPitchButton. = Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Synth", U" -- Pitch", GuiMenu_RADIO_NEXTcxx . . $ `sys/Gui.h:858:9`!, menu_cb_Synth_Pitchcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 508 | ourcxx . . $ `melder/melder.h:42:9`! synthPitchHumButtoncxx . . $ structManipulationEditor#synthPitchHumButton. = Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Synth", U" -- Pitch (hum)", GuiMenu_RADIO_NEXTcxx . . $ `sys/Gui.h:858:9`!, menu_cb_Synth_Pitch_humcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 509 | ourcxx . . $ `melder/melder.h:42:9`! synthPulsesPitchButtoncxx . . $ structManipulationEditor#synthPulsesPitchButton. = Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Synth", U"Pulses -- Pitch", GuiMenu_RADIO_NEXTcxx . . $ `sys/Gui.h:858:9`!, menu_cb_Synth_Pulses_Pitchcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 510 | ourcxx . . $ `melder/melder.h:42:9`! synthPulsesPitchHumButtoncxx . . $ structManipulationEditor#synthPulsesPitchHumButton. = Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Synth", U"Pulses -- Pitch (hum)", GuiMenu_RADIO_NEXTcxx . . $ `sys/Gui.h:858:9`!, menu_cb_Synth_Pulses_Pitch_humcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 511 | Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Synth", U"-- full resynth --", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112).); |
| 512 | ourcxx . . $ `melder/melder.h:42:9`! synthOverlapAddButtoncxx . . $ structManipulationEditor#synthOverlapAddButton. = Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Synth", U"Sound & Pulses -- Pitch & Duration (\"Overlap-add manipulation\")", GuiMenu_RADIO_NEXTcxx . . $ `sys/Gui.h:858:9`! | GuiMenu_TOGGLE_ONcxx . . $ `sys/Gui.h:854:9`!, menu_cb_Synth_OverlapAddcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 513 | ourcxx . . $ `melder/melder.h:42:9`! synthPitchLpcButtoncxx . . $ structManipulationEditor#synthPitchLpcButton. = Editor_addCommandcxx . . $ Editor_addCommand(d7f2c642863274c0). (this, U"Synth", U"LPC -- Pitch (\"LPC pitch manipulation\")", GuiMenu_RADIO_NEXTcxx . . $ `sys/Gui.h:858:9`!, menu_cb_Synth_Pitch_Lpccxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 514 | } |
| 515 | |
| 516 | void structManipulationEditorcxx . . $ structManipulationEditor# :: v_createMenuItems_helpcxx . . $ structManipulationEditor#v_createMenuItems_help(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu# menu) { |
| 517 | ManipulationEditor_Parentcxx . . $ ManipulationEditor_Parent# :: v_createMenuItems_helpcxx . . $ structFunctionEditor#v_createMenuItems_help(6ea9c8c6ea2f58a9). (menu); |
| 518 | EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, U"ManipulationEditor help", '?', menu_cb_ManipulationEditorHelpcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 519 | EditorMenu_addCommandcxx . . $ EditorMenu_addCommand(b3c50ad5ffa1d58a). (menu, U"Manipulation help", 0, menu_cb_ManipulationHelpcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97).); |
| 520 | } |
| 521 | |
| 522 | /********** DRAWING AREA **********/ |
| 523 | |
| 524 | void structManipulationPitchTierAreacxx . . $ structManipulationPitchTierArea# :: v_drawInsidecxx . . $ structManipulationPitchTierArea#v_drawInside(49f6e7a06ebc5aa8). () { |
| 525 | const bool cursorVisible = ( |
| 526 | ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() == ourcxx . . $ `melder/melder.h:42:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).() && |
| 527 | ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() >= ourcxx . . $ `melder/melder.h:42:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).() && |
| 528 | ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() <= ourcxx . . $ `melder/melder.h:42:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).() |
| 529 | ); |
| 530 | Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), ourcxx . . $ `melder/melder.h:42:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), ourcxx . . $ `melder/melder.h:42:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), ourcxx . . $ `melder/melder.h:42:9`! ymincxx . . $ structRealTierArea#ymin., ourcxx . . $ `melder/melder.h:42:9`! ymaxcxx . . $ structRealTierArea#ymax.); |
| 531 | |
| 532 | /* |
| 533 | Draw pitch contour based on pulses. |
| 534 | */ |
| 535 | Graphics_setGreycxx . . $ Graphics_setGrey(2514a1c07b6be5e2). (graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.7); |
| 536 | /* BUG: should include grey dots */ |
| 537 | constPointProcesscxx . . $ constPointProcess# pulses = ((ManipulationEditorcxx . . $ ManipulationEditor#) functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).()) -> manipulationcxx . . $ structManipulationEditor#manipulation(67cfb20179997bdc).() -> pulsescxx . . $ structManipulation#pulses..getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(); |
| 538 | if (pulses) for (integercxx . . $ integer# i = 1; i < pulses -> ntcxx . . $ structPointProcess#nt.; i ++) { |
| 539 | const double tleft = pulses -> tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i], tright = pulses -> tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i + 1], t = 0.5 * (tleft + tright); |
| 540 | if (t >= startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).() && t <= endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).()) { |
| 541 | if (tleft != tright) { |
| 542 | const double y = 1.0 / (tright - tleft); |
| 543 | if (y >= ourcxx . . $ `melder/melder.h:42:9`! ymincxx . . $ structRealTierArea#ymin. && y <= ourcxx . . $ `melder/melder.h:42:9`! ymaxcxx . . $ structRealTierArea#ymax.) |
| 544 | Graphics_fillCircle_mmcxx . . $ Graphics_fillCircle_mm(8752bb7a78272ca7). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), t, y, 1.0); |
| 545 | } |
| 546 | } |
| 547 | } |
| 548 | Graphics_setGreycxx . . $ Graphics_setGrey(2514a1c07b6be5e2). (graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0); |
| 549 | |
| 550 | constexpr double minimumFrequency = 50.0; |
| 551 | FunctionEditor_drawGridLinecxx . . $ FunctionEditor_drawGridLine(ff1c6b8a68b21137). (ourcxx . . $ `melder/melder.h:42:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).(), minimumFrequency); |
| 552 | |
| 553 | const integercxx . . $ integer# n = ( ourcxx . . $ `melder/melder.h:42:9`! pitchTiercxx . . $ structPitchTierArea#pitchTier(f405ba4cd3cfcea5).() ? ourcxx . . $ `melder/melder.h:42:9`! pitchTiercxx . . $ structPitchTierArea#pitchTier(f405ba4cd3cfcea5).() -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. : 0 ); |
| 554 | if (cursorVisible && n > 0) { |
| 555 | const double y = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (ourcxx . . $ `melder/melder.h:42:9`! pitchTiercxx . . $ structPitchTierArea#pitchTier(f405ba4cd3cfcea5).(), ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).()); |
| 556 | FunctionEditor_insertCursorFunctionValuecxx . . $ FunctionEditor_insertCursorFunctionValue(39eff85a52becdb4). (ourcxx . . $ `melder/melder.h:42:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).(), y, |
| 557 | Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (y, 1), U" Hz", |
| 558 | ourcxx . . $ `melder/melder.h:42:9`! ymincxx . . $ structRealTierArea#ymin., ourcxx . . $ `melder/melder.h:42:9`! ymaxcxx . . $ structRealTierArea#ymax.); |
| 559 | } |
| 560 | ourcxx . . $ `melder/melder.h:42:9`! ManipulationPitchTierArea_Parentcxx . . $ ManipulationPitchTierArea_Parent# :: v_drawInsidecxx . . $ structRealTierArea#v_drawInside(49f6e7a06ebc5aa8). (); |
| 561 | } |
| 562 | |
| 563 | void structManipulationDurationTierAreacxx . . $ structManipulationDurationTierArea# :: v_drawInsidecxx . . $ structManipulationDurationTierArea#v_drawInside(49f6e7a06ebc5aa8). () { |
| 564 | const bool cursorVisible = ( |
| 565 | ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() == ourcxx . . $ `melder/melder.h:42:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).() && |
| 566 | ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() >= ourcxx . . $ `melder/melder.h:42:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).() && |
| 567 | ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() <= ourcxx . . $ `melder/melder.h:42:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).() |
| 568 | ); |
| 569 | Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (ourcxx . . $ `melder/melder.h:42:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), ourcxx . . $ `melder/melder.h:42:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), ourcxx . . $ `melder/melder.h:42:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), ourcxx . . $ `melder/melder.h:42:9`! ymincxx . . $ structRealTierArea#ymin., ourcxx . . $ `melder/melder.h:42:9`! ymaxcxx . . $ structRealTierArea#ymax.); |
| 570 | FunctionEditor_drawGridLinecxx . . $ FunctionEditor_drawGridLine(ff1c6b8a68b21137). (ourcxx . . $ `melder/melder.h:42:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).(), 1.0); // BUG: should move to FunctionArea |
| 571 | if (cursorVisible && ourcxx . . $ `melder/melder.h:42:9`! durationTiercxx . . $ structDurationTierArea#durationTier(aaa64ef72daaef5f).() -> pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size. > 0) { |
| 572 | const double y = RealTier_getValueAtTimecxx . . $ RealTier_getValueAtTime(22f4103126fb5be4). (ourcxx . . $ `melder/melder.h:42:9`! durationTiercxx . . $ structDurationTierArea#durationTier(aaa64ef72daaef5f).(), ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).()); |
| 573 | FunctionEditor_insertCursorFunctionValuecxx . . $ FunctionEditor_insertCursorFunctionValue(39eff85a52becdb4). (ourcxx . . $ `melder/melder.h:42:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).(), y, // BUG: should move to FunctionArea |
| 574 | Melder_fixedcxx . . $ Melder_fixed(5b9062840a6ade99). (y, 3), U"", ourcxx . . $ `melder/melder.h:42:9`! ymincxx . . $ structRealTierArea#ymin., ourcxx . . $ `melder/melder.h:42:9`! ymaxcxx . . $ structRealTierArea#ymax.); |
| 575 | } |
| 576 | ourcxx . . $ `melder/melder.h:42:9`! ManipulationDurationTierArea_Parentcxx . . $ ManipulationDurationTierArea_Parent# :: v_drawInsidecxx . . $ structRealTierArea#v_drawInside(49f6e7a06ebc5aa8). (); |
| 577 | } |
| 578 | |
| 579 | void structManipulationEditorcxx . . $ structManipulationEditor# :: v_playcxx . . $ structManipulationEditor#v_play(bc12c9ec15586e6a). (double startTime, double endTime) { |
| 580 | if (ourcxx . . $ `melder/melder.h:42:9`! clickWasModifiedByShiftKeycxx . . $ structFunctionEditor#clickWasModifiedByShiftKey.) { |
| 581 | Sound_playPartcxx . . $ Sound_playPart(4a8b47ed00757136). (ourcxx . . $ `melder/melder.h:42:9`! soundAreacxx . . $ structManipulationEditor#soundArea(c09f9c582d02a6ac).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), startTime, endTime, theFunctionEditor_playCallbackcxx . . $ MelderCallback#MelderCallback(b367fc31b94dacdb)., this); |
| 582 | } else { |
| 583 | Manipulation_playPartcxx . . $ Manipulation_playPart(43fb68d856ffd33a). (ourcxx . . $ `melder/melder.h:42:9`! manipulationcxx . . $ structManipulationEditor#manipulation(67cfb20179997bdc).(), startTime, endTime, ourcxx . . $ `melder/melder.h:42:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod.); |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | autoManipulationEditorcxx . . $ autoManipulationEditor# ManipulationEditor_createcxx . . $ ManipulationEditor_create(3553cdab87a8e341). (conststring32cxx . . $ conststring32# title, Manipulationcxx . . $ Manipulation# manipulation) { |
| 588 | try { |
| 589 | autoManipulationEditorcxx . . $ autoManipulationEditor# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (ManipulationEditor); |
| 590 | mycxx . . $ `melder/melder.h:44:9`! soundAreacxx . . $ structManipulationEditor#soundArea(c09f9c582d02a6ac).() =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). ManipulationSoundArea_createcxx . . $ ManipulationSoundArea_create(2bb0ce32df50c84c). (false, nullptr, me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 591 | mycxx . . $ `melder/melder.h:44:9`! pulsesAreacxx . . $ structManipulationEditor#pulsesArea(8fa00db8ac63068).() =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). ManipulationPulsesArea_createcxx . . $ ManipulationPulsesArea_create(80e31b0dbc193bf9). (true, nullptr, me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 592 | mycxx . . $ `melder/melder.h:44:9`! pitchTierAreacxx . . $ structManipulationEditor#pitchTierArea(aa2ef5e81631f4e0).() =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). ManipulationPitchTierArea_createcxx . . $ ManipulationPitchTierArea_create(1765152599996eaf). (true, nullptr, me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 593 | mycxx . . $ `melder/melder.h:44:9`! pitchTierAreacxx . . $ structManipulationEditor#pitchTierArea(aa2ef5e81631f4e0).() ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). borrowedPulsesAreacxx . . $ structManipulationPitchTierArea#borrowedPulsesArea. = mycxx . . $ `melder/melder.h:44:9`! pulsesAreacxx . . $ structManipulationEditor#pulsesArea(8fa00db8ac63068).().getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(); |
| 594 | mycxx . . $ `melder/melder.h:44:9`! durationTierAreacxx . . $ structManipulationEditor#durationTierArea(a389e7b6d5a427f5).() =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). ManipulationDurationTierArea_createcxx . . $ ManipulationDurationTierArea_create(5254e4aa88e34dd7). (true, nullptr, me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 595 | FunctionEditor_initcxx . . $ FunctionEditor_init(719bc58b4917372e). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), title, manipulation); |
| 596 | |
| 597 | mycxx . . $ `melder/melder.h:44:9`! synthesisMethodcxx . . $ structManipulationEditor#synthesisMethod. = prefs_synthesisMethodcxx . . $ prefs_synthesisMethod.; // BUG: should be in v1_dataChanged() |
| 598 | //my v_updateMenuItems (); // BUG: should not be necessary |
| 599 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 600 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 601 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Manipulation window not created."); |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | /* End of file ManipulationEditor.cpp */ |