Debian Codegraph @

foned/SoundArea.cpp

raw symbols SCIP
1 /* SoundArea.cpp
2 *
3 * Copyright (C) 2022-2026 Paul Boersma, 2007 Erez Volk (FLAC support)
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 "SoundArea.h"cxx . . $ `<file>/foned/SoundArea.h`/
20 #include "LongSoundArea.h"cxx . . $ `<file>/foned/LongSoundArea.h`/
21 #include "../kar/UnicodeData.h"cxx . . $ `<file>/kar/UnicodeData.h`/
22 #include "Sound_and_MixingMatrix.h"cxx . . $ `<file>/dwtools/Sound_and_MixingMatrix.h`/
23 #include "EditorM.h"cxx . . $ `<file>/sys/EditorM.h`/
24
25 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (SoundArea, FunctionArea, 0);
26 Thing_implementcxx . . $ `sys/Thing.h:65:9`! (LongSoundArea, FunctionArea, 0);
27
28 #include "enums_getText.h"cxx . . $ `<file>/melder/enums_getText.h`/
29 #include "SoundArea_enums.h"cxx . . $ `<file>/foned/SoundArea_enums.h`/
30 #include "enums_getValue.h"cxx . . $ `<file>/melder/enums_getValue.h`/
31 #include "SoundArea_enums.h"cxx . . $ `<file>/foned/SoundArea_enums.h`/
32
33 #include "Prefs_define.h"cxx . . $ `<file>/sys/Prefs_define.h`/
34 #include "SoundArea_prefs.h"cxx . . $ `<file>/foned/SoundArea_prefs.h`/
35 #include "Prefs_install.h"cxx . . $ `<file>/sys/Prefs_install.h`/
36 #include "SoundArea_prefs.h"cxx . . $ `<file>/foned/SoundArea_prefs.h`/
37 #include "Prefs_copyToInstance.h"cxx . . $ `<file>/sys/Prefs_copyToInstance.h`/
38 #include "SoundArea_prefs.h"cxx . . $ `<file>/foned/SoundArea_prefs.h`/
39
40
41 #pragma mark - SoundArea info
42
43 void structSoundAreacxx . . $ structSoundArea# :: v1_infocxx . . $ structSoundArea#v1_info(49f6e7a06ebc5aa8). () {
44 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Sound scaling strategy: ", kSoundArea_scalingStrategy_getTextcxx . . $ kSoundArea_scalingStrategy_getText(a7f711a83c3b8548). (ourcxx . . $ `melder/melder.h:42:9`! instancePref_scalingStrategycxx . . $ structSoundArea#instancePref_scalingStrategy(f3f743233d8ac2b4).()));
45 }
46
47
48 #pragma mark - SoundArea drawing
49
50 static void SoundArea_drawCursorFunctionValuecxx . . $ SoundArea_drawCursorFunctionValue(2c4fe740ee66fb5). (SoundAreacxx . . $ SoundArea# me, double yWC, conststring32cxx . . $ conststring32# yWC_string, conststring32cxx . . $ conststring32# units) {
51 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), DataGui_defaultForegroundColourcxx . . $ DataGui_defaultForegroundColour(7d058e310f398cfa). (me, true));
52 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), yWC, 0.99 * mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).() + 0.01 * mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), yWC);
53 Graphics_fillCircle_mmcxx . . $ Graphics_fillCircle_mm(8752bb7a78272ca7). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() + mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()), yWC, 1.5);
54 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_RIGHTcxx . . $ `sys/Graphics.h:251:9`!, Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
55 Graphics_textcxx . . $ Graphics_text(bd267f534253e388). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), yWC, yWC_string, units);
56 }
57
58 void structSoundAreacxx . . $ structSoundArea# :: v_drawInsidecxx . . $ structSoundArea#v_drawInside(49f6e7a06ebc5aa8). () {
59 SoundArea_drawcxx . . $ SoundArea_draw(c8a312b6aaea1713). (this);
60 }
61
62 void SoundArea_drawcxx . . $ SoundArea_draw(c8a312b6aaea1713). (SoundAreacxx . . $ SoundArea# me) {
63 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (!! mycxx . . $ `melder/melder.h:44:9`! sound() != !! mycxx . . $ `melder/melder.h:44:9`! longSound());
64
65 if (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).()) {
66 try {
67 LongSound_haveWindowcxx . . $ LongSound_haveWindow(800e017703ada13a). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).());
68 } catch (MelderErrorcxx . . $ MelderError#) {
69 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
70 }
71 }
72
73 const integercxx . . $ integer# numberOfChannels = mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).() -> nycxx . . $ structSampledXY#ny.;
74 const bool cursorVisible = ( mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() == mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).() &&
75 mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() >= mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).() && mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() <= mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).() );
76 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Melder_BLACKcxx . . $ Melder_BLACK.);
77 if (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).() && mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).() - mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).() > mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).() -> bufferLengthcxx . . $ structLongSound#bufferLength.) {
78 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0, 1.0, 0.0, 1.0);
79 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Melder_BLACKcxx . . $ Melder_BLACK.);
80 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_CENTREcxx . . $ `sys/Graphics.h:250:9`!, Graphics_BOTTOMcxx . . $ `sys/Graphics.h:252:9`!);
81 Graphics_textcxx . . $ Graphics_text(bd267f534253e388). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.5, 0.5, U"(window longer than ",
82 Melder_graphicalSinglecxx . . $ Melder_graphicalSingle(f05d861d9dbec9b2). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).() -> bufferLengthcxx . . $ structLongSound#bufferLength.), U" seconds)");
83 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_CENTREcxx . . $ `sys/Graphics.h:250:9`!, Graphics_TOPcxx . . $ `sys/Graphics.h:254:9`!);
84 Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.5, 0.5, U"(zoom in to see the samples)");
85 return;
86 }
87 bool fits;
88 try {
89 fits = ( mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() ? true : LongSound_haveWindowcxx . . $ LongSound_haveWindow(800e017703ada13a). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).()) );
90 } catch (MelderErrorcxx . . $ MelderError#) {
91 const bool outOfMemory = !! str32strcxx . . $ str32str(2de17cd8f7c584a6). (Melder_getErrorcxx . . $ Melder_getError(1912f6684645c851). (), U"memory");
92 if (Melder_debugcxx . . $ Melder_debug. == 9)
93 Melder_flushErrorcxx . . $ Melder_flushError(49f6e7a06ebc5aa8). ();
94 else
95 Melder_clearErrorcxx . . $ Melder_clearError(49f6e7a06ebc5aa8). ();
96 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0, 1.0, 0.0, 1.0);
97 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_CENTREcxx . . $ `sys/Graphics.h:250:9`!, Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
98 Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.5, 0.5, outOfMemory ? U"(out of memory)" : U"(cannot read sound file)");
99 return;
100 }
101 if (! fits) {
102 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0, 1.0, 0.0, 1.0);
103 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_CENTREcxx . . $ `sys/Graphics.h:250:9`!, Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
104 Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.5, 0.5, U"(window too large; zoom in to see the data)");
105 return;
106 }
107 integercxx . . $ integer# first, last;
108 if (Sampled_getWindowSamplescxx . . $ Sampled_getWindowSamples(fe99094ed5bb3f6a). (mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), & first, & last) <= 1) {
109 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0, 1.0, 0.0, 1.0);
110 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_CENTREcxx . . $ `sys/Graphics.h:250:9`!, Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
111 Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.5, 0.5, U"(zoom out to see the data)");
112 return;
113 }
114 const integercxx . . $ integer# numberOfVisibleChannels = Melder_clippedRightcxx . . $ Melder_clippedRight(f80f7d6260b3ee3a). (numberOfChannels, 8_integercxx . . $ `operator""_integer`(85240eb457c3721a).);
115 const integercxx . . $ integer# firstVisibleChannel = mycxx . . $ `melder/melder.h:44:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. + 1;
116 const integercxx . . $ integer# lastVisibleChannel = Melder_clippedRightcxx . . $ Melder_clippedRight(f80f7d6260b3ee3a). (mycxx . . $ `melder/melder.h:44:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. + numberOfVisibleChannels, numberOfChannels);
117 double maximumExtent = 0.0, visibleMinimum = 0.0, visibleMaximum = 0.0;
118 if (mycxx . . $ `melder/melder.h:44:9`! instancePref_scalingStrategycxx . . $ structSoundArea#instancePref_scalingStrategy(f3f743233d8ac2b4).() == kSoundArea_scalingStrategy::BY_WINDOW) {
119 if (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).())
120 LongSound_getWindowExtremacxx . . $ LongSound_getWindowExtrema(149e83e2dc5652b8). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), firstVisibleChannel,
121 & visibleMinimum, & visibleMaximum);
122 else
123 Matrix_getWindowExtremacxx . . $ Matrix_getWindowExtrema(d50591dd897af896). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), first, last, firstVisibleChannel, firstVisibleChannel,
124 & visibleMinimum, & visibleMaximum);
125 for (integercxx . . $ integer# ichan = firstVisibleChannel + 1; ichan <= lastVisibleChannel; ichan ++) {
126 double visibleChannelMinimum, visibleChannelMaximum;
127 if (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).())
128 LongSound_getWindowExtremacxx . . $ LongSound_getWindowExtrema(149e83e2dc5652b8). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), ichan,
129 & visibleChannelMinimum, & visibleChannelMaximum);
130 else
131 Matrix_getWindowExtremacxx . . $ Matrix_getWindowExtrema(d50591dd897af896). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), first, last, ichan, ichan, & visibleChannelMinimum, & visibleChannelMaximum);
132 if (visibleChannelMinimum < visibleMinimum)
133 visibleMinimum = visibleChannelMinimum;
134 if (visibleChannelMaximum > visibleMaximum)
135 visibleMaximum = visibleChannelMaximum;
136 }
137 maximumExtent = visibleMaximum - visibleMinimum;
138 }
139 for (integercxx . . $ integer# ichan = firstVisibleChannel; ichan <= lastVisibleChannel; ichan ++) {
140 const double cursorFunctionValue = ( mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).() ? 0.0 :
141 Vector_getValueAtXcxx . . $ Vector_getValueAtX(1bfdbe9f8adea74f). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() + mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()), ichan, kVector_valueInterpolationcxx . . $ kVector_valueInterpolation# :: SINC70cxx . . $ kVector_valueInterpolation#SINC70.) );
142 const double ymin = (double) (numberOfVisibleChannels - ichan + mycxx . . $ `melder/melder.h:44:9`! channelOffsetcxx . . $ structSoundArea#channelOffset.) / numberOfVisibleChannels;
143 const double ymax = (double) (numberOfVisibleChannels + 1 - ichan + mycxx . . $ `melder/melder.h:44:9`! channelOffsetcxx . . $ structSoundArea#channelOffset.) / numberOfVisibleChannels;
144 Graphics_Viewportcxx . . $ Graphics_Viewport# vp = Graphics_insetViewportcxx . . $ Graphics_insetViewport(b48873d7bfae0d92). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0, 1.0, ymin, ymax);
145 bool horizontal = false;
146 double minimum = -1.0, maximum = +1.0;
147 if (mycxx . . $ `melder/melder.h:44:9`! instancePref_scalingStrategycxx . . $ structSoundArea#instancePref_scalingStrategy(f3f743233d8ac2b4).() == kSoundArea_scalingStrategy::BY_WHOLE) {
148 mycxx . . $ `melder/melder.h:44:9`! getGlobalExtremacxx . . $ structSoundArea#getGlobalExtrema(a695690fb8d46395). (& minimum, & maximum);
149 } else if (mycxx . . $ `melder/melder.h:44:9`! instancePref_scalingStrategycxx . . $ structSoundArea#instancePref_scalingStrategy(f3f743233d8ac2b4).() == kSoundArea_scalingStrategy::BY_WINDOW) {
150 if (numberOfChannels > 2) {
151 if (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).())
152 LongSound_getWindowExtremacxx . . $ LongSound_getWindowExtrema(149e83e2dc5652b8). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), ichan, & minimum, & maximum);
153 else
154 Matrix_getWindowExtremacxx . . $ Matrix_getWindowExtrema(d50591dd897af896). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), first, last, ichan, ichan, & minimum, & maximum);
155 if (maximumExtent > 0.0) {
156 const double middle = 0.5 * (minimum + maximum);
157 minimum = middle - 0.5 * maximumExtent;
158 maximum = middle + 0.5 * maximumExtent;
159 }
160 } else {
161 minimum = visibleMinimum;
162 maximum = visibleMaximum;
163 }
164 } else if (mycxx . . $ `melder/melder.h:44:9`! instancePref_scalingStrategycxx . . $ structSoundArea#instancePref_scalingStrategy(f3f743233d8ac2b4).() == kSoundArea_scalingStrategy::BY_WINDOW_AND_CHANNEL) {
165 if (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).())
166 LongSound_getWindowExtremacxx . . $ LongSound_getWindowExtrema(149e83e2dc5652b8). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), ichan, & minimum, & maximum);
167 else
168 Matrix_getWindowExtremacxx . . $ Matrix_getWindowExtrema(d50591dd897af896). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), first, last, ichan, ichan, & minimum, & maximum);
169 } else if (mycxx . . $ `melder/melder.h:44:9`! instancePref_scalingStrategycxx . . $ structSoundArea#instancePref_scalingStrategy(f3f743233d8ac2b4).() == kSoundArea_scalingStrategy::FIXED_HEIGHT) {
170 if (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).())
171 LongSound_getWindowExtremacxx . . $ LongSound_getWindowExtrema(149e83e2dc5652b8). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), ichan, & minimum, & maximum);
172 else
173 Matrix_getWindowExtremacxx . . $ Matrix_getWindowExtrema(d50591dd897af896). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), first, last, ichan, ichan, & minimum, & maximum);
174 const double channelExtent = mycxx . . $ `melder/melder.h:44:9`! instancePref_scaling_heightcxx . . $ structSoundArea#instancePref_scaling_height(21b6c25e127938e2).();
175 const double middle = 0.5 * (minimum + maximum);
176 minimum = middle - 0.5 * channelExtent;
177 maximum = middle + 0.5 * channelExtent;
178 } else if (mycxx . . $ `melder/melder.h:44:9`! instancePref_scalingStrategycxx . . $ structSoundArea#instancePref_scalingStrategy(f3f743233d8ac2b4).() == kSoundArea_scalingStrategy::FIXED_RANGE) {
179 minimum = mycxx . . $ `melder/melder.h:44:9`! instancePref_scaling_minimumcxx . . $ structSoundArea#instancePref_scaling_minimum(21b6c25e127938e2).();
180 maximum = mycxx . . $ `melder/melder.h:44:9`! instancePref_scaling_maximumcxx . . $ structSoundArea#instancePref_scaling_maximum(21b6c25e127938e2).();
181 }
182 if (minimum == maximum) {
183 horizontal = true;
184 minimum -= 1.0;
185 maximum += 1.0;
186 }
187 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), minimum, maximum);
188 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), DataGui_defaultForegroundColourcxx . . $ DataGui_defaultForegroundColour(7d058e310f398cfa). (me, false));
189 if (horizontal) {
190 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_RIGHTcxx . . $ `sys/Graphics.h:251:9`!, Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
191 const double mid = 0.5 * (minimum + maximum);
192 Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mid, Melder_graphicalHalfcxx . . $ Melder_graphicalHalf(f05d861d9dbec9b2). (mid));
193 } else {
194 if (! cursorVisible || isundefcxx . . $ isundef(f8197d536af80c96). (cursorFunctionValue) || Graphics_dyWCtoMMcxx . . $ Graphics_dyWCtoMM(f042c24bcd87f07e). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), cursorFunctionValue - minimum) > 4.0) {
195 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_RIGHTcxx . . $ `sys/Graphics.h:251:9`!, ichan == lastVisibleChannel? Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`! : Graphics_BOTTOMcxx . . $ `sys/Graphics.h:252:9`!);
196 Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), minimum, Melder_graphicalHalfcxx . . $ Melder_graphicalHalf(f05d861d9dbec9b2). (minimum));
197 }
198 if (! cursorVisible || isundefcxx . . $ isundef(f8197d536af80c96). (cursorFunctionValue) || Graphics_dyWCtoMMcxx . . $ Graphics_dyWCtoMM(f042c24bcd87f07e). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), maximum - cursorFunctionValue) > 4.0) {
199 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_RIGHTcxx . . $ `sys/Graphics.h:251:9`!, ichan == firstVisibleChannel ? Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`! : Graphics_TOPcxx . . $ `sys/Graphics.h:254:9`!);
200 Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), maximum, Melder_graphicalHalfcxx . . $ Melder_graphicalHalf(f05d861d9dbec9b2). (maximum));
201 }
202 }
203 if (minimum < 0.0 && maximum > 0.0 && ! horizontal) {
204 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0, 1.0, minimum, maximum);
205 if (! cursorVisible || isundefcxx . . $ isundef(f8197d536af80c96). (cursorFunctionValue) || fabscxx . . $ fabs(fee4f1d22bc8e617). (Graphics_dyWCtoMMcxx . . $ Graphics_dyWCtoMM(f042c24bcd87f07e). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), cursorFunctionValue - 0.0)) > 3.5) {
206 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_RIGHTcxx . . $ `sys/Graphics.h:251:9`!, Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
207 Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0, 0.0, U"0");
208 }
209 Graphics_setLineTypecxx . . $ Graphics_setLineType(9abe41586e87648d). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_DOTTEDcxx . . $ `sys/Graphics.h:288:9`!);
210 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0, 0.0, 1.0, 0.0);
211 Graphics_setLineTypecxx . . $ Graphics_setLineType(9abe41586e87648d). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_DRAWNcxx . . $ `sys/Graphics.h:287:9`!);
212 }
213 /*
214 Garnish the drawing area of each channel.
215 */
216 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Melder_BLACKcxx . . $ Melder_BLACK.);
217 if (numberOfChannels > 1) {
218 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Graphics_LEFTcxx . . $ `sys/Graphics.h:249:9`!, Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
219 conststring32cxx . . $ conststring32# channelName = mycxx . . $ `melder/melder.h:44:9`! v_getChannelNamecxx . . $ structSoundArea#v_getChannelName(7b348ebc2004441d). (ichan);
220 static MelderStringcxx . . $ MelderString# channelLabel;
221 MelderString_copycxx . . $ MelderString_copy(65be51a793e0ff96). (& channelLabel, ( channelName ? U"ch" : U"Ch " ), ichan);
222 if (channelName)
223 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& channelLabel, U": ", channelName);
224 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& channelLabel, U" ",
225 ( mycxx . . $ `melder/melder.h:44:9`! muteChannelscxx . . $ structSoundArea#muteChannels. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ichan] ? UNITEXT_SPEAKER_WITH_CANCELLATION_STROKEcxx . . $ `kar/UnicodeData.h:75197:9`! : UNITEXT_SPEAKERcxx . . $ `kar/UnicodeData.h:75199:9`! ));
226 if (ichan > 8 && ichan - mycxx . . $ `melder/melder.h:44:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. == 1)
227 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& channelLabel, U" " UNITEXT_UPWARDS_ARROWcxx . . $ `kar/UnicodeData.h:15443:9`!);
228 else if (numberOfChannels >= 8 && ichan - mycxx . . $ `melder/melder.h:44:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. == 8 && ichan < numberOfChannels)
229 MelderString_appendcxx . . $ MelderString_append(65be51a793e0ff96). (& channelLabel, U" " UNITEXT_DOWNWARDS_ARROWcxx . . $ `kar/UnicodeData.h:15447:9`!);
230 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0, 1.0, 0.0, 1.0);
231 Graphics_textcxx . . $ Graphics_text(bd267f534253e388). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 1.0, 0.5, channelLabel.stringcxx . . $ MelderString#string.);
232 }
233 /*
234 Draw a very thin separator line underneath.
235 */
236 if (ichan - mycxx . . $ `melder/melder.h:44:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. < 8 && ichan - mycxx . . $ `melder/melder.h:44:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. < numberOfVisibleChannels) {
237 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0, 1.0, 0.0, 1.0);
238 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), mycxx . . $ `melder/melder.h:44:9`! editablecxx . . $ structDataGui#editable(50ce9a9e25b4a850).() ? DataGuiColour_EDITABLE_FRAMEcxx . . $ DataGuiColour_EDITABLE_FRAME. : DataGuiColour_NONEDITABLE_FRAMEcxx . . $ DataGuiColour_NONEDITABLE_FRAME.);
239 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), 0.0, 0.0, 1.0, 0.0);
240 }
241 /*
242 Draw the samples.
243 */
244 if (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).()) {
245 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), minimum, maximum);
246 if (cursorVisible && isdefinedcxx . . $ isdefined(f8197d536af80c96). (cursorFunctionValue))
247 SoundArea_drawCursorFunctionValuecxx . . $ SoundArea_drawCursorFunctionValue(2c4fe740ee66fb5). (me, cursorFunctionValue, Melder_graphicalHalfcxx . . $ Melder_graphicalHalf(f05d861d9dbec9b2). (cursorFunctionValue), U"");
248 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), DataGui_defaultForegroundColourcxx . . $ DataGui_defaultForegroundColour(7d058e310f398cfa). (me, false));
249 Graphics_functioncxx . . $ Graphics_function(1c6279e2c8b8beb1). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), & mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).ichan] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).0], first, last,
250 Sampled_indexToXcxx . . $ Sampled_indexToX(65bcd2c9acbb3dd5). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), first), Sampled_indexToXcxx . . $ Sampled_indexToX(65bcd2c9acbb3dd5). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), last));
251 } else {
252 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), minimum * 32768, maximum * 32768);
253 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), DataGui_defaultForegroundColourcxx . . $ DataGui_defaultForegroundColour(7d058e310f398cfa). (me, false));
254 Graphics_function16cxx . . $ Graphics_function16(c87b521cd384fe60). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(),
255 mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).() -> buffercxx . . $ structLongSound#buffer..asArgumentToFunctionThatExpectsZeroBasedArraycxx . . $ autovector#asArgumentToFunctionThatExpectsZeroBasedArray(5a2a78a048fb49a8).() - mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).() -> imincxx . . $ structLongSound#imin. * numberOfChannels + (ichan - 1),
256 numberOfChannels, first, last, Sampled_indexToXcxx . . $ Sampled_indexToX(65bcd2c9acbb3dd5). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), first), Sampled_indexToXcxx . . $ Sampled_indexToX(65bcd2c9acbb3dd5). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), last)
257 );
258 }
259 Graphics_setColourcxx . . $ Graphics_setColour(eb47b9513d3f4721). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), Melder_BLACKcxx . . $ Melder_BLACK.);
260 Graphics_resetViewportcxx . . $ Graphics_resetViewport(620f27fff4cd4a03). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structFunctionArea#graphics(5af6864da672d398).(), vp);
261 }
262 }
263
264
265 #pragma mark - SoundArea tracking
266
267 bool structSoundAreacxx . . $ structSoundArea# :: v_mousecxx . . $ structSoundArea#v_mouse(3d5a26054778c78d). (GuiDrawingArea_MouseEventcxx . . $ GuiDrawingArea_MouseEvent# event, double x_world, double localY_fraction) {
268 if (event -> isClickcxx . . $ structGuiDrawingArea_MouseEvent#isClick(50ce9a9e25b4a850).()) {
269 const integercxx . . $ integer# numberOfChannels = ourcxx . . $ `melder/melder.h:42:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).() -> nycxx . . $ structSampledXY#ny.;
270 if (event -> commandKeyPressedcxx . . $ structGuiDrawingArea_MouseEvent#commandKeyPressed.) {
271 if (numberOfChannels > 1) {
272 const integercxx . . $ integer# numberOfVisibleChannels = Melder_clippedRightcxx . . $ Melder_clippedRight(f80f7d6260b3ee3a). (numberOfChannels, 8_integercxx . . $ `operator""_integer`(85240eb457c3721a).);
273 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (numberOfVisibleChannels >= 1); // for Melder_clipped
274 const integercxx . . $ integer# clickedChannel = ourcxx . . $ `melder/melder.h:42:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. +
275 Melder_clippedcxx . . $ Melder_clipped(5eb09607cedc971b). (1_integercxx . . $ `operator""_integer`(85240eb457c3721a)., Melder_ifloorcxx . . $ `melder/melder_ftoi.h:33:9`! ((1.0 - localY_fraction) * numberOfVisibleChannels + 1), numberOfVisibleChannels);
276 const integercxx . . $ integer# firstVisibleChannel = ourcxx . . $ `melder/melder.h:42:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. + 1;
277 const integercxx . . $ integer# lastVisibleChannel = Melder_clippedRightcxx . . $ Melder_clippedRight(f80f7d6260b3ee3a). (ourcxx . . $ `melder/melder.h:42:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. + numberOfVisibleChannels, numberOfChannels);
278 if (clickedChannel >= firstVisibleChannel && clickedChannel <= lastVisibleChannel) {
279 ourcxx . . $ `melder/melder.h:42:9`! muteChannelscxx . . $ structSoundArea#muteChannels. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).clickedChannel] = ! ourcxx . . $ `melder/melder.h:42:9`! muteChannelscxx . . $ structSoundArea#muteChannels. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).clickedChannel];
280 return FunctionEditor_UPDATE_NEEDEDcxx . . $ `foned/FunctionEditor.h:222:9`!;
281 }
282 }
283 } else {
284 if (numberOfChannels > 8) {
285 if (x_world >= ourcxx . . $ `melder/melder.h:42:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).() && localY_fraction > 0.875 && localY_fraction <= 1.000 && ourcxx . . $ `melder/melder.h:42:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. > 0) {
286 ourcxx . . $ `melder/melder.h:42:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. -= 8;
287 return FunctionEditor_UPDATE_NEEDEDcxx . . $ `foned/FunctionEditor.h:222:9`!;
288 }
289 if (x_world >= ourcxx . . $ `melder/melder.h:42:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).() && localY_fraction > 0.000 && localY_fraction <= 0.125 && ourcxx . . $ `melder/melder.h:42:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. < numberOfChannels - 8) {
290 ourcxx . . $ `melder/melder.h:42:9`! channelOffsetcxx . . $ structSoundArea#channelOffset. += 8;
291 return FunctionEditor_UPDATE_NEEDEDcxx . . $ `foned/FunctionEditor.h:222:9`!;
292 }
293 }
294 }
295 }
296 return FunctionEditor_defaultMouseInWideDataViewcxx . . $ FunctionEditor_defaultMouseInWideDataView(f60eeae5fe5430ba). (ourcxx . . $ `melder/melder.h:42:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).(), event, x_world);
297 }
298
299 bool SoundArea_mousecxx . . $ SoundArea_mouse(65721cdfd2db412a). (SoundAreacxx . . $ SoundArea# me, GuiDrawingArea_MouseEventcxx . . $ GuiDrawingArea_MouseEvent# event, double x_world, double globalY_fraction) {
300 const double localY_fraction = mycxx . . $ `melder/melder.h:44:9`! y_fraction_globalToLocalcxx . . $ structFunctionArea#y_fraction_globalToLocal(7e3a3c6b59947c6d). (globalY_fraction);
301 return mycxx . . $ `melder/melder.h:44:9`! v_mousecxx . . $ structSoundArea#v_mouse(3d5a26054778c78d). (event, x_world, localY_fraction);
302 }
303
304
305 #pragma mark - SoundArea playing
306
307 void SoundArea_playcxx . . $ SoundArea_play(8591d98d1e7b94a5). (SoundAreacxx . . $ SoundArea# me, double startTime, double endTime) {
308 const integercxx . . $ integer# numberOfChannels = mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).() -> nycxx . . $ structSampledXY#ny.;
309 integercxx . . $ integer# numberOfMuteChannels = 0;
310 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! muteChannels.size == numberOfChannels);
311 for (integercxx . . $ integer# ichan = 1; ichan <= numberOfChannels; ichan ++)
312 if (mycxx . . $ `melder/melder.h:44:9`! muteChannelscxx . . $ structSoundArea#muteChannels. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ichan])
313 numberOfMuteChannels ++;
314 const integercxx . . $ integer# numberOfChannelsToPlay = numberOfChannels - numberOfMuteChannels;
315 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (numberOfChannelsToPlay > 0,
316 U"Please select at least one channel to play.");
317 if (numberOfMuteChannels > 0) {
318 autoMixingMatrixcxx . . $ autoMixingMatrix# thee = MixingMatrix_createcxx . . $ MixingMatrix_create(3585a88d304573af). (numberOfChannelsToPlay, numberOfChannels);
319 MixingMatrix_muteAndActivateChannelscxx . . $ MixingMatrix_muteAndActivateChannels(31a0bef1e1312fe8). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! muteChannelscxx . . $ structSoundArea#muteChannels..getcxx . . $ autovector#get(e8d1da7fe68a6585).());
320 if (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).()) {
321 autoSoundcxx . . $ autoSound# part = LongSound_extractPartcxx . . $ LongSound_extractPart(8c068bc499307d4e). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), startTime, endTime, true);
322 Sound_MixingMatrix_playPartcxx . . $ Sound_MixingMatrix_playPart(4e5f9b0f4e2af956). (part.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), startTime, endTime, theFunctionEditor_playCallbackcxx . . $ MelderCallback#MelderCallback(b367fc31b94dacdb)., mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).());
323 } else {
324 Sound_MixingMatrix_playPartcxx . . $ Sound_MixingMatrix_playPart(4e5f9b0f4e2af956). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), startTime, endTime, theFunctionEditor_playCallbackcxx . . $ MelderCallback#MelderCallback(b367fc31b94dacdb)., mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).());
325 }
326 } else {
327 if (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).())
328 LongSound_playPartcxx . . $ LongSound_playPart(f36b44453a225d5d). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), startTime, endTime, theFunctionEditor_playCallbackcxx . . $ MelderCallback#MelderCallback(b367fc31b94dacdb)., mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).());
329 else
330 Sound_playPartcxx . . $ Sound_playPart(4a8b47ed00757136). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), startTime, endTime, theFunctionEditor_playCallbackcxx . . $ MelderCallback#MelderCallback(b367fc31b94dacdb)., mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).());
331 }
332 }
333
334
335 #pragma mark - SoundArea File
336
337 static void do_writecxx . . $ do_write(a229bbe447683f58). (SoundAreacxx . . $ SoundArea# me, MelderFilecxx . . $ MelderFile# file, int format, int numberOfBitsPerSamplePoint) {
338 if (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() >= mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).())
339 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"No samples selected.");
340 if (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).()) {
341 LongSound_savePartAsAudioFilecxx . . $ LongSound_savePartAsAudioFile(ecfe2aaf8cd9945b). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), format, mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(),
342 file, numberOfBitsPerSamplePoint);
343 } else if (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).()) {
344 integercxx . . $ integer# first, last;
345 const integercxx . . $ integer# numberOfSamples = Sampled_getWindowSamplescxx . . $ Sampled_getWindowSamples(fe99094ed5bb3f6a). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(),
346 mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), & first, & last);
347 if (numberOfSamples) {
348 autoSoundcxx . . $ autoSound# save = Sound_createcxx . . $ Sound_create(39ab106d6b9a0135). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nycxx . . $ structSampledXY#ny., 0.0,
349 numberOfSamples * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx., numberOfSamples, mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx., 0.5 * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx.);
350 const integercxx . . $ integer# offset = first - 1;
351 for (integercxx . . $ integer# channel = 1; channel <= mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nycxx . . $ structSampledXY#ny.; channel ++)
352 for (integercxx . . $ integer# i = first; i <= last; i ++)
353 save ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i - offset] = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
354 Sound_saveAsAudioFilecxx . . $ Sound_saveAsAudioFile(5caabbbba2b52333). (save.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), file, format, numberOfBitsPerSamplePoint);
355 }
356 }
357 }
358 static void menu_cb_WriteWavcxx . . $ menu_cb_WriteWav(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
359 EDITOR_FORM_SAVEcxx . . $ `sys/EditorM.h:489:9`! (U"Save selected sound as WAV file", nullptr)
360 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (defaultName,300, mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).() -> namecxx . . $ structThing#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U".wav");
361 EDITOR_DO_SAVEcxx . . $ `sys/EditorM.h:493:9`!
362 do_writecxx . . $ do_write(a229bbe447683f58). (me, file, Melder_WAVcxx . . $ `melder/melder_audiofiles.h:26:9`!, 16);
363 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
364 }
365 static void menu_cb_SaveAs24BitWavcxx . . $ menu_cb_SaveAs24BitWav(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
366 EDITOR_FORM_SAVEcxx . . $ `sys/EditorM.h:489:9`! (U"Save selected sound as 24-bit WAV file", nullptr)
367 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (! mycxx . . $ `melder/melder.h:44:9`! longSound() && mycxx . . $ `melder/melder.h:44:9`! sound());
368 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (defaultName,300, mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> namecxx . . $ structThing#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U".wav");
369 EDITOR_DO_SAVEcxx . . $ `sys/EditorM.h:493:9`!
370 do_writecxx . . $ do_write(a229bbe447683f58). (me, file, Melder_WAVcxx . . $ `melder/melder_audiofiles.h:26:9`!, 24);
371 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
372 }
373 static void menu_cb_SaveAs32BitWavcxx . . $ menu_cb_SaveAs32BitWav(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
374 EDITOR_FORM_SAVEcxx . . $ `sys/EditorM.h:489:9`! (U"Save selected sound as 32-bit WAV file", nullptr)
375 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (! mycxx . . $ `melder/melder.h:44:9`! longSound() && mycxx . . $ `melder/melder.h:44:9`! sound());
376 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (defaultName,300, mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> namecxx . . $ structThing#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U".wav");
377 EDITOR_DO_SAVEcxx . . $ `sys/EditorM.h:493:9`!
378 do_writecxx . . $ do_write(a229bbe447683f58). (me, file, Melder_WAVcxx . . $ `melder/melder_audiofiles.h:26:9`!, 32);
379 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
380 }
381 static void menu_cb_WriteAiffcxx . . $ menu_cb_WriteAiff(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
382 EDITOR_FORM_SAVEcxx . . $ `sys/EditorM.h:489:9`! (U"Save selected sound as AIFF file", nullptr)
383 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (defaultName,300, mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).() -> namecxx . . $ structThing#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U".aiff");
384 EDITOR_DO_SAVEcxx . . $ `sys/EditorM.h:493:9`!
385 do_writecxx . . $ do_write(a229bbe447683f58). (me, file, Melder_AIFFcxx . . $ `melder/melder_audiofiles.h:24:9`!, 16);
386 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
387 }
388 static void menu_cb_WriteAifccxx . . $ menu_cb_WriteAifc(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
389 EDITOR_FORM_SAVEcxx . . $ `sys/EditorM.h:489:9`! (U"Save selected sound as AIFC file", nullptr)
390 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (defaultName,300, mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).() -> namecxx . . $ structThing#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U".aifc");
391 EDITOR_DO_SAVEcxx . . $ `sys/EditorM.h:493:9`!
392 do_writecxx . . $ do_write(a229bbe447683f58). (me, file, Melder_AIFCcxx . . $ `melder/melder_audiofiles.h:25:9`!, 16);
393 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
394 }
395 static void menu_cb_WriteNextSuncxx . . $ menu_cb_WriteNextSun(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
396 EDITOR_FORM_SAVEcxx . . $ `sys/EditorM.h:489:9`! (U"Save selected sound as NeXT/Sun file", nullptr)
397 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (defaultName,300, mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).() -> namecxx . . $ structThing#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U".au");
398 EDITOR_DO_SAVEcxx . . $ `sys/EditorM.h:493:9`!
399 do_writecxx . . $ do_write(a229bbe447683f58). (me, file, Melder_NEXT_SUNcxx . . $ `melder/melder_audiofiles.h:27:9`!, 16);
400 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
401 }
402 static void menu_cb_WriteNistcxx . . $ menu_cb_WriteNist(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
403 EDITOR_FORM_SAVEcxx . . $ `sys/EditorM.h:489:9`! (U"Save selected sound as NIST file", nullptr)
404 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (defaultName,300, mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).() -> namecxx . . $ structThing#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U".nist");
405 EDITOR_DO_SAVEcxx . . $ `sys/EditorM.h:493:9`!
406 do_writecxx . . $ do_write(a229bbe447683f58). (me, file, Melder_NISTcxx . . $ `melder/melder_audiofiles.h:28:9`!, 16);
407 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
408 }
409 static void menu_cb_WriteFlaccxx . . $ menu_cb_WriteFlac(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
410 EDITOR_FORM_SAVEcxx . . $ `sys/EditorM.h:489:9`! (U"Save selected sound as FLAC file", nullptr)
411 Melder_sprintcxx . . $ Melder_sprint(2b992b0fb5123bdf). (defaultName,300, mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).() -> namecxx . . $ structThing#name..getcxx . . $ _autostring#get(5a2a78a048fb49a8).(), U".flac");
412 EDITOR_DO_SAVEcxx . . $ `sys/EditorM.h:493:9`!
413 do_writecxx . . $ do_write(a229bbe447683f58). (me, file, Melder_FLACcxx . . $ `melder/melder_audiofiles.h:29:9`!, 16);
414 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
415 }
416 void structSoundAreacxx . . $ structSoundArea# :: v_createMenuItems_savecxx . . $ structSoundArea#v_createMenuItems_save(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu# menu) {
417 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"- Save sound to disk:", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this);
418 ourcxx . . $ `melder/melder.h:42:9`! writeWavButtoncxx . . $ structSoundArea#writeWavButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
419 U"Save selected sound as WAV file... ||"
420 " Write selected sound to WAV file... ||"
421 " Write sound selection to WAV file... ||"
422 " Write selection to WAV file...",
423 1, menu_cb_WriteWavcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
424 );
425 if (! Thing_isacxx . . $ Thing_isa(8cbb12e93d03b2a1). (this, classLongSoundAreacxx . . $ classLongSoundArea.)) { // BUG: why not for LongSound?
426 ourcxx . . $ `melder/melder.h:42:9`! saveAs24BitWavButtoncxx . . $ structSoundArea#saveAs24BitWavButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
427 U"Save selected sound as 24-bit WAV file...",
428 1, menu_cb_SaveAs24BitWavcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
429 );
430 ourcxx . . $ `melder/melder.h:42:9`! saveAs32BitWavButtoncxx . . $ structSoundArea#saveAs32BitWavButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
431 U"Save selected sound as 32-bit WAV file...",
432 1, menu_cb_SaveAs32BitWavcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
433 );
434 }
435 ourcxx . . $ `melder/melder.h:42:9`! writeAiffButtoncxx . . $ structSoundArea#writeAiffButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
436 U"Save selected sound as AIFF file... ||"
437 " Write selected sound to AIFF file... ||"
438 " Write sound selection to AIFF file... ||"
439 " Write selection to AIFF file...",
440 1, menu_cb_WriteAiffcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
441 );
442 ourcxx . . $ `melder/melder.h:42:9`! writeAifcButtoncxx . . $ structSoundArea#writeAifcButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
443 U"Save selected sound as AIFC file... ||"
444 " Write selected sound to AIFC file... ||"
445 " Write sound selection to AIFC file... ||"
446 " Write selection to AIFC file...",
447 1, menu_cb_WriteAifccxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
448 );
449 ourcxx . . $ `melder/melder.h:42:9`! writeNextSunButtoncxx . . $ structSoundArea#writeNextSunButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
450 U"Save selected sound as NeXT/Sun file... ||"
451 " Write selected sound to NeXT/Sun file... ||"
452 " Write sound selection to NeXT/Sun file... ||"
453 " Write selection to NeXT/Sun file...",
454 1, menu_cb_WriteNextSuncxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
455 );
456 ourcxx . . $ `melder/melder.h:42:9`! writeNistButtoncxx . . $ structSoundArea#writeNistButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
457 U"Save selected sound as NIST file... ||"
458 " Write selected sound to NIST file... ||"
459 " Write sound selection to NIST file... ||"
460 " Write selection to NIST file...",
461 1, menu_cb_WriteNistcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
462 );
463 ourcxx . . $ `melder/melder.h:42:9`! writeFlacButtoncxx . . $ structSoundArea#writeFlacButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
464 U"Save selected sound as FLAC file... ||"
465 " Write selected sound to FLAC file... ||"
466 " Write sound selection to FLAC file...",
467 1, menu_cb_WriteFlaccxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
468 );
469 }
470
471
472 #pragma mark - SoundArea Edit
473
474 static void menu_cb_Copycxx . . $ menu_cb_Copy(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
475 try {
476 Sound_clipboardcxx . . $ Sound_clipboard. =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). ( mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).()
477 ? LongSound_extractPartcxx . . $ LongSound_extractPart(8c068bc499307d4e). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), false)
478 : Sound_extractPartcxx . . $ Sound_extractPart(e1651eb055dd2f09). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), kSound_windowShapecxx . . $ kSound_windowShape#::RECTANGULARcxx . . $ kSound_windowShape#RECTANGULAR., 1.0, false)
479 );
480 } catch (MelderErrorcxx . . $ MelderError#) {
481 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Sound selection not copied to clipboard.");
482 }
483 }
484 static void menu_cb_Cutcxx . . $ menu_cb_Cut(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
485 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! sound());
486 try {
487 integercxx . . $ integer# first, last;
488 const integercxx . . $ integer# selectionNumberOfSamples = Sampled_getWindowSamplescxx . . $ Sampled_getWindowSamples(fe99094ed5bb3f6a). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(),
489 mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), & first, & last);
490 const integercxx . . $ integer# oldNumberOfSamples = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nxcxx . . $ structSampled#nx.;
491 const integercxx . . $ integer# newNumberOfSamples = oldNumberOfSamples - selectionNumberOfSamples;
492 if (newNumberOfSamples < 1)
493 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"You cannot cut all of the signal away,\n"
494 U"because you cannot create a Sound with 0 samples.\n"
495 U"You could consider using Copy instead."
496 );
497
498 if (selectionNumberOfSamples > 0) {
499 /*
500 Create without change.
501 */
502 autoSoundcxx . . $ autoSound# publish = Sound_createcxx . . $ Sound_create(39ab106d6b9a0135). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nycxx . . $ structSampledXY#ny.,
503 0.0, selectionNumberOfSamples * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx.,
504 selectionNumberOfSamples, mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx., 0.5 * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx.
505 );
506 for (integercxx . . $ integer# channel = 1; channel <= mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nycxx . . $ structSampledXY#ny.; channel ++) {
507 integercxx . . $ integer# j = 0;
508 for (integercxx . . $ integer# i = first; i <= last; i ++)
509 publish ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).++ j] = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
510 }
511 autoMATcxx . . $ autoMAT# newData = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nycxx . . $ structSampledXY#ny., newNumberOfSamples);
512 for (integercxx . . $ integer# channel = 1; channel <= mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nycxx . . $ structSampledXY#ny.; channel ++) {
513 integercxx . . $ integer# j = 0;
514 for (integercxx . . $ integer# i = 1; i < first; i ++)
515 newData [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).++ j] = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
516 for (integercxx . . $ integer# i = last + 1; i <= oldNumberOfSamples; i ++)
517 newData [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).++ j] = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
518 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (j == newData.ncol);
519 }
520 FunctionArea_savecxx . . $ FunctionArea_save(7511dfaa04acd353). (me, U"Cut");
521 /*
522 Change without error.
523 */
524 mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> xmincxx . . $ structFunction#xmin. = 0.0;
525 mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> xmaxcxx . . $ structFunction#xmax. = newNumberOfSamples * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx.;
526 mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nxcxx . . $ structSampled#nx. = newNumberOfSamples;
527 mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> x1cxx . . $ structSampled#x1. = 0.5 * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx.;
528 mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> zcxx . . $ structMatrix#z. =cxx . . $ automatrix#`operator=`(a0f46581f260c488). newData.movecxx . . $ automatrix#move(8771494f681de611).();
529 Sound_clipboardcxx . . $ Sound_clipboard. =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). publish.movecxx . . $ autoSomeThing#move(25acc3554b7d1642).();
530
531 /*
532 Start updating the markers of the FunctionEditor, respecting the invariants.
533 */
534 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> tmincxx . . $ structFunctionEditor#tmin. = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> xmincxx . . $ structFunction#xmin.;
535 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> tmaxcxx . . $ structFunctionEditor#tmax. = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> xmaxcxx . . $ structFunction#xmax.;
536
537 /*
538 Collapse the selection,
539 so that the Cut operation can immediately be undone by a Paste.
540 The exact position will be half-way in between two samples.
541 */
542 const double cursor = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> xmincxx . . $ structFunction#xmin. + (first - 1) * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx.;
543 mycxx . . $ `melder/melder.h:44:9`! setSelectioncxx . . $ structFunctionArea#setSelection(bc12c9ec15586e6a). (cursor, cursor);
544
545 /*
546 Update the window.
547 */
548 {
549 const double t1 = (first - 1) * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx.;
550 const double t2 = last * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx.;
551 const double windowLength = mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).() - mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(); // > 0
552 if (t1 > mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).())
553 if (t2 < mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).())
554 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> startWindowcxx . . $ structFunctionEditor#startWindow. -= 0.5 * (t2 - t1);
555 else
556 (void) 0;
557 else if (t2 < mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).())
558 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> startWindowcxx . . $ structFunctionEditor#startWindow. -= t2 - t1;
559 else /* Cut overlaps entire window: centre. */
560 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> startWindowcxx . . $ structFunctionEditor#startWindow. = mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> startSelectioncxx . . $ structFunctionEditor#startSelection. - 0.5 * windowLength;
561 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> endWindowcxx . . $ structFunctionEditor#endWindow. = mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).() + windowLength; // first try
562 if (mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).() > mycxx . . $ `melder/melder.h:44:9`! tmaxcxx . . $ structFunctionArea#tmax(21b6c25e127938e2).()) {
563 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> startWindowcxx . . $ structFunctionEditor#startWindow. -= mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).() - mycxx . . $ `melder/melder.h:44:9`! tmaxcxx . . $ structFunctionArea#tmax(21b6c25e127938e2).(); // second try
564 Melder_clipLeftcxx . . $ Melder_clipLeft(6245cd023a7d1552). (mycxx . . $ `melder/melder.h:44:9`! tmincxx . . $ structFunctionArea#tmin(21b6c25e127938e2).(), & mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> startWindowcxx . . $ structFunctionEditor#startWindow.); // third try
565 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> endWindowcxx . . $ structFunctionEditor#endWindow. = mycxx . . $ `melder/melder.h:44:9`! tmaxcxx . . $ structFunctionArea#tmax(21b6c25e127938e2).(); // second try
566 } else if (mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).() < mycxx . . $ `melder/melder.h:44:9`! tmincxx . . $ structFunctionArea#tmin(21b6c25e127938e2).()) {
567 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> endWindowcxx . . $ structFunctionEditor#endWindow. -= mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).() - mycxx . . $ `melder/melder.h:44:9`! tmincxx . . $ structFunctionArea#tmin(21b6c25e127938e2).(); // second try
568 Melder_clipRightcxx . . $ Melder_clipRight(5b63ce711df1ade7). (& mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> endWindowcxx . . $ structFunctionEditor#endWindow., mycxx . . $ `melder/melder.h:44:9`! tmaxcxx . . $ structFunctionArea#tmax(21b6c25e127938e2).()); // third try
569 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> startWindowcxx . . $ structFunctionEditor#startWindow. = mycxx . . $ `melder/melder.h:44:9`! tmincxx . . $ structFunctionArea#tmin(21b6c25e127938e2).(); // second try
570 }
571 }
572
573 /*
574 Force FunctionEditor to show changes.
575 */
576 FunctionEditor_ungroupcxx . . $ FunctionEditor_ungroup(fde123624714e72). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).());
577 //FunctionEditor_windowMarksChanged (my functionEditor(), true);
578 FunctionArea_broadcastDataChangedcxx . . $ FunctionArea_broadcastDataChanged(88b39197b202d92f). (me);
579 } else {
580 Melder_warningcxx . . $ Melder_warning(6298c93241566110). (U"No samples selected.");
581 }
582 } catch (MelderErrorcxx . . $ MelderError#) {
583 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Sound selection not cut to clipboard.");
584 }
585 }
586 static void pastecxx . . $ paste(5125870f4b940eea). (SoundAreacxx . . $ SoundArea# me, int where) {
587 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! sound());
588 if (! Sound_clipboardcxx . . $ Sound_clipboard.) {
589 Melder_warningcxx . . $ Melder_warning(6298c93241566110). (U"Clipboard is empty; nothing pasted.");
590 return;
591 }
592 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (Sound_clipboard -> ny == mycxx . . $ `melder/melder.h:44:9`! sound() -> ny,
593 U"Cannot paste, because\n"
594 U"the number of channels of the clipboard is not equal to\n"
595 U"the number of channels of the edited sound."
596 );
597 Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (Sound_clipboard -> dx == mycxx . . $ `melder/melder.h:44:9`! sound() -> dx,
598 U"Cannot paste, because\n"
599 U"the sampling frequency of the clipboard is not equal to\n"
600 U"the sampling frequency of the edited sound."
601 );
602 const integercxx . . $ integer# oldNumberOfSamples = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nxcxx . . $ structSampled#nx.;
603 const integercxx . . $ integer# leftSample = Melder_clippedcxx . . $ Melder_clipped(5eb09607cedc971b). (
604 0_integercxx . . $ `operator""_integer`(85240eb457c3721a).,
605 Sampled_xToLowIndexcxx . . $ Sampled_xToLowIndex(405c2491bc3636e9). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), where == 3 ? mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).() : mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).()),
606 oldNumberOfSamples
607 );
608 const integercxx . . $ integer# rightSample = Melder_clippedcxx . . $ Melder_clipped(5eb09607cedc971b). (
609 0_integercxx . . $ `operator""_integer`(85240eb457c3721a).,
610 Sampled_xToLowIndexcxx . . $ Sampled_xToLowIndex(405c2491bc3636e9). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), where == 1 ? mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() : mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()),
611 oldNumberOfSamples
612 );
613 const integercxx . . $ integer# newNumberOfSamples =
614 oldNumberOfSamples + Sound_clipboardcxx . . $ Sound_clipboard. ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nxcxx . . $ structSampled#nx. - (rightSample - leftSample);
615 /*
616 Check without change.
617 */
618 autoMATcxx . . $ autoMAT# newData = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nycxx . . $ structSampledXY#ny., newNumberOfSamples);
619 for (integercxx . . $ integer# channel = 1; channel <= mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nycxx . . $ structSampledXY#ny.; channel ++) {
620 integercxx . . $ integer# j = 0;
621 for (integercxx . . $ integer# i = 1; i <= leftSample; i ++)
622 newData [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).++ j] = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
623 for (integercxx . . $ integer# i = 1; i <= Sound_clipboardcxx . . $ Sound_clipboard. ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nxcxx . . $ structSampled#nx.; i ++)
624 newData [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).++ j] = Sound_clipboardcxx . . $ Sound_clipboard. ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
625 for (integercxx . . $ integer# i = rightSample + 1; i <= oldNumberOfSamples; i ++)
626 newData [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).++ j] = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> zcxx . . $ structMatrix#z. [cxx . . $ automatrix#`operator[]`(2d545b3cb3f8e666).channel] [cxx . . $ vector#`operator[]`(8a4599b8835d1ce1).i];
627 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (j == newData.ncol);
628 }
629 FunctionArea_savecxx . . $ FunctionArea_save(7511dfaa04acd353). (me, where == 1 ? U"Paste before" : where == 2 ? U"Paste over" : U"Paste after");
630 /*
631 Change without error.
632 */
633 mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> xmincxx . . $ structFunction#xmin. = 0.0;
634 mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> xmaxcxx . . $ structFunction#xmax. = newNumberOfSamples * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx.;
635 mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nxcxx . . $ structSampled#nx. = newNumberOfSamples;
636 mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> x1cxx . . $ structSampled#x1. = 0.5 * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx.;
637 mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> zcxx . . $ structMatrix#z. =cxx . . $ automatrix#`operator=`(a0f46581f260c488). newData.movecxx . . $ automatrix#move(8771494f681de611).();
638
639 /*
640 Start updating the markers of the FunctionEditor, respecting the invariants.
641 */
642 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> tmincxx . . $ structFunctionEditor#tmin. = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> xmincxx . . $ structFunction#xmin.;
643 mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> tmaxcxx . . $ structFunctionEditor#tmax. = mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> xmaxcxx . . $ structFunction#xmax.;
644 Melder_clipLeftcxx . . $ Melder_clipLeft(6245cd023a7d1552). (mycxx . . $ `melder/melder.h:44:9`! tmincxx . . $ structFunctionArea#tmin(21b6c25e127938e2).(), & mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> startWindowcxx . . $ structFunctionEditor#startWindow.);
645 Melder_clipRightcxx . . $ Melder_clipRight(5b63ce711df1ade7). (& mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> endWindowcxx . . $ structFunctionEditor#endWindow., mycxx . . $ `melder/melder.h:44:9`! tmaxcxx . . $ structFunctionArea#tmax(21b6c25e127938e2).());
646 mycxx . . $ `melder/melder.h:44:9`! setSelectioncxx . . $ structFunctionArea#setSelection(bc12c9ec15586e6a). (leftSample * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx., (leftSample + Sound_clipboardcxx . . $ Sound_clipboard. ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). nxcxx . . $ structSampled#nx.) * mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> dxcxx . . $ structSampled#dx.);
647
648 /*
649 Force FunctionEditor to show changes.
650 */
651 FunctionEditor_ungroupcxx . . $ FunctionEditor_ungroup(fde123624714e72). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).());
652 FunctionEditor_windowMarksChangedcxx . . $ FunctionEditor_windowMarksChanged(ce925ac19f5bbd22). (mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).(), true);
653 FunctionArea_broadcastDataChangedcxx . . $ FunctionArea_broadcastDataChanged(88b39197b202d92f). (me);
654 }
655 static void menu_cb_PasteBeforecxx . . $ menu_cb_PasteBefore(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
656 pastecxx . . $ paste(5125870f4b940eea). (me, 1);
657 }
658 static void menu_cb_PasteOvercxx . . $ menu_cb_PasteOver(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
659 pastecxx . . $ paste(5125870f4b940eea). (me, 2);
660 }
661 static void menu_cb_PasteAftercxx . . $ menu_cb_PasteAfter(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
662 pastecxx . . $ paste(5125870f4b940eea). (me, 3);
663 }
664 void structSoundAreacxx . . $ structSoundArea# :: v_createMenuItems_editcxx . . $ structSoundArea#v_createMenuItems_edit(6ea9c8c6ea2f58a9). (EditorMenucxx . . $ EditorMenu# menu) {
665 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"-- cut copy paste --", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this);
666 const bool weMayUseShortcuts = ! ourcxx . . $ `melder/melder.h:42:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).() -> textAreacxx . . $ structFunctionEditor#textArea.;
667 if (ourcxx . . $ `melder/melder.h:42:9`! editablecxx . . $ structDataGui#editable(50ce9a9e25b4a850).())
668 ourcxx . . $ `melder/melder.h:42:9`! cutButtoncxx . . $ structSoundArea#cutButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Cut", 'X' * weMayUseShortcuts,
669 menu_cb_Cutcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
670 ourcxx . . $ `melder/melder.h:42:9`! copyButtoncxx . . $ structSoundArea#copyButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Copy selection to Sound clipboard", 'C' * weMayUseShortcuts,
671 menu_cb_Copycxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
672 if (ourcxx . . $ `melder/melder.h:42:9`! editablecxx . . $ structDataGui#editable(50ce9a9e25b4a850).()) {
673 ourcxx . . $ `melder/melder.h:42:9`! pasteBeforeButtoncxx . . $ structSoundArea#pasteBeforeButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Paste before selection", 0,
674 menu_cb_PasteBeforecxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
675 ourcxx . . $ `melder/melder.h:42:9`! pasteOverButtoncxx . . $ structSoundArea#pasteOverButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Paste over selection", (GuiMenu_COMMAND_EXTRAcxx . . $ `sys/Gui.h:816:10`! | 'V') * weMayUseShortcuts,
676 menu_cb_PasteOvercxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
677 ourcxx . . $ `melder/melder.h:42:9`! pasteAfterButtoncxx . . $ structSoundArea#pasteAfterButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Paste after selection", 'V' * weMayUseShortcuts,
678 menu_cb_PasteAftercxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
679 }
680 }
681
682
683 #pragma mark - SoundArea Modify
684
685 static void menu_cb_SetSelectionToZerocxx . . $ menu_cb_SetSelectionToZero(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
686 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! sound());
687 integercxx . . $ integer# first, last;
688 Sampled_getWindowSamplescxx . . $ Sampled_getWindowSamples(fe99094ed5bb3f6a). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), & first, & last);
689 FunctionArea_savecxx . . $ FunctionArea_save(7511dfaa04acd353). (me, U"Set to zero");
690 mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> zcxx . . $ structMatrix#z..verticalBandcxx . . $ automatrix#verticalBand(244fa7aab97a21b1). (first, last) <<=cxx . . $ `operator<<=`(50b469ae42a42f64). 0.0;
691 FunctionArea_broadcastDataChangedcxx . . $ FunctionArea_broadcastDataChanged(88b39197b202d92f). (me);
692 }
693 static void menu_cb_ReverseSelectioncxx . . $ menu_cb_ReverseSelection(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
694 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! sound());
695 FunctionArea_savecxx . . $ FunctionArea_save(7511dfaa04acd353). (me, U"Reverse selection");
696 Sound_reversecxx . . $ Sound_reverse(77a4df2843109656). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).());
697 FunctionArea_broadcastDataChangedcxx . . $ FunctionArea_broadcastDataChanged(88b39197b202d92f). (me);
698 }
699
700
701 #pragma mark - SoundArea Settings
702
703 static void menu_cb_soundMuteChannelscxx . . $ menu_cb_soundMuteChannels(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
704 EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Mute channels", nullptr)
705 NATURAL1VECTORcxx . . $ `sys/EditorM.h:350:9`! (channels, U"Channels to mute", WHITESPACE_SEPARATED_, U"2")
706 EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`!
707 EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`!
708 const integercxx . . $ integer# numberOfChannels = mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).() -> nycxx . . $ structSampledXY#ny.;
709 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! muteChannels.size == numberOfChannels);
710 for (integercxx . . $ integer# ichan = 1; ichan <= numberOfChannels; ichan ++)
711 mycxx . . $ `melder/melder.h:44:9`! muteChannelscxx . . $ structSoundArea#muteChannels. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ichan] = false;
712 for (integercxx . . $ integer# ichan = 1; ichan <= channels.sizecxx . . $ constvector#size.; ichan ++)
713 if (channels [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).ichan] >= 1 && channels [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).ichan] <= numberOfChannels)
714 mycxx . . $ `melder/melder.h:44:9`! muteChannelscxx . . $ structSoundArea#muteChannels. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).channels [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).ichan]] = true;
715 FunctionEditor_redrawcxx . . $ FunctionEditor_redraw(8d3b84f45830d365). (mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).());
716 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
717 }
718
719
720 #pragma mark - SoundArea Query
721
722 static void INFO_DATA__SoundInfocxx . . $ INFO_DATA__SoundInfo(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
723 INFO_DATAcxx . . $ `sys/EditorM.h:544:9`!
724 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (me);
725 if (! Thing_isacxx . . $ Thing_isa(8cbb12e93d03b2a1). (me, classSoundAreacxx . . $ classSoundArea.))
726 Melder_crashcxx . . $ `melder/melder_error.h:98:9`! (U"Expected a SoundArea but found a ", Thing_className (me));
727 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! data());
728 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! function());
729 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! soundOrLongSound());
730 if (! Thing_isacxx . . $ Thing_isa(8cbb12e93d03b2a1). (mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).(), classSampledXYcxx . . $ classSampledXY.))
731 Melder_crashcxx . . $ `melder/melder_error.h:98:9`! (U"Expected a SoundArea but found a ", Thing_className (mycxx . . $ `melder/melder.h:44:9`! soundOrLongSound()));
732 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! sound());
733 Thing_infocxx . . $ Thing_info(97cddd01752945f6). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).());
734 INFO_DATA_ENDcxx . . $ `sys/EditorM.h:546:9`!
735 }
736 static void INFO_DATA__LongSoundInfocxx . . $ INFO_DATA__LongSoundInfo(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
737 INFO_DATAcxx . . $ `sys/EditorM.h:544:9`!
738 Thing_infocxx . . $ Thing_info(97cddd01752945f6). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).());
739 INFO_DATA_ENDcxx . . $ `sys/EditorM.h:546:9`!
740 }
741 enumcxx . . $ $anonymous_type_a9a430244353b3cc_0# {
742 SoundArea_PART_CURSORcxx . . $ SoundArea_PART_CURSOR. = 1,
743 SoundArea_PART_SELECTIONcxx . . $ SoundArea_PART_SELECTION. = 2
744 };
745 static int makeQueriablecxx . . $ makeQueriable(213d586096169494). (SoundAreacxx . . $ SoundArea# me, bool allowCursor, double *tmin, double *tmax) {
746 if (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() == mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()) {
747 if (allowCursor) {
748 *tmin = *tmax = mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).();
749 return SoundArea_PART_CURSORcxx . . $ SoundArea_PART_CURSOR.;
750 } else {
751 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Make a selection first.");
752 }
753 } else if (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() < mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).() || mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).() > mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).()) {
754 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Command ambiguous: a part of the selection (", mycxx . . $ `melder/melder.h:44:9`! startSelection(), U", ", mycxx . . $ `melder/melder.h:44:9`! endSelection(), U") "
755 U"is outside of the window (", mycxx . . $ `melder/melder.h:44:9`! startWindow(), U", ", mycxx . . $ `melder/melder.h:44:9`! endWindow(), U"). "
756 U"Either zoom or re-select.");
757 }
758 *tmin = mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).();
759 *tmax = mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).();
760 return SoundArea_PART_SELECTIONcxx . . $ SoundArea_PART_SELECTION.;
761 }
762 static void INFO_DATA__getAmplitudescxx . . $ INFO_DATA__getAmplitudes(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
763 INFO_DATAcxx . . $ `sys/EditorM.h:544:9`!
764 double tmin, tmax;
765 const int part = makeQueriablecxx . . $ makeQueriable(213d586096169494). (me, true, & tmin, & tmax);
766 if (! mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).())
767 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"No Sound object is visible (a LongSound cannot be queried).");
768 MelderInfo_opencxx . . $ MelderInfo_open(49f6e7a06ebc5aa8). ();
769 if (part == SoundArea_PART_CURSORcxx . . $ SoundArea_PART_CURSOR.)
770 for (integercxx . . $ integer# ichan = 1; ichan <= mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nycxx . . $ structSampledXY#ny.; ichan ++)
771 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (Vector_getValueAtXcxx . . $ Vector_getValueAtX(1bfdbe9f8adea74f). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() + mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()), ichan, kVector_valueInterpolationcxx . . $ kVector_valueInterpolation# :: SINC70cxx . . $ kVector_valueInterpolation#SINC70.),
772 U" (interpolated amplitude at CURSOR in channel ", ichan, U")");
773 else
774 for (integercxx . . $ integer# ichan = 1; ichan <= mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nycxx . . $ structSampledXY#ny.; ichan ++)
775 MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (Sampled_getMeancxx . . $ Sampled_getMean(2a8b0d40a92e6734). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), ichan, 0, true),
776 U" (mean amplitude in SELECTION in channel ", ichan, U")");
777 MelderInfo_closecxx . . $ MelderInfo_close(49f6e7a06ebc5aa8). ();
778 INFO_DATA_ENDcxx . . $ `sys/EditorM.h:546:9`!
779 }
780
781
782 #pragma mark - SoundArea View vertical
783
784 static void menu_cb_soundScalingcxx . . $ menu_cb_soundScaling(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
785 EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Sound scaling", nullptr)
786 OPTIONMENU_ENUMcxx . . $ `sys/EditorM.h:426:9`! (kSoundArea_scalingStrategy, scalingStrategy,
787 U"Scaling strategy", mycxx . . $ `melder/melder.h:44:9`! default_scalingStrategy())
788 COMMENTcxx . . $ `sys/EditorM.h:237:9`! (U"For \"fixed height\":")
789 POSITIVEcxx . . $ `sys/EditorM.h:117:9`! (height, U"Height", mycxx . . $ `melder/melder.h:44:9`! default_scaling_height())
790 COMMENTcxx . . $ `sys/EditorM.h:237:9`! (U"For \"fixed range\":")
791 REALcxx . . $ `sys/EditorM.h:95:9`! (minimum, U"Minimum", mycxx . . $ `melder/melder.h:44:9`! default_scaling_minimum())
792 REALcxx . . $ `sys/EditorM.h:95:9`! (maximum, U"Maximum", mycxx . . $ `melder/melder.h:44:9`! default_scaling_maximum())
793 EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`!
794 SET_ENUMcxx . . $ `sys/EditorM.h:480:9`! (scalingStrategy, kSoundArea_scalingStrategy, mycxx . . $ `melder/melder.h:44:9`! instancePref_scalingStrategy())
795 SET_REALcxx . . $ `sys/EditorM.h:462:9`! (height, mycxx . . $ `melder/melder.h:44:9`! instancePref_scaling_height())
796 SET_REALcxx . . $ `sys/EditorM.h:462:9`! (minimum, mycxx . . $ `melder/melder.h:44:9`! instancePref_scaling_minimum())
797 SET_REALcxx . . $ `sys/EditorM.h:462:9`! (maximum, mycxx . . $ `melder/melder.h:44:9`! instancePref_scaling_maximum())
798 EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`!
799 mycxx . . $ `melder/melder.h:44:9`! setInstancePref_scalingStrategycxx . . $ structSoundArea#setInstancePref_scalingStrategy(785ffe11dcb0432f). (scalingStrategy) ;
800 mycxx . . $ `melder/melder.h:44:9`! setInstancePref_scaling_heightcxx . . $ structSoundArea#setInstancePref_scaling_height(ba8836b59fb42830). (height);
801 mycxx . . $ `melder/melder.h:44:9`! setInstancePref_scaling_minimumcxx . . $ structSoundArea#setInstancePref_scaling_minimum(ba8836b59fb42830). (minimum);
802 mycxx . . $ `melder/melder.h:44:9`! setInstancePref_scaling_maximumcxx . . $ structSoundArea#setInstancePref_scaling_maximum(ba8836b59fb42830). (maximum);
803 FunctionEditor_redrawcxx . . $ FunctionEditor_redraw(8d3b84f45830d365). (mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).());
804 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
805 }
806
807
808 #pragma mark - SoundArea Select
809
810 static void menu_cb_MoveStartOfSelectionToNearestZeroCrossingcxx . . $ menu_cb_MoveStartOfSelectionToNearestZeroCrossing(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
811 const double zero = Sound_getNearestZeroCrossingcxx . . $ Sound_getNearestZeroCrossing(f92830f351830df8). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), 1); // STEREO BUG
812 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (zero)) {
813 mycxx . . $ `melder/melder.h:44:9`! setSelectioncxx . . $ structFunctionArea#setSelection(bc12c9ec15586e6a). (zero, mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).());
814 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (isdefined (mycxx . . $ `melder/melder.h:44:9`! startSelection())); // precondition of FunctionEditor_selectionMarksChanged()
815 FunctionEditor_selectionMarksChangedcxx . . $ FunctionEditor_selectionMarksChanged(8d3b84f45830d365). (mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).());
816 }
817 }
818 static void menu_cb_MoveCursorToNearestZeroCrossingcxx . . $ menu_cb_MoveCursorToNearestZeroCrossing(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
819 const double zero = Sound_getNearestZeroCrossingcxx . . $ Sound_getNearestZeroCrossing(f92830f351830df8). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), 0.5 * (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).() + mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).()), 1); // STEREO BUG
820 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (zero)) {
821 mycxx . . $ `melder/melder.h:44:9`! setSelectioncxx . . $ structFunctionArea#setSelection(bc12c9ec15586e6a). (zero, zero);
822 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (isdefined (mycxx . . $ `melder/melder.h:44:9`! startSelection())); // precondition of FunctionEditor_selectionMarksChanged()
823 FunctionEditor_selectionMarksChangedcxx . . $ FunctionEditor_selectionMarksChanged(8d3b84f45830d365). (mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).());
824 }
825 }
826 static void menu_cb_MoveEndOfSelectionToNearestZeroCrossingcxx . . $ menu_cb_MoveEndOfSelectionToNearestZeroCrossing(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
827 const double zero = Sound_getNearestZeroCrossingcxx . . $ Sound_getNearestZeroCrossing(f92830f351830df8). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), 1); // STEREO BUG
828 if (isdefinedcxx . . $ isdefined(f8197d536af80c96). (zero)) {
829 mycxx . . $ `melder/melder.h:44:9`! setSelectioncxx . . $ structFunctionArea#setSelection(bc12c9ec15586e6a). (mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), zero);
830 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (isdefined (mycxx . . $ `melder/melder.h:44:9`! startSelection())); // precondition of FunctionEditor_selectionMarksChanged()
831 FunctionEditor_selectionMarksChangedcxx . . $ FunctionEditor_selectionMarksChanged(8d3b84f45830d365). (mycxx . . $ `melder/melder.h:44:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).());
832 }
833 }
834
835
836 #pragma mark - SoundArea Draw
837
838 static void menu_cb_DrawVisibleSoundcxx . . $ menu_cb_DrawVisibleSound(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
839 EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Draw visible sound", nullptr)
840 mycxx . . $ `melder/melder.h:44:9`! v_form_pictureWindowcxx . . $ structDataGui#v_form_pictureWindow(2b98fae8e13abb61). (cmd);
841 COMMENTcxx . . $ `sys/EditorM.h:237:9`! (U"Sound:")
842 BOOLEANcxx . . $ `sys/EditorM.h:228:9`! (preserveTimes, U"Preserve times", mycxx . . $ `melder/melder.h:44:9`! default_picture_preserveTimes());
843 REALcxx . . $ `sys/EditorM.h:95:9`! (bottom, U"left Vertical range", mycxx . . $ `melder/melder.h:44:9`! default_picture_bottom())
844 REALcxx . . $ `sys/EditorM.h:95:9`! (top, U"right Vertical range", mycxx . . $ `melder/melder.h:44:9`! default_picture_top())
845 mycxx . . $ `melder/melder.h:44:9`! v_form_pictureMarginscxx . . $ structDataGui#v_form_pictureMargins(2b98fae8e13abb61). (cmd);
846 mycxx . . $ `melder/melder.h:44:9`! v_form_pictureSelectioncxx . . $ structFunctionArea#v_form_pictureSelection(2b98fae8e13abb61). (cmd);
847 BOOLEANcxx . . $ `sys/EditorM.h:228:9`! (garnish, U"Garnish", mycxx . . $ `melder/melder.h:44:9`! default_picture_garnish());
848 EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`!
849 mycxx . . $ `melder/melder.h:44:9`! v_ok_pictureWindowcxx . . $ structDataGui#v_ok_pictureWindow(2b98fae8e13abb61). (cmd);
850 SET_BOOLEANcxx . . $ `sys/EditorM.h:471:9`! (preserveTimes, mycxx . . $ `melder/melder.h:44:9`! classPref_picture_preserveTimes())
851 SET_REALcxx . . $ `sys/EditorM.h:462:9`! (bottom, mycxx . . $ `melder/melder.h:44:9`! classPref_picture_bottom())
852 SET_REALcxx . . $ `sys/EditorM.h:462:9`! (top, mycxx . . $ `melder/melder.h:44:9`! classPref_picture_top())
853 mycxx . . $ `melder/melder.h:44:9`! v_ok_pictureMarginscxx . . $ structDataGui#v_ok_pictureMargins(2b98fae8e13abb61). (cmd);
854 mycxx . . $ `melder/melder.h:44:9`! v_ok_pictureSelectioncxx . . $ structFunctionArea#v_ok_pictureSelection(2b98fae8e13abb61). (cmd);
855 SET_BOOLEANcxx . . $ `sys/EditorM.h:471:9`! (garnish, mycxx . . $ `melder/melder.h:44:9`! classPref_picture_garnish())
856 EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`!
857 mycxx . . $ `melder/melder.h:44:9`! v_do_pictureWindowcxx . . $ structDataGui#v_do_pictureWindow(2b98fae8e13abb61). (cmd);
858 mycxx . . $ `melder/melder.h:44:9`! setClassPref_picture_preserveTimescxx . . $ structSoundArea#setClassPref_picture_preserveTimes(b45ddcbc8423892c). (preserveTimes);
859 mycxx . . $ `melder/melder.h:44:9`! setClassPref_picture_bottomcxx . . $ structSoundArea#setClassPref_picture_bottom(ba8836b59fb42830). (bottom);
860 mycxx . . $ `melder/melder.h:44:9`! setClassPref_picture_topcxx . . $ structSoundArea#setClassPref_picture_top(ba8836b59fb42830). (top);
861 mycxx . . $ `melder/melder.h:44:9`! v_do_pictureMarginscxx . . $ structDataGui#v_do_pictureMargins(2b98fae8e13abb61). (cmd);
862 mycxx . . $ `melder/melder.h:44:9`! v_do_pictureSelectioncxx . . $ structFunctionArea#v_do_pictureSelection(2b98fae8e13abb61). (cmd);
863 mycxx . . $ `melder/melder.h:44:9`! setClassPref_picture_garnishcxx . . $ structFunctionArea#setClassPref_picture_garnish(b45ddcbc8423892c). (garnish);
864 if (! mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).())
865 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"There is no sound to draw.");
866 autoSoundcxx . . $ autoSound# publish = mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).() ?
867 LongSound_extractPartcxx . . $ LongSound_extractPart(8c068bc499307d4e). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), preserveTimes) :
868 Sound_extractPartcxx . . $ Sound_extractPart(e1651eb055dd2f09). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), mycxx . . $ `melder/melder.h:44:9`! startWindowcxx . . $ structFunctionArea#startWindow(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endWindowcxx . . $ structFunctionArea#endWindow(21b6c25e127938e2).(), kSound_windowShapecxx . . $ kSound_windowShape#::RECTANGULARcxx . . $ kSound_windowShape#RECTANGULAR., 1.0, preserveTimes
869 );
870 DataGui_openPraatPicturecxx . . $ DataGui_openPraatPicture(4c5cf9f1c6ae526). (me);
871 Sound_drawcxx . . $ Sound_draw(9ce2a9dfe752ed09). (publish.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! pictureGraphicscxx . . $ structDataGui#pictureGraphics(5af6864da672d398).(), 0.0, 0.0, bottom, top, garnish, U"Curve");
872 FunctionArea_garnishPicturecxx . . $ FunctionArea_garnishPicture(88b39197b202d92f). (me);
873 DataGui_closePraatPicturecxx . . $ DataGui_closePraatPicture(4c5cf9f1c6ae526). (me);
874 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
875 }
876 static void menu_cb_DrawSelectedSoundcxx . . $ menu_cb_DrawSelectedSound(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
877 EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Draw selected sound", nullptr)
878 mycxx . . $ `melder/melder.h:44:9`! v_form_pictureWindowcxx . . $ structDataGui#v_form_pictureWindow(2b98fae8e13abb61). (cmd);
879 COMMENTcxx . . $ `sys/EditorM.h:237:9`! (U"Sound:")
880 BOOLEANcxx . . $ `sys/EditorM.h:228:9`! (preserveTimes, U"Preserve times", mycxx . . $ `melder/melder.h:44:9`! default_picture_preserveTimes());
881 REALcxx . . $ `sys/EditorM.h:95:9`! (bottom, U"left Vertical range", mycxx . . $ `melder/melder.h:44:9`! default_picture_bottom());
882 REALcxx . . $ `sys/EditorM.h:95:9`! (top, U"right Vertical range", mycxx . . $ `melder/melder.h:44:9`! default_picture_top());
883 mycxx . . $ `melder/melder.h:44:9`! v_form_pictureMarginscxx . . $ structDataGui#v_form_pictureMargins(2b98fae8e13abb61). (cmd);
884 BOOLEANcxx . . $ `sys/EditorM.h:228:9`! (garnish, U"Garnish", mycxx . . $ `melder/melder.h:44:9`! default_picture_garnish());
885 EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`!
886 mycxx . . $ `melder/melder.h:44:9`! v_ok_pictureWindowcxx . . $ structDataGui#v_ok_pictureWindow(2b98fae8e13abb61). (cmd);
887 SET_BOOLEANcxx . . $ `sys/EditorM.h:471:9`! (preserveTimes, mycxx . . $ `melder/melder.h:44:9`! classPref_picture_preserveTimes());
888 SET_REALcxx . . $ `sys/EditorM.h:462:9`! (bottom, mycxx . . $ `melder/melder.h:44:9`! classPref_picture_bottom());
889 SET_REALcxx . . $ `sys/EditorM.h:462:9`! (top, mycxx . . $ `melder/melder.h:44:9`! classPref_picture_top());
890 mycxx . . $ `melder/melder.h:44:9`! v_ok_pictureMarginscxx . . $ structDataGui#v_ok_pictureMargins(2b98fae8e13abb61). (cmd);
891 SET_BOOLEANcxx . . $ `sys/EditorM.h:471:9`! (garnish, mycxx . . $ `melder/melder.h:44:9`! classPref_picture_garnish());
892 EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`!
893 mycxx . . $ `melder/melder.h:44:9`! v_do_pictureWindowcxx . . $ structDataGui#v_do_pictureWindow(2b98fae8e13abb61). (cmd);
894 mycxx . . $ `melder/melder.h:44:9`! setClassPref_picture_preserveTimescxx . . $ structSoundArea#setClassPref_picture_preserveTimes(b45ddcbc8423892c). (preserveTimes);
895 mycxx . . $ `melder/melder.h:44:9`! setClassPref_picture_bottomcxx . . $ structSoundArea#setClassPref_picture_bottom(ba8836b59fb42830). (bottom);
896 mycxx . . $ `melder/melder.h:44:9`! setClassPref_picture_topcxx . . $ structSoundArea#setClassPref_picture_top(ba8836b59fb42830). (top);
897 mycxx . . $ `melder/melder.h:44:9`! v_do_pictureMarginscxx . . $ structDataGui#v_do_pictureMargins(2b98fae8e13abb61). (cmd);
898 mycxx . . $ `melder/melder.h:44:9`! setClassPref_picture_garnishcxx . . $ structFunctionArea#setClassPref_picture_garnish(b45ddcbc8423892c). (garnish);
899 if (! mycxx . . $ `melder/melder.h:44:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).())
900 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"There is no sound to draw.");
901 autoSoundcxx . . $ autoSound# publish = mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).() ?
902 LongSound_extractPartcxx . . $ LongSound_extractPart(8c068bc499307d4e). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), preserveTimes) :
903 Sound_extractPartcxx . . $ Sound_extractPart(e1651eb055dd2f09). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(),
904 kSound_windowShapecxx . . $ kSound_windowShape#::RECTANGULARcxx . . $ kSound_windowShape#RECTANGULAR., 1.0, preserveTimes
905 );
906 DataGui_openPraatPicturecxx . . $ DataGui_openPraatPicture(4c5cf9f1c6ae526). (me);
907 Sound_drawcxx . . $ Sound_draw(9ce2a9dfe752ed09). (publish.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! pictureGraphicscxx . . $ structDataGui#pictureGraphics(5af6864da672d398).(), 0.0, 0.0, bottom, top, garnish, U"Curve");
908 DataGui_closePraatPicturecxx . . $ DataGui_closePraatPicture(4c5cf9f1c6ae526). (me);
909 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
910 }
911
912
913 #pragma mark - SoundArea Extract
914
915 static autoSoundcxx . . $ autoSound# do_ExtractSelectedSoundcxx . . $ do_ExtractSelectedSound(592ce6b447757ae8). (SoundAreacxx . . $ SoundArea# me, bool preserveTimes) {
916 if (mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).() <= mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).())
917 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"No selection.");
918 if (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).())
919 return LongSound_extractPartcxx . . $ LongSound_extractPart(8c068bc499307d4e). (mycxx . . $ `melder/melder.h:44:9`! longSoundcxx . . $ structSoundArea#longSound(6208252a0c36139e).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), preserveTimes);
920 else if (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).())
921 return Sound_extractPartcxx . . $ Sound_extractPart(e1651eb055dd2f09). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(),
922 kSound_windowShapecxx . . $ kSound_windowShape#::RECTANGULARcxx . . $ kSound_windowShape#RECTANGULAR., 1.0, preserveTimes);
923 Melder_crashcxx . . $ `melder/melder_error.h:98:9`! (U"No Sound or LongSound available.");
924 return autoSoundcxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).(); // never reached
925 }
926 static void CONVERT_DATA_TO_ONE__ExtractSelectedSound_timeFromZerocxx . . $ CONVERT_DATA_TO_ONE__ExtractSelectedSound_timeFromZero(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
927 CONVERT_DATA_TO_ONEcxx . . $ `sys/EditorM.h:616:9`!
928 autoSoundcxx . . $ autoSound# result = do_ExtractSelectedSoundcxx . . $ do_ExtractSelectedSound(592ce6b447757ae8). (me, false);
929 CONVERT_DATA_TO_ONE_ENDcxx . . $ `sys/EditorM.h:618:9`! (U"untitled")
930 }
931 static void CONVERT_DATA_TO_ONE__ExtractSelectedSound_preserveTimescxx . . $ CONVERT_DATA_TO_ONE__ExtractSelectedSound_preserveTimes(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
932 CONVERT_DATA_TO_ONEcxx . . $ `sys/EditorM.h:616:9`!
933 autoSoundcxx . . $ autoSound# result = do_ExtractSelectedSoundcxx . . $ do_ExtractSelectedSound(592ce6b447757ae8). (me, true);
934 CONVERT_DATA_TO_ONE_ENDcxx . . $ `sys/EditorM.h:618:9`! (U"untitled")
935 }
936 static void CONVERT_DATA_TO_ONE__ExtractSelectedSound_windowedcxx . . $ CONVERT_DATA_TO_ONE__ExtractSelectedSound_windowed(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
937 EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Extract selected sound (windowed)", U"Extract selected sound (windowed)...")
938 WORDcxx . . $ `sys/EditorM.h:184:9`! (name, U"Name", U"slice")
939 OPTIONMENU_ENUMcxx . . $ `sys/EditorM.h:426:9`! (kSound_windowShape, windowShape, U"Window shape", mycxx . . $ `melder/melder.h:44:9`! default_extract_windowShape())
940 POSITIVEcxx . . $ `sys/EditorM.h:117:9`! (relativeWidth, U"Relative width", mycxx . . $ `melder/melder.h:44:9`! default_extract_relativeWidth())
941 BOOLEANcxx . . $ `sys/EditorM.h:228:9`! (preserveTimes, U"Preserve times", mycxx . . $ `melder/melder.h:44:9`! default_extract_preserveTimes())
942 EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`!
943 SET_ENUMcxx . . $ `sys/EditorM.h:480:9`! (windowShape, kSound_windowShape, mycxx . . $ `melder/melder.h:44:9`! classPref_extract_windowShape())
944 SET_REALcxx . . $ `sys/EditorM.h:462:9`! (relativeWidth, mycxx . . $ `melder/melder.h:44:9`! classPref_extract_relativeWidth())
945 SET_BOOLEANcxx . . $ `sys/EditorM.h:471:9`! (preserveTimes, mycxx . . $ `melder/melder.h:44:9`! classPref_extract_preserveTimes())
946 EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`!
947 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! sound()); // no LongSound
948 CONVERT_DATA_TO_ONEcxx . . $ `sys/EditorM.h:616:9`!
949 mycxx . . $ `melder/melder.h:44:9`! setClassPref_extract_windowShapecxx . . $ structSoundArea#setClassPref_extract_windowShape(fd33545ed81ca56f). (windowShape);
950 mycxx . . $ `melder/melder.h:44:9`! setClassPref_extract_relativeWidthcxx . . $ structSoundArea#setClassPref_extract_relativeWidth(ba8836b59fb42830). (relativeWidth);
951 mycxx . . $ `melder/melder.h:44:9`! setClassPref_extract_preserveTimescxx . . $ structSoundArea#setClassPref_extract_preserveTimes(b45ddcbc8423892c). (preserveTimes);
952 autoSoundcxx . . $ autoSound# result = Sound_extractPartcxx . . $ Sound_extractPart(e1651eb055dd2f09). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(),
953 windowShape, relativeWidth, preserveTimes);
954 CONVERT_DATA_TO_ONE_ENDcxx . . $ `sys/EditorM.h:618:9`! (name)
955 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
956 }
957 static void CONVERT_DATA_TO_ONE__ExtractSelectedSoundForOverlapcxx . . $ CONVERT_DATA_TO_ONE__ExtractSelectedSoundForOverlap(3b27eb4313600723). (SoundAreacxx . . $ SoundArea# me, EDITOR_ARGScxx . . $ `sys/EditorM.h:25:9`!) {
958 EDITOR_FORMcxx . . $ `sys/EditorM.h:33:9`! (U"Extract selected sound for overlap)", nullptr)
959 WORDcxx . . $ `sys/EditorM.h:184:9`! (name, U"Name", U"slice")
960 POSITIVEcxx . . $ `sys/EditorM.h:117:9`! (overlap, U"Overlap (s)", mycxx . . $ `melder/melder.h:44:9`! default_extract_overlap())
961 EDITOR_OKcxx . . $ `sys/EditorM.h:38:9`!
962 SET_REALcxx . . $ `sys/EditorM.h:462:9`! (overlap, mycxx . . $ `melder/melder.h:44:9`! classPref_extract_overlap())
963 EDITOR_DOcxx . . $ `sys/EditorM.h:43:9`!
964 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! sound()); // no LongSound
965 CONVERT_DATA_TO_ONEcxx . . $ `sys/EditorM.h:616:9`!
966 mycxx . . $ `melder/melder.h:44:9`! setClassPref_extract_overlapcxx . . $ structSoundArea#setClassPref_extract_overlap(ba8836b59fb42830). (overlap);
967 autoSoundcxx . . $ autoSound# result = Sound_extractPartForOverlapcxx . . $ Sound_extractPartForOverlap(a9298ecf594d39cf). (mycxx . . $ `melder/melder.h:44:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).(), mycxx . . $ `melder/melder.h:44:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), mycxx . . $ `melder/melder.h:44:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), overlap);
968 CONVERT_DATA_TO_ONE_ENDcxx . . $ `sys/EditorM.h:618:9`! (name)
969 EDITOR_ENDcxx . . $ `sys/EditorM.h:80:9`!
970 }
971
972
973 #pragma mark - SoundArea menus
974
975 void structSoundAreacxx . . $ structSoundArea# :: v_createMenuscxx . . $ structSoundArea#v_createMenus(49f6e7a06ebc5aa8). () {
976 EditorMenucxx . . $ EditorMenu# menu = Editor_addMenucxx . . $ Editor_addMenu(8b39ac34ca8e016f). (ourcxx . . $ `melder/melder.h:42:9`! functionEditorcxx . . $ structFunctionArea#functionEditor(985d6162d6c279b).(), U"Sound", 0);
977
978 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Sound scaling...",
979 0, menu_cb_soundScalingcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
980 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Mute channels...",
981 0, menu_cb_soundMuteChannelscxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
982
983 if (ourcxx . . $ `melder/melder.h:42:9`! editablecxx . . $ structDataGui#editable(50ce9a9e25b4a850).()) {
984 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"- Modify sound:", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this);
985 ourcxx . . $ `melder/melder.h:42:9`! zeroButtoncxx . . $ structSoundArea#zeroButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Set selection to zero",
986 1, menu_cb_SetSelectionToZerocxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
987 ourcxx . . $ `melder/melder.h:42:9`! reverseButtoncxx . . $ structSoundArea#reverseButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Reverse selection",
988 'R' + GuiMenu_DEPTH_1cxx . . $ `sys/Gui.h:862:9`!, menu_cb_ReverseSelectioncxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
989 }
990
991 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"- Query sound:", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this);
992 if (Thing_isacxx . . $ Thing_isa(8cbb12e93d03b2a1). (this, classLongSoundAreacxx . . $ classLongSoundArea.))
993 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Info on whole LongSound || LongSound info",
994 1, INFO_DATA__LongSoundInfocxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
995 else
996 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Info on whole Sound || Sound info",
997 1, INFO_DATA__SoundInfocxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
998 if (! Thing_isacxx . . $ Thing_isa(8cbb12e93d03b2a1). (this, classLongSoundAreacxx . . $ classLongSoundArea.)) {
999 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Get amplitude(s)",
1000 1, INFO_DATA__getAmplitudescxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
1001 }
1002
1003 if (! Thing_isacxx . . $ Thing_isa(8cbb12e93d03b2a1). (this, classLongSoundAreacxx . . $ classLongSoundArea.)) {
1004 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"- Select by sound:", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this);
1005 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Move start of selection to nearest zero crossing || Move begin of selection to nearest zero crossing",
1006 ',' + GuiMenu_DEPTH_1cxx . . $ `sys/Gui.h:862:9`!, menu_cb_MoveStartOfSelectionToNearestZeroCrossingcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
1007 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Move cursor to nearest zero crossing",
1008 '0' + GuiMenu_DEPTH_1cxx . . $ `sys/Gui.h:862:9`!, menu_cb_MoveCursorToNearestZeroCrossingcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
1009 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Move end of selection to nearest zero crossing",
1010 '.' + GuiMenu_DEPTH_1cxx . . $ `sys/Gui.h:862:9`!, menu_cb_MoveEndOfSelectionToNearestZeroCrossingcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
1011 }
1012
1013 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"- Draw sound to picture window:", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this);
1014 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Draw visible sound...",
1015 1, menu_cb_DrawVisibleSoundcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
1016 ourcxx . . $ `melder/melder.h:42:9`! drawButtoncxx . . $ structSoundArea#drawButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"Draw selected sound...",
1017 1, menu_cb_DrawSelectedSoundcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this);
1018
1019 FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu, U"- Extract sound to objects window:", 0, nullptrcxx . . $ MelderCallback#MelderCallback(fc624d2cd197112)., this);
1020 ourcxx . . $ `melder/melder.h:42:9`! publishPreserveButtoncxx . . $ structSoundArea#publishPreserveButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
1021 U"Extract selected sound (preserve times) ||"
1022 " Extract sound selection (preserve times) ||"
1023 " Extract selection (preserve times)",
1024 1, CONVERT_DATA_TO_ONE__ExtractSelectedSound_preserveTimescxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
1025 );
1026 ourcxx . . $ `melder/melder.h:42:9`! publishButtoncxx . . $ structSoundArea#publishButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
1027 U"Extract selected sound (time from 0) ||"
1028 " Extract sound selection (time from 0) ||"
1029 " Extract selection (time from 0) ||"
1030 " Extract selection",
1031 1, CONVERT_DATA_TO_ONE__ExtractSelectedSound_timeFromZerocxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
1032 );
1033 if (! Thing_isacxx . . $ Thing_isa(8cbb12e93d03b2a1). (this, classLongSoundAreacxx . . $ classLongSoundArea.)) {
1034 ourcxx . . $ `melder/melder.h:42:9`! publishWindowButtoncxx . . $ structSoundArea#publishWindowButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
1035 U"Extract selected sound (windowed)... ||"
1036 " Extract windowed sound selection... ||"
1037 " Extract windowed selection...",
1038 1, CONVERT_DATA_TO_ONE__ExtractSelectedSound_windowedcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
1039 );
1040 ourcxx . . $ `melder/melder.h:42:9`! publishOverlapButtoncxx . . $ structSoundArea#publishOverlapButton. = FunctionAreaMenu_addCommandcxx . . $ FunctionAreaMenu_addCommand(e6bf179389aae652). (menu,
1041 U"Extract selected sound for overlap...",
1042 1, CONVERT_DATA_TO_ONE__ExtractSelectedSoundForOverlapcxx . . $ MelderCallback#MelderCallback(aaa169a015c1cf97)., this
1043 );
1044 }
1045 }
1046 void structSoundAreacxx . . $ structSoundArea# :: v_updateMenuItemscxx . . $ structSoundArea#v_updateMenuItems(49f6e7a06ebc5aa8). () {
1047 integercxx . . $ integer# first, last;
1048 const integercxx . . $ integer# selectedSamples = Sampled_getWindowSamplescxx . . $ Sampled_getWindowSamples(fe99094ed5bb3f6a). (ourcxx . . $ `melder/melder.h:42:9`! soundOrLongSoundcxx . . $ structSoundArea#soundOrLongSound(e416179ecdeca61e).(),
1049 ourcxx . . $ `melder/melder.h:42:9`! startSelectioncxx . . $ structFunctionArea#startSelection(21b6c25e127938e2).(), ourcxx . . $ `melder/melder.h:42:9`! endSelectioncxx . . $ structFunctionArea#endSelection(21b6c25e127938e2).(), & first, & last);
1050 if (ourcxx . . $ `melder/melder.h:42:9`! drawButtoncxx . . $ structSoundArea#drawButton.) {
1051 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! drawButtoncxx . . $ structSoundArea#drawButton., selectedSamples != 0);
1052 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! publishButtoncxx . . $ structSoundArea#publishButton., selectedSamples != 0);
1053 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! publishPreserveButtoncxx . . $ structSoundArea#publishPreserveButton., selectedSamples != 0);
1054 if (ourcxx . . $ `melder/melder.h:42:9`! publishWindowButtoncxx . . $ structSoundArea#publishWindowButton.)
1055 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! publishWindowButtoncxx . . $ structSoundArea#publishWindowButton., selectedSamples != 0);
1056 if (ourcxx . . $ `melder/melder.h:42:9`! publishOverlapButtoncxx . . $ structSoundArea#publishOverlapButton.)
1057 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! publishOverlapButtoncxx . . $ structSoundArea#publishOverlapButton., selectedSamples != 0);
1058 }
1059 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! writeWavButtoncxx . . $ structSoundArea#writeWavButton., selectedSamples != 0);
1060 if (ourcxx . . $ `melder/melder.h:42:9`! saveAs24BitWavButtoncxx . . $ structSoundArea#saveAs24BitWavButton.)
1061 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! saveAs24BitWavButtoncxx . . $ structSoundArea#saveAs24BitWavButton., selectedSamples != 0);
1062 if (ourcxx . . $ `melder/melder.h:42:9`! saveAs32BitWavButtoncxx . . $ structSoundArea#saveAs32BitWavButton.)
1063 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! saveAs32BitWavButtoncxx . . $ structSoundArea#saveAs32BitWavButton., selectedSamples != 0);
1064 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! writeAiffButtoncxx . . $ structSoundArea#writeAiffButton., selectedSamples != 0);
1065 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! writeAifcButtoncxx . . $ structSoundArea#writeAifcButton., selectedSamples != 0);
1066 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! writeNextSunButtoncxx . . $ structSoundArea#writeNextSunButton., selectedSamples != 0);
1067 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! writeNistButtoncxx . . $ structSoundArea#writeNistButton., selectedSamples != 0);
1068 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! writeFlacButtoncxx . . $ structSoundArea#writeFlacButton., selectedSamples != 0);
1069
1070 if (ourcxx . . $ `melder/melder.h:42:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).()) {
1071 if (ourcxx . . $ `melder/melder.h:42:9`! editablecxx . . $ structDataGui#editable(50ce9a9e25b4a850).())
1072 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! cutButtoncxx . . $ structSoundArea#cutButton., selectedSamples != 0 && selectedSamples < ourcxx . . $ `melder/melder.h:42:9`! soundcxx . . $ structSoundArea#sound(f0b31236b65da120).() -> nxcxx . . $ structSampled#nx.);
1073 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! copyButtoncxx . . $ structSoundArea#copyButton., selectedSamples != 0);
1074 if (ourcxx . . $ `melder/melder.h:42:9`! editablecxx . . $ structDataGui#editable(50ce9a9e25b4a850).()) {
1075 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! zeroButtoncxx . . $ structSoundArea#zeroButton., selectedSamples != 0);
1076 GuiThing_setSensitivecxx . . $ GuiThing_setSensitive(99178548e0926398). (ourcxx . . $ `melder/melder.h:42:9`! reverseButtoncxx . . $ structSoundArea#reverseButton., selectedSamples != 0);
1077 }
1078 }
1079 }
1080
1081 /* End of file SoundArea.cpp */