Debian Codegraph @

fon/praat_Matrix.cpp

raw
1 /* praat_Matrix.cpp
2 *
3 * Copyright (C) 1992-2005,2007,2011-2024,2026 Paul Boersma
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "Cochleagram.h"
20 #include "Excitation.h"
21 #include "Harmonicity.h"
22 #include "Intensity.h"
23 #include "Ltas.h"
24 #include "Matrix_and_PointProcess.h"
25 #include "Matrix_and_Polygon.h"
26 #include "Matrix_and_Pitch.h"
27 #include "MovieWindow.h"
28 #include "ParamCurve.h"
29 #include "Photo.h"
30 #include "RealTier.h"
31 #include "Spectrogram.h"
32 #include "Spectrum.h"
33 #include "Transition.h"
34 #include "VocalTract.h"
35
36 #include "praat_Matrix.h"
37
38 // MARK: - MATRIX
39
40 // MARK: New
41
42 FORM (NEW1_Matrix_create, U"Create Matrix", U"Create Matrix...") {
43 WORD (name, U"Name", U"xy")
44 REAL (xmin, U"xmin", U"1.0")
45 REAL (xmax, U"xmax", U"1.0")
46 NATURAL (numberOfColumns, U"Number of columns", U"1")
47 POSITIVE (dx, U"dx", U"1.0")
48 REAL (x1, U"x1", U"1.0")
49 REAL (ymin, U"ymin", U"1.0")
50 REAL (ymax, U"ymax", U"1.0")
51 NATURAL (numberOfRows, U"Number of rows", U"1")
52 POSITIVE (dy, U"dy", U"1.0")
53 REAL (y1, U"y1", U"1.0")
54 FORMULA (formula, U"Formula", U"x*y")
55 OK
56 DO
57 if (xmax < xmin) Melder_throw (U"Your xmax (", Melder_single (xmax), U") should not be less than your xmin (", Melder_single (xmin), U").");
58 if (ymax < ymin) Melder_throw (U"Your ymax (", Melder_single (ymax), U") should not be less than your ymin (", Melder_single (ymin), U").");
59 CREATE_ONE
60 autoMatrix result = Matrix_create (
61 xmin, xmax, numberOfColumns, dx, x1,
62 ymin, ymax, numberOfRows, dy, y1);
63 Matrix_formula (result.get(), formula, interpreter, nullptr);
64 CREATE_ONE_END (name)
65 }
66
67 FORM (NEW1_Matrix_createSimple, U"Create simple Matrix", U"Create simple Matrix...") {
68 WORD (name, U"Name", U"xy")
69 NATURAL (numberOfRows, U"Number of rows", U"10")
70 NATURAL (numberOfColumns, U"Number of columns", U"10")
71 FORMULA (formula, U"Formula", U"x*y")
72 OK
73 DO
74 CREATE_ONE
75 autoMatrix result = Matrix_createSimple (numberOfRows, numberOfColumns);
76 Matrix_formula (result.get(), formula, interpreter, nullptr);
77 CREATE_ONE_END (name);
78 }
79
80 FORM (NEW1_Matrix_createSimpleFromValues, U"Create simple Matrix from values", U"Create simple Matrix from values...") {
81 WORD (name, U"Name", U"xy")
82 REALMATRIX (values, U"Values", autoMAT ({ { 10, 20, 30, 40 }, { 60, 70, 80, 90 }, { 170, 180, 190, -300 } }))
83 OK
84 DO
85 CREATE_ONE
86 autoMatrix result = Matrix_createSimple (values.nrow, values.ncol);
87 result -> z.all() <<= values;
88 CREATE_ONE_END (name);
89 }
90
91 // MARK: Open
92
93 FORM_READ (READ_ONE__Matrix_readFromRawTextFile, U"Read Matrix from raw text file", nullptr, true) {
94 READ_ONE
95 autoMatrix result = Matrix_readFromRawTextFile (file);
96 READ_ONE_END
97 }
98
99 FORM_READ (READ_ONE__Matrix_readAP, U"Read Matrix from LVS AP file", nullptr, true) {
100 READ_ONE
101 autoMatrix result = Matrix_readAP (file);
102 READ_ONE_END
103 }
104
105 // MARK: Save
106
107 FORM_SAVE (SAVE_Matrix_writeToMatrixTextFile, U"Save Matrix as matrix text file", nullptr, U"mat") {
108 SAVE_ONE (Matrix, U"save the selected Matrix object to the matrix text file")
109 Matrix_writeToMatrixTextFile (me, file);
110 SAVE_ONE_END
111 }
112
113 FORM_SAVE (SAVE_Matrix_writeToHeaderlessSpreadsheetFile, U"Save Matrix as spreadsheet", nullptr, U"txt") {
114 SAVE_ONE (Matrix, U"save the selected Matrix object to the headerless spreadsheet file")
115 Matrix_writeToHeaderlessSpreadsheetFile (me, file);
116 SAVE_ONE_END
117 }
118
119 // MARK: Help
120
121 DIRECT (HELP_Matrix_help) {
122 HELP (U"Matrix")
123 }
124
125 // MARK: Movie
126
127 static autoGraphics theMovieGraphics;
128
129 static void gui_drawingarea_cb_expose (Thing /* boss */, GuiDrawingArea_ExposeEvent /* event */) {
130 if (! theMovieGraphics)
131 return;
132 Graphics_play (theMovieGraphics.get(), theMovieGraphics.get());
133 }
134
135 extern "C" Graphics Movie_create (conststring32 title, int width, int height) {
136 static GuiDialog dialog;
137 static GuiDrawingArea drawingArea;
138 if (! theMovieGraphics) {
139 dialog = GuiDialog_create (theCurrentPraatApplication -> topShell, 100, 100, width + 2, height + 2,
140 title, nullptr, nullptr, GuiDialog_Modality::MODELESS);
141 drawingArea = GuiDrawingArea_createShown (dialog, 0, width, 0, height,
142 gui_drawingarea_cb_expose, nullptr, nullptr, nullptr, nullptr, nullptr, 0);
143 GuiThing_show (dialog);
144 theMovieGraphics = Graphics_create_xmdrawingarea (drawingArea);
145 }
146 GuiShell_setTitle (dialog, title);
147 GuiControl_setSize (dialog, width + 2, height + 2);
148 GuiControl_setSize (drawingArea, width, height);
149 GuiThing_show (dialog);
150 return theMovieGraphics.get();
151 }
152
153 DIRECT (MOVIE_Matrix_playMovie) {
154 MOVIE_ONE (Matrix, U"Matrix movie", 300, 300)
155 Matrix_playMovie (me, graphics);
156 MOVIE_ONE_END
157 }
158
159 // MARK: Draw
160
161 FORM (GRAPHICS_Matrix_drawRows, U"Draw rows", nullptr) {
162 REAL (fromX, U"From x =", U"0.0")
163 REAL (toX, U"To x =", U"0.0")
164 REAL (fromY, U"From y =", U"0.0")
165 REAL (toY, U"To y =", U"0.0")
166 REAL (minimum, U"Minimum", U"0.0")
167 REAL (maximum, U"Maximum", U"0.0")
168 OK
169 DO
170 GRAPHICS_EACH (Matrix)
171 Matrix_drawRows (me, GRAPHICS, fromX, toX, fromY, toY, minimum, maximum);
172 GRAPHICS_EACH_END
173 }
174
175 FORM (GRAPHICS_Matrix_drawOneContour, U"Draw one altitude contour", nullptr) {
176 REAL (fromX, U"From x =", U"0.0")
177 REAL (toX, U"To x =", U"0.0")
178 REAL (fromY, U"From y =", U"0.0")
179 REAL (toY, U"To y =", U"0.0")
180 REAL (height, U"Height", U"0.5")
181 OK
182 DO
183 GRAPHICS_EACH (Matrix)
184 Matrix_drawOneContour (me, GRAPHICS,fromX, toX, fromY, toY, height);
185 GRAPHICS_EACH_END
186 }
187
188 FORM (GRAPHICS_Matrix_drawContours, U"Draw altitude contours", nullptr) {
189 REAL (fromX, U"From x =", U"0.0")
190 REAL (toX, U"To x =", U"0.0")
191 REAL (fromY, U"From y =", U"0.0")
192 REAL (toY, U"To y =", U"0.0")
193 REAL (minimum, U"Minimum", U"0.0")
194 REAL (maximum, U"Maximum", U"0.0")
195 OK
196 DO
197 GRAPHICS_EACH (Matrix)
198 Matrix_drawContours (me, GRAPHICS, fromX, toX, fromY, toY, minimum, maximum);
199 GRAPHICS_EACH_END
200 }
201
202 FORM (GRAPHICS_Matrix_paintImage, U"Matrix: Paint grey image", nullptr) {
203 REAL (fromX, U"From x =", U"0.0")
204 REAL (toX, U"To x =", U"0.0")
205 REAL (fromY, U"From y =", U"0.0")
206 REAL (toY, U"To y =", U"0.0")
207 REAL (minimum, U"Minimum", U"0.0")
208 REAL (maximum, U"Maximum", U"0.0")
209 OK
210 DO
211 GRAPHICS_EACH (Matrix)
212 Matrix_paintImage (me, GRAPHICS, fromX, toX, fromY, toY, minimum, maximum);
213 GRAPHICS_EACH_END
214 }
215
216 FORM (GRAPHICS_Matrix_paintContours, U"Matrix: Paint altitude contours with greys", nullptr) {
217 REAL (fromX, U"From x =", U"0.0")
218 REAL (toX, U"To x =", U"0.0")
219 REAL (fromY, U"From y =", U"0.0")
220 REAL (toY, U"To y =", U"0.0")
221 REAL (minimum, U"Minimum", U"0.0")
222 REAL (maximum, U"Maximum", U"0.0")
223 OK
224 DO
225 GRAPHICS_EACH (Matrix)
226 Matrix_paintContours (me, GRAPHICS, fromX, toX, fromY, toY, minimum, maximum);
227 GRAPHICS_EACH_END
228 }
229
230 FORM (GRAPHICS_Matrix_paintCells, U"Matrix: Paint cells with greys", U"Matrix: Paint cells...") {
231 REAL (fromX, U"From x =", U"0.0")
232 REAL (toX, U"To x =", U"0.0")
233 REAL (fromY, U"From y =", U"0.0")
234 REAL (toY, U"To y =", U"0.0")
235 REAL (minimum, U"Minimum", U"0.0")
236 REAL (maximum, U"Maximum", U"0.0")
237 OK
238 DO
239 GRAPHICS_EACH (Matrix)
240 Matrix_paintCells (me, GRAPHICS, fromX, toX, fromY, toY, minimum, maximum);
241 GRAPHICS_EACH_END
242 }
243
244 FORM (GRAPHICS_Matrix_paintSurface, U"Matrix: Paint 3-D surface plot", nullptr) {
245 REAL (fromX, U"From x =", U"0.0")
246 REAL (toX, U"To x =", U"0.0")
247 REAL (fromY, U"From y =", U"0.0")
248 REAL (toY, U"To y =", U"0.0")
249 REAL (minimum, U"Minimum", U"0.0")
250 REAL (maximum, U"Maximum", U"0.0")
251 OK
252 DO
253 GRAPHICS_EACH (Matrix)
254 Matrix_paintSurface (me, GRAPHICS, fromX, toX, fromY, toY, minimum, maximum, 30, 45);
255 GRAPHICS_EACH_END
256 }
257
258 // MARK: Query
259
260 DIRECT (REAL_Matrix_getLowestX) {
261 QUERY_ONE_FOR_REAL (Matrix)
262 const double result = my xmin;
263 QUERY_ONE_FOR_REAL_END (U" (xmin)")
264 }
265
266 DIRECT (REAL_Matrix_getHighestX) {
267 QUERY_ONE_FOR_REAL (Matrix)
268 const double result = my xmax;
269 QUERY_ONE_FOR_REAL_END (U" (xmax)")
270 }
271
272 DIRECT (REAL_Matrix_getLowestY) {
273 QUERY_ONE_FOR_REAL (Matrix)
274 const double result = my ymin;
275 QUERY_ONE_FOR_REAL_END (U" (ymin)")
276 }
277
278 DIRECT (REAL_Matrix_getHighestY) {
279 QUERY_ONE_FOR_REAL (Matrix)
280 const double result = my ymax;
281 QUERY_ONE_FOR_REAL_END (U" (ymax)")
282 }
283
284 DIRECT (INTEGER_Matrix_getNumberOfRows) {
285 QUERY_ONE_FOR_REAL (Matrix)
286 const integer result = my ny;
287 QUERY_ONE_FOR_REAL_END (U" rows")
288 }
289
290 DIRECT (INTEGER_Matrix_getNumberOfColumns) {
291 QUERY_ONE_FOR_REAL (Matrix)
292 const integer result = my nx;
293 QUERY_ONE_FOR_REAL_END (U" columns")
294 }
295
296 DIRECT (REAL_Matrix_getRowDistance) {
297 QUERY_ONE_FOR_REAL (Matrix)
298 const double result = my dy;
299 QUERY_ONE_FOR_REAL_END (U" (row distance)")
300 }
301
302 DIRECT (REAL_Matrix_getColumnDistance) {
303 QUERY_ONE_FOR_REAL (Matrix)
304 const double result = my dx;
305 QUERY_ONE_FOR_REAL_END (U" (column distance)")
306 }
307
308 FORM (REAL_Matrix_getYofRow, U"Matrix: Get y of row", nullptr) {
309 NATURAL (rowNumber, U"Row number", U"1")
310 OK
311 DO
312 QUERY_ONE_FOR_REAL (Matrix)
313 const double result = Matrix_rowToY (me, rowNumber);
314 QUERY_ONE_FOR_REAL_END (U" (y of row ", rowNumber, U")")
315 }
316
317 FORM (REAL_Matrix_getXofColumn, U"Matrix: Get x of column", nullptr) {
318 NATURAL (columnNumber, U"Column number", U"1")
319 OK
320 DO
321 QUERY_ONE_FOR_REAL (Matrix)
322 const double result = Matrix_columnToX (me, columnNumber);
323 QUERY_ONE_FOR_REAL_END (U" (x of column ", columnNumber, U")")
324 }
325
326 FORM (REAL_Matrix_getValueInCell, U"Matrix: Get value in cell", nullptr) {
327 NATURAL (rowNumber, U"Row number", U"1")
328 NATURAL (columnNumber, U"Column number", U"1")
329 OK
330 DO
331 QUERY_ONE_FOR_REAL (Matrix)
332 if (rowNumber > my ny)
333 Melder_throw (U"Row number should not exceed number of rows.");
334 if (columnNumber > my nx)
335 Melder_throw (U"Column number should not exceed number of columns.");
336 const double result = my z [rowNumber] [columnNumber];
337 QUERY_ONE_FOR_REAL_END (U" (value in column ", columnNumber, U" of row ", rowNumber, U")")
338 }
339
340 FORM (REAL_Matrix_getValueAtXY, U"Matrix: Get value at xy", nullptr) {
341 REAL (x, U"X", U"0.0")
342 REAL (y, U"Y", U"0.0")
343 OK
344 DO
345 QUERY_ONE_FOR_REAL (Matrix)
346 const double result = Matrix_getValueAtXY (me, x, y);
347 QUERY_ONE_FOR_REAL_END (U" (at x = ", x, U" and y = ", y, U")");
348 }
349
350 DIRECT (REAL_Matrix_getMinimum) {
351 QUERY_ONE_FOR_REAL (Matrix)
352 double minimum = undefined, maximum = undefined;
353 Matrix_getWindowExtrema (me, 0, 0, 0, 0, & minimum, & maximum);
354 const double result = minimum;
355 QUERY_ONE_FOR_REAL_END (U" (minimum)");
356 }
357
358 DIRECT (REAL_Matrix_getMaximum) {
359 QUERY_ONE_FOR_REAL (Matrix)
360 double minimum = undefined, maximum = undefined;
361 Matrix_getWindowExtrema (me, 0, 0, 0, 0, & minimum, & maximum);
362 const double result = maximum;
363 QUERY_ONE_FOR_REAL_END (U" (maximum)");
364 }
365
366 DIRECT (REAL_Matrix_getSum) {
367 QUERY_ONE_FOR_REAL (Matrix)
368 const double result = Matrix_getSum (me);
369 QUERY_ONE_FOR_REAL_END (U" (sum)");
370 }
371
372 DIRECT (NUMMAT_Matrix_getAllValues) {
373 QUERY_ONE_FOR_MATRIX (Matrix)
374 autoMAT result = copy_MAT (my z.all());
375 QUERY_ONE_FOR_MATRIX_END
376 }
377
378 FORM (NUMVEC_Matrix_getAllValuesInColumn, U"Get all values in column", nullptr) {
379 NATURAL (columnNumber, U"Column number", U"1")
380 OK
381 DO
382 QUERY_ONE_FOR_REAL_VECTOR (Matrix)
383 Melder_require (columnNumber <= my nx,
384 U"The column number (", columnNumber, U") should not be greater than the number of columns (", my nx, U").");
385 autoVEC result = copy_VEC (my z.column (columnNumber));
386 QUERY_ONE_FOR_REAL_VECTOR_END
387 }
388
389 FORM (NUMVEC_Matrix_getAllValuesInRow, U"Get all values in row", nullptr) {
390 NATURAL (rowNumber, U"Row number", U"1")
391 OK
392 DO
393 QUERY_ONE_FOR_REAL_VECTOR (Matrix)
394 Melder_require (rowNumber <= my ny,
395 U"The row number (", rowNumber, U") should not be greater than the number of rows (", my ny, U").");
396 autoVEC result = copy_VEC (my z.row (rowNumber));
397 QUERY_ONE_FOR_REAL_VECTOR_END
398 }
399
400 // MARK: Modify
401
402 FORM (MODIFY_Matrix_formula, U"Matrix Formula", U"Formula...") {
403 COMMENT (U"y := y1; for row := 1 to nrow do { x := x1; "
404 "for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
405 FORMULA (formula, U"Formula", U"self")
406 OK
407 DO
408 MODIFY_EACH_WEAK (Matrix)
409 Matrix_formula (me, formula, interpreter, nullptr);
410 MODIFY_EACH_WEAK_END
411 }
412
413 FORM (MODIFY_Matrix_setValue, U"Matrix: Set value", U"Matrix: Set value...") {
414 NATURAL (rowNumber, U"Row number", U"1")
415 NATURAL (columnNumber, U"Column number", U"1")
416 REAL (newValue, U"New value", U"0.0")
417 OK
418 DO
419 MODIFY_EACH (Matrix)
420 if (rowNumber > my ny)
421 Melder_throw (U"Your row number should not be greater than your number of rows.");
422 if (columnNumber > my nx)
423 Melder_throw (U"Your column number should not be greater than your number of columns.");
424 my z [rowNumber] [columnNumber] = newValue;
425 MODIFY_EACH_END
426 }
427
428 // MARK: Analyse
429
430 DIRECT (CONVERT_EACH_TO_MULTIPLE_Matrix_eigen) {
431 CONVERT_EACH_TO_MULTIPLE (Matrix)
432 autoMatrix vectors, values;
433 Matrix_eigen (me, & vectors, & values);
434 praat_new (vectors.move(), U"eigenvectors");
435 praat_new (values.move(), U"eigenvalues");
436 CONVERT_EACH_TO_MULTIPLE_END
437 }
438
439 // MARK: Synthesize
440
441 FORM (NEW_Matrix_power, U"Matrix: Power...", nullptr) {
442 NATURAL (power, U"Power", U"2")
443 OK
444 DO
445 CONVERT_EACH_TO_ONE (Matrix)
446 autoMatrix result = Matrix_power (me, power);
447 CONVERT_EACH_TO_ONE_END (my name.get())
448 }
449
450 // MARK: Combine
451
452 DIRECT (NEW1_Matrix_appendRows) {
453 CONVERT_TWO_TO_ONE (Matrix)
454 autoMatrix result = Matrix_appendRows (me, you, classMatrix);
455 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get())
456 }
457
458 // MARK: Cast
459
460 DIRECT (NEW_Matrix_to_Cochleagram) {
461 CONVERT_EACH_TO_ONE (Matrix)
462 autoCochleagram result = Matrix_to_Cochleagram (me);
463 CONVERT_EACH_TO_ONE_END (my name.get())
464 }
465
466 DIRECT (NEW_Matrix_to_Excitation) {
467 CONVERT_EACH_TO_ONE (Matrix)
468 autoExcitation result = Matrix_to_Excitation (me);
469 CONVERT_EACH_TO_ONE_END (my name.get())
470 }
471
472 DIRECT (NEW_Matrix_to_Harmonicity) {
473 CONVERT_EACH_TO_ONE (Matrix)
474 autoHarmonicity result = Matrix_to_Harmonicity (me);
475 CONVERT_EACH_TO_ONE_END (my name.get())
476 }
477
478 DIRECT (NEW_Matrix_to_Intensity) {
479 CONVERT_EACH_TO_ONE (Matrix)
480 autoIntensity result = Matrix_to_Intensity (me);
481 CONVERT_EACH_TO_ONE_END (my name.get())
482 }
483
484 DIRECT (NEW_Matrix_to_Ltas) {
485 CONVERT_EACH_TO_ONE (Matrix)
486 autoLtas result = Matrix_to_Ltas (me);
487 CONVERT_EACH_TO_ONE_END (my name.get())
488 }
489
490 DIRECT (NEW_Matrix_to_Pitch) {
491 CONVERT_EACH_TO_ONE (Matrix)
492 autoPitch result = Matrix_to_Pitch (me);
493 CONVERT_EACH_TO_ONE_END (my name.get())
494 }
495
496 DIRECT (NEW_Matrix_to_PointProcess) {
497 CONVERT_EACH_TO_ONE (Matrix)
498 autoPointProcess result = Matrix_to_PointProcess (me);
499 CONVERT_EACH_TO_ONE_END (my name.get())
500 }
501
502 DIRECT (NEW_Matrix_to_Polygon) {
503 CONVERT_EACH_TO_ONE (Matrix)
504 autoPolygon result = Matrix_to_Polygon (me);
505 CONVERT_EACH_TO_ONE_END (my name.get())
506 }
507
508 DIRECT (NEW_Matrix_to_Sound) {
509 CONVERT_EACH_TO_ONE (Matrix)
510 autoSound result = Matrix_to_Sound (me);
511 CONVERT_EACH_TO_ONE_END (my name.get())
512 }
513
514 FORM (NEW_Matrix_to_Sound_mono, U"Matrix: To Sound (mono)", 0) {
515 INTEGER (rowNumber, U"Row number", U"1")
516 COMMENT (U"(negative values count from last row)")
517 OK
518 DO
519 CONVERT_EACH_TO_ONE (Matrix)
520 autoSound result = Matrix_to_Sound_mono (me, rowNumber);
521 CONVERT_EACH_TO_ONE_END (my name.get())
522 }
523
524 DIRECT (NEW_Matrix_to_Spectrogram) {
525 CONVERT_EACH_TO_ONE (Matrix)
526 autoSpectrogram result = Matrix_to_Spectrogram (me);
527 CONVERT_EACH_TO_ONE_END (my name.get())
528 }
529
530 DIRECT (NEW_Matrix_to_Spectrum) {
531 CONVERT_EACH_TO_ONE (Matrix)
532 autoSpectrum result = Matrix_to_Spectrum (me);
533 CONVERT_EACH_TO_ONE_END (my name.get())
534 }
535
536 DIRECT (NEW_Matrix_to_TableOfReal) {
537 CONVERT_EACH_TO_ONE (Matrix)
538 autoTableOfReal result = Matrix_to_TableOfReal (me);
539 CONVERT_EACH_TO_ONE_END (my name.get())
540 }
541
542 DIRECT (NEW_Matrix_to_Transition) {
543 CONVERT_EACH_TO_ONE (Matrix)
544 autoTransition result = Matrix_to_Transition (me);
545 CONVERT_EACH_TO_ONE_END (my name.get())
546 }
547
548 DIRECT (NEW_Matrix_to_VocalTract) {
549 CONVERT_EACH_TO_ONE (Matrix)
550 autoVocalTract result = Matrix_to_VocalTract (me);
551 CONVERT_EACH_TO_ONE_END (my name.get())
552 }
553
554 DIRECT (NEW1_Matrix_to_ParamCurve) {
555 CONVERT_TWO_TO_ONE (Matrix)
556 autoSound sound1 = Matrix_to_Sound (me), sound2 = Matrix_to_Sound (you);
557 autoParamCurve result = ParamCurve_create (sound1.get(), sound2.get());
558 CONVERT_TWO_TO_ONE_END (my name.get(), U"_", your name.get());
559 }
560
561 FORM (CONVERT_EACH_TO_ONE__Matrix_to_RealTier, U"Matrix: To RealTier", nullptr) {
562 NATURAL (columnWithTimes, U"Column with times", U"1")
563 NATURAL (columnWithValues, U"Column with values", U"2")
564 REAL_OR_UNDEFINED (startTime, U"Start time (s)", U"0.0")
565 REAL_OR_UNDEFINED (endTime, U"End time (s)", U"undefined")
566 OK
567 DO
568 CONVERT_EACH_TO_ONE (Matrix)
569 autoRealTier result = Matrix_to_RealTier (me, columnWithTimes, columnWithValues, startTime, endTime);
570 CONVERT_EACH_TO_ONE_END (my name.get())
571 }
572
573 // MARK: - PHOTO
574
575 // MARK: New
576
577 FORM (NEW1_Photo_create, U"Create Photo", U"Create Photo...") {
578 WORD (name, U"Name", U"xy")
579 REAL (xmin, U"left xmin, xmax", U"1.0")
580 REAL (xmax, U"right xmin, xmax", U"1.0")
581 NATURAL (numberOfColumns, U"Number of columns", U"1")
582 POSITIVE (dx, U"dx", U"1.0")
583 REAL (x1, U"x1", U"1.0")
584 REAL (ymin, U"left ymin, ymax", U"1.0")
585 REAL (ymax, U"right ymin, ymax", U"1.0")
586 NATURAL (numberOfRows, U"Number of rows", U"1")
587 POSITIVE (dy, U"dy", U"1.0")
588 REAL (y1, U"y1", U"1.0")
589 FORMULA (redFormula, U"Red formula", U"x*y/100")
590 FORMULA (greenFormula, U"Green formula", U"x*y/1000")
591 FORMULA (blueFormula, U"Blue formula", U"x*y/100")
592 OK
593 DO
594 if (xmax < xmin)
595 Melder_throw (U"Your xmax (", Melder_single (xmax), U") should not be less than your xmin (", Melder_single (xmin), U").");
596 if (ymax < ymin)
597 Melder_throw (U"Your ymax (", Melder_single (ymax), U") should not be less than your ymin (", Melder_single (ymin), U").");
598 CREATE_ONE
599 autoPhoto result = Photo_create (
600 xmin, xmax, numberOfColumns, dx, x1,
601 ymin, ymax, numberOfRows, dy, y1);
602 Matrix_formula (result -> d_red .get(), redFormula, interpreter, nullptr);
603 Matrix_formula (result -> d_green.get(), greenFormula, interpreter, nullptr);
604 Matrix_formula (result -> d_blue .get(), blueFormula, interpreter, nullptr);
605 CREATE_ONE_END (name)
606 }
607
608 FORM (NEW1_Photo_createSimple, U"Create simple Photo", U"Create simple Photo...") {
609 WORD (name, U"Name", U"xy")
610 NATURAL (numberOfRows, U"Number of rows", U"10")
611 NATURAL (numberOfColumns, U"Number of columns", U"10")
612 FORMULA (redFormula, U"Red formula", U"x*y/100")
613 FORMULA (greenFormula, U"Green formula", U"x*y/1000")
614 FORMULA (blueFormula, U"Blue formula", U"x*y/100")
615 OK
616 DO
617 CREATE_ONE
618 autoPhoto result = Photo_createSimple (numberOfRows, numberOfColumns);
619 Matrix_formula (result -> d_red.get(), redFormula, interpreter, nullptr);
620 Matrix_formula (result -> d_green.get(), greenFormula, interpreter, nullptr);
621 Matrix_formula (result -> d_blue.get(), blueFormula, interpreter, nullptr);
622 CREATE_ONE_END (name)
623 }
624
625 DIRECT (NEW_Photo_extractBlue) {
626 CONVERT_EACH_TO_ONE (Photo)
627 autoMatrix result = Data_copy (my d_blue.get());
628 CONVERT_EACH_TO_ONE_END (my name.get(), U"_blue");
629 }
630
631 DIRECT (NEW_Photo_extractGreen) {
632 CONVERT_EACH_TO_ONE (Photo)
633 autoMatrix result = Data_copy (my d_green.get());
634 CONVERT_EACH_TO_ONE_END (my name.get(), U"_green");
635 }
636
637 DIRECT (NEW_Photo_extractRed) {
638 CONVERT_EACH_TO_ONE (Photo)
639 autoMatrix result = Data_copy (my d_red.get());
640 CONVERT_EACH_TO_ONE_END (my name.get(), U"_red");
641 }
642
643 DIRECT (NEW_Photo_extractTransparency) {
644 CONVERT_EACH_TO_ONE (Photo)
645 autoMatrix result = Data_copy (my d_transparency.get());
646 CONVERT_EACH_TO_ONE_END (my name.get(), U"_transparency");
647 }
648
649 FORM (MODIFY_Photo_formula_red, U"Photo Formula (red)", U"Formula (red)...") {
650 COMMENT (U"y := y1; for row := 1 to nrow do { x := x1; "
651 "for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
652 FORMULA (formula, U"Formula", U"self")
653 OK
654 DO
655 MODIFY_EACH_WEAK (Photo)
656 Matrix_formula (my d_red.get(), formula, interpreter, nullptr);
657 MODIFY_EACH_WEAK_END
658 }
659
660 FORM (MODIFY_Photo_formula_green, U"Photo Formula (green)", U"Formula (green)...") {
661 COMMENT (U"y := y1; for row := 1 to nrow do { x := x1; "
662 "for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
663 FORMULA (formula, U"Formula", U"self")
664 OK
665 DO
666 MODIFY_EACH_WEAK (Photo)
667 Matrix_formula (my d_green.get(), formula, interpreter, nullptr);
668 MODIFY_EACH_WEAK_END
669 }
670
671 FORM (MODIFY_Photo_formula_blue, U"Photo Formula (blue)", U"Formula (blue)...") {
672 COMMENT (U"y := y1; for row := 1 to nrow do { x := x1; "
673 "for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
674 FORMULA (formula, U"Formula", U"self")
675 OK
676 DO
677 MODIFY_EACH_WEAK (Photo)
678 Matrix_formula (my d_blue.get(), formula, interpreter, nullptr);
679 MODIFY_EACH_WEAK_END
680 }
681
682 FORM (MODIFY_Photo_formula_transparency, U"Photo Formula (transparency)", U"Formula (transparency)...") {
683 COMMENT (U"y := y1; for row := 1 to nrow do { x := x1; "
684 "for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
685 FORMULA (formula, U"Formula", U"self")
686 OK
687 DO
688 MODIFY_EACH_WEAK (Photo)
689 Matrix_formula (my d_transparency.get(), formula, interpreter, nullptr);
690 MODIFY_EACH_WEAK_END
691 }
692
693 FORM (GRAPHICS_Photo_paintCells, U"Photo: Paint cells with colour", U"Photo: Paint cells...") {
694 REAL (fromX, U"From x =", U"0.0")
695 REAL (toX, U"To x =", U"0.0")
696 REAL (fromY, U"From y =", U"0.0")
697 REAL (toY, U"To y =", U"0.0")
698 OK
699 DO
700 GRAPHICS_EACH (Photo)
701 Photo_paintCells (me, GRAPHICS, fromX, toX, fromY, toY);
702 GRAPHICS_EACH_END
703 }
704
705 FORM (GRAPHICS_Photo_paintImage, U"Photo: Paint colour image", nullptr) {
706 REAL (fromX, U"From x =", U"0.0")
707 REAL (toX, U"To x =", U"0.0")
708 REAL (fromY, U"From y =", U"0.0")
709 REAL (toY, U"To y =", U"0.0")
710 OK
711 DO
712 GRAPHICS_EACH (Photo)
713 Photo_paintImage (me, GRAPHICS, fromX, toX, fromY, toY);
714 GRAPHICS_EACH_END
715 }
716
717 FORM_SAVE (SAVE_Photo_saveAsAppleIconFile, U"Save as Apple icon file", nullptr, U"icns") {
718 SAVE_ONE (Photo, U"save the selected Photo object to the Apple icon file")
719 Photo_saveAsAppleIconFile (me, file);
720 SAVE_ONE_END
721 }
722
723 FORM_SAVE (SAVE_Photo_saveAsGIF, U"Save as GIF file", nullptr, U"gif") {
724 SAVE_ONE (Photo, U"save the selected Photo object to the GIF file")
725 Photo_saveAsGIF (me, file);
726 SAVE_ONE_END
727 }
728
729 FORM_SAVE (SAVE_Photo_saveAsJPEG, U"Save as JPEG file", nullptr, U"jpg") {
730 SAVE_ONE (Photo, U"save the selected Photo object to the JPEG file")
731 Photo_saveAsJPEG (me, file);
732 SAVE_ONE_END
733 }
734
735 FORM_SAVE (SAVE_Photo_saveAsJPEG2000, U"Save as JPEG-2000 file", nullptr, U"jpg") {
736 SAVE_ONE (Photo, U"save the selected Photo object to the JPEG-2000 file")
737 Photo_saveAsJPEG2000 (me, file);
738 SAVE_ONE_END
739 }
740
741 FORM_SAVE (SAVE_Photo_saveAsPNG, U"Save as PNG file", nullptr, U"png") {
742 SAVE_ONE (Photo, U"save the selected Photo object to the PNG file")
743 Photo_saveAsPNG (me, file);
744 SAVE_ONE_END
745 }
746
747 FORM_SAVE (SAVE_Photo_saveAsTIFF, U"Save as TIFF file", nullptr, U"tiff") {
748 SAVE_ONE (Photo, U"save the selected Photo object to the TIFF file")
749 Photo_saveAsTIFF (me, file);
750 SAVE_ONE_END
751 }
752
753 FORM_SAVE (SAVE_Photo_saveAsWindowsBitmapFile, U"Save as Windows bitmap file", nullptr, U"bmp") {
754 SAVE_ONE (Photo, U"save the selected Photo object to the Windows bitmap file")
755 Photo_saveAsWindowsBitmapFile (me, file);
756 SAVE_ONE_END
757 }
758
759 FORM_SAVE (SAVE_Photo_saveAsWindowsIconFile, U"Save as Windows icon file", nullptr, U"ico") {
760 SAVE_ONE (Photo, U"save the selected Photo object to the Windows icon file")
761 Photo_saveAsWindowsIconFile (me, file);
762 SAVE_ONE_END
763 }
764
765 // MARK: - PHOTO & MATRIX
766
767 DIRECT (MODIFY_Photo_Matrix_replaceBlue) {
768 MODIFY_FIRST_OF_ONE_AND_ONE (Photo, Matrix)
769 Photo_replaceBlue (me, you);
770 MODIFY_FIRST_OF_ONE_AND_ONE_END
771 }
772
773 DIRECT (MODIFY_Photo_Matrix_replaceGreen) {
774 MODIFY_FIRST_OF_ONE_AND_ONE (Photo, Matrix)
775 Photo_replaceGreen (me, you);
776 MODIFY_FIRST_OF_ONE_AND_ONE_END
777 }
778
779 DIRECT (MODIFY_Photo_Matrix_replaceRed) {
780 MODIFY_FIRST_OF_ONE_AND_ONE (Photo, Matrix)
781 Photo_replaceRed (me, you);
782 MODIFY_FIRST_OF_ONE_AND_ONE_END
783 }
784
785 DIRECT (MODIFY_Photo_Matrix_replaceTransparency) {
786 MODIFY_FIRST_OF_ONE_AND_ONE (Photo, Matrix)
787 Photo_replaceTransparency (me, you);
788 MODIFY_FIRST_OF_ONE_AND_ONE_END
789 }
790
791 // MARK: - MOVIE
792
793 FORM_READ (READ_ONE__Movie_openFromSoundFile, U"Open movie file", nullptr, true) {
794 READ_ONE
795 autoMovie result = Movie_openFromSoundFile (file);
796 READ_ONE_END // but loses data when saving, if object is associated only with the sound file
797 }
798
799 FORM (GRAPHICS_Movie_paintOneImage, U"Movie: Paint one image", nullptr) {
800 NATURAL (frameNumber, U"Frame number", U"1")
801 REAL (fromX, U"From x =", U"0.0")
802 REAL (toX, U"To x =", U"1.0")
803 REAL (fromY, U"From y =", U"0.0")
804 REAL (toY, U"To y =", U"1.0")
805 OK
806 DO
807 GRAPHICS_EACH (Movie)
808 Movie_paintOneImage (me, GRAPHICS, frameNumber, fromX, toX, fromY, toY);
809 GRAPHICS_EACH_END
810 }
811
812 DIRECT (EDITOR_ONE_Movie_viewAndEdit) {
813 EDITOR_ONE (a,Movie)
814 autoMovieWindow editor = MovieWindow_create (ID_AND_FULL_NAME, me);
815 EDITOR_ONE_END
816 }
817
818 // MARK: file recognizers
819
820 static autoDaata imageFileRecognizer (integer /* nread */, const char * /* header */, MelderFile file) {
821 conststring32 fileName = MelderFile_name (file);
822 if (Melder_endsWith_caseAware (fileName, U".jpg") ||
823 Melder_endsWith_caseAware (fileName, U".jpeg") ||
824 Melder_endsWith_caseAware (fileName, U".png") ||
825 Melder_endsWith_caseAware (fileName, U".tiff") ||
826 Melder_endsWith_caseAware (fileName, U".tif"))
827 {
828 return Photo_readFromImageFile (file);
829 }
830 return autoDaata ();
831 }
832
833 // MARK: - buttons
834
835 void praat_Matrix_init () {
836 Thing_recognizeClassesByName (classMatrix, classPhoto, classMovie);
837
838 Data_recognizeFileType (imageFileRecognizer);
839
840 praat_addMenuCommand (U"Objects", U"New", U"Matrix", nullptr, 1, nullptr);
841 praat_addMenuCommand (U"Objects", U"New", U"Create Matrix...", nullptr, 2, NEW1_Matrix_create);
842 praat_addMenuCommand (U"Objects", U"New", U"Create simple Matrix...", nullptr, 2, NEW1_Matrix_createSimple);
843 praat_addMenuCommand (U"Objects", U"New", U"Create simple Matrix from values...", nullptr, 2, NEW1_Matrix_createSimpleFromValues);
844 praat_addMenuCommand (U"Objects", U"New", U"Photo", nullptr, 1, nullptr);
845 praat_addMenuCommand (U"Objects", U"New", U"Create Photo...", nullptr, 2, NEW1_Photo_create);
846 praat_addMenuCommand (U"Objects", U"New", U"Create simple Photo...", nullptr, 2, NEW1_Photo_createSimple);
847
848 praat_addMenuCommand (U"Objects", U"Open", U"-- read movie --", nullptr, GuiMenu_HIDDEN, nullptr);
849 praat_addMenuCommand (U"Objects", U"Open", U"Open movie file...", nullptr, GuiMenu_HIDDEN, READ_ONE__Movie_openFromSoundFile);
850 praat_addMenuCommand (U"Objects", U"Open", U"-- read raw --", nullptr, 0, nullptr);
851 praat_addMenuCommand (U"Objects", U"Open", U"Read Matrix from raw text file...", nullptr, 0, READ_ONE__Matrix_readFromRawTextFile);
852 praat_addMenuCommand (U"Objects", U"Open", U"Read Matrix from LVS AP file...", nullptr, GuiMenu_HIDDEN, READ_ONE__Matrix_readAP);
853
854 praat_addAction1 (classMatrix, 0, U"Matrix help", nullptr, 0, HELP_Matrix_help);
855 praat_addAction1 (classMatrix, 1, U"Save as matrix text file... || Write to matrix text file...", nullptr, 0,
856 SAVE_Matrix_writeToMatrixTextFile); // alternative COMPATIBILITY <= 2011
857 praat_addAction1 (classMatrix, 1, U"Save as headerless spreadsheet file... || Write to headerless spreadsheet file...", nullptr, 0,
858 SAVE_Matrix_writeToHeaderlessSpreadsheetFile); // alternative COMPATIBILITY <= 2011
859 praat_addAction1 (classMatrix, 1, U"Play movie", nullptr, 0, MOVIE_Matrix_playMovie);
860 praat_addAction1 (classMatrix, 0, U"Draw -", nullptr, 0, nullptr);
861 praat_addAction1 (classMatrix, 0, U"Draw rows...", nullptr, 1, GRAPHICS_Matrix_drawRows);
862 praat_addAction1 (classMatrix, 0, U"Draw one contour...", nullptr, 1, GRAPHICS_Matrix_drawOneContour);
863 praat_addAction1 (classMatrix, 0, U"Draw contours...", nullptr, 1, GRAPHICS_Matrix_drawContours);
864 praat_addAction1 (classMatrix, 0, U"Paint image...", nullptr, 1, GRAPHICS_Matrix_paintImage);
865 praat_addAction1 (classMatrix, 0, U"Paint contours...", nullptr, 1, GRAPHICS_Matrix_paintContours);
866 praat_addAction1 (classMatrix, 0, U"Paint cells...", nullptr, 1, GRAPHICS_Matrix_paintCells);
867 praat_addAction1 (classMatrix, 0, U"Paint surface...", nullptr, 1, GRAPHICS_Matrix_paintSurface);
868 praat_addAction1 (classMatrix, 1, U"Query -", nullptr, 0, nullptr);
869 praat_addAction1 (classMatrix, 1, U"Get lowest x", nullptr, 1, REAL_Matrix_getLowestX);
870 praat_addAction1 (classMatrix, 1, U"Get highest x", nullptr, 1, REAL_Matrix_getHighestX);
871 praat_addAction1 (classMatrix, 1, U"Get lowest y", nullptr, 1, REAL_Matrix_getLowestY);
872 praat_addAction1 (classMatrix, 1, U"Get highest y", nullptr, 1, REAL_Matrix_getHighestY);
873 praat_addAction1 (classMatrix, 1, U"-- get structure --", nullptr, 1, nullptr);
874 praat_addAction1 (classMatrix, 1, U"Get number of rows", nullptr, 1, INTEGER_Matrix_getNumberOfRows);
875 praat_addAction1 (classMatrix, 1, U"Get number of columns", nullptr, 1, INTEGER_Matrix_getNumberOfColumns);
876 praat_addAction1 (classMatrix, 1, U"Get row distance", nullptr, 1, REAL_Matrix_getRowDistance);
877 praat_addAction1 (classMatrix, 1, U"Get column distance", nullptr, 1, REAL_Matrix_getColumnDistance);
878 praat_addAction1 (classMatrix, 1, U"Get y of row...", nullptr, 1, REAL_Matrix_getYofRow);
879 praat_addAction1 (classMatrix, 1, U"Get x of column...", nullptr, 1, REAL_Matrix_getXofColumn);
880 praat_addAction1 (classMatrix, 1, U"-- get value --", nullptr, 1, nullptr);
881 praat_addAction1 (classMatrix, 1, U"Get value in cell...", nullptr, 1, REAL_Matrix_getValueInCell);
882 praat_addAction1 (classMatrix, 1, U"Get value at xy...", nullptr, 1, REAL_Matrix_getValueAtXY);
883 praat_addAction1 (classMatrix, 1, U"Get all values", nullptr, 1, NUMMAT_Matrix_getAllValues);
884 praat_addAction1 (classMatrix, 1, U"Get all values in row...", nullptr, 1, NUMVEC_Matrix_getAllValuesInRow);
885 praat_addAction1 (classMatrix, 1, U"Get all values in column...", nullptr, 1, NUMVEC_Matrix_getAllValuesInColumn);
886 praat_addAction1 (classMatrix, 1, U"Get minimum", nullptr, 1, REAL_Matrix_getMinimum);
887 praat_addAction1 (classMatrix, 1, U"Get maximum", nullptr, 1, REAL_Matrix_getMaximum);
888 praat_addAction1 (classMatrix, 1, U"Get sum", nullptr, 1, REAL_Matrix_getSum);
889 praat_addAction1 (classMatrix, 0, U"Modify -", nullptr, 0, nullptr);
890 praat_addAction1 (classMatrix, 0, U"Formula...", nullptr, 1, MODIFY_Matrix_formula);
891 praat_addAction1 (classMatrix, 0, U"Set value...", nullptr, 1, MODIFY_Matrix_setValue);
892 praat_addAction1 (classMatrix, 0, U"Analyse", nullptr, 0, nullptr);
893 praat_addAction1 (classMatrix, 0, U"Eigen", nullptr, 0, CONVERT_EACH_TO_MULTIPLE_Matrix_eigen);
894 praat_addAction1 (classMatrix, 0, U"Synthesize", nullptr, 0, nullptr);
895 praat_addAction1 (classMatrix, 0, U"Power...", nullptr, 0, NEW_Matrix_power);
896 praat_addAction1 (classMatrix, 0, U"Combine two Matrices -", nullptr, 0, nullptr);
897 praat_addAction1 (classMatrix, 2, U"Merge (append rows)", nullptr, 1, NEW1_Matrix_appendRows);
898 praat_addAction1 (classMatrix, 2, U"To ParamCurve", nullptr, 1, NEW1_Matrix_to_ParamCurve);
899 praat_addAction1 (classMatrix, 0, U"Cast -", nullptr, 0, nullptr);
900 praat_addAction1 (classMatrix, 0, U"To Cochleagram", nullptr, 1, NEW_Matrix_to_Cochleagram);
901 praat_addAction1 (classMatrix, 0, U"To Excitation", nullptr, 1, NEW_Matrix_to_Excitation);
902 praat_addAction1 (classMatrix, 0, U"To Harmonicity", nullptr, 1, NEW_Matrix_to_Harmonicity);
903 praat_addAction1 (classMatrix, 0, U"To Intensity", nullptr, 1, NEW_Matrix_to_Intensity);
904 praat_addAction1 (classMatrix, 0, U"To Ltas", nullptr, 1, NEW_Matrix_to_Ltas);
905 praat_addAction1 (classMatrix, 0, U"To Pitch", nullptr, 1, NEW_Matrix_to_Pitch);
906 praat_addAction1 (classMatrix, 0, U"To PointProcess", nullptr, 1, NEW_Matrix_to_PointProcess);
907 praat_addAction1 (classMatrix, 0, U"To Polygon", nullptr, 1, NEW_Matrix_to_Polygon);
908 praat_addAction1 (classMatrix, 0, U"To RealTier...", nullptr, 1,
909 CONVERT_EACH_TO_ONE__Matrix_to_RealTier);
910 praat_addAction1 (classMatrix, 0, U"To Sound", nullptr, 1, NEW_Matrix_to_Sound);
911 praat_addAction1 (classMatrix, 0, U"To Sound (slice)...", nullptr, 1, NEW_Matrix_to_Sound_mono);
912 praat_addAction1 (classMatrix, 0, U"To Spectrogram", nullptr, 1, NEW_Matrix_to_Spectrogram);
913 praat_addAction1 (classMatrix, 0, U"To TableOfReal", nullptr, 1, NEW_Matrix_to_TableOfReal);
914 praat_addAction1 (classMatrix, 0, U"To Spectrum", nullptr, 1, NEW_Matrix_to_Spectrum);
915 praat_addAction1 (classMatrix, 0, U"To Transition", nullptr, 1, NEW_Matrix_to_Transition);
916 praat_addAction1 (classMatrix, 0, U"To VocalTract", nullptr, 1, NEW_Matrix_to_VocalTract);
917
918 praat_addAction1 (classPhoto, 0, U"Draw -", nullptr, 0, nullptr);
919 praat_addAction1 (classPhoto, 0, U"Paint image...", nullptr, 1, GRAPHICS_Photo_paintImage);
920 praat_addAction1 (classPhoto, 0, U"Paint cells...", nullptr, 1, GRAPHICS_Photo_paintCells);
921 praat_addAction1 (classPhoto, 0, U"Modify -", nullptr, 0, nullptr);
922 praat_addAction1 (classPhoto, 0, U"Formula (red)...", nullptr, 1, MODIFY_Photo_formula_red);
923 praat_addAction1 (classPhoto, 0, U"Formula (green)...", nullptr, 1, MODIFY_Photo_formula_green);
924 praat_addAction1 (classPhoto, 0, U"Formula (blue)...", nullptr, 1, MODIFY_Photo_formula_blue);
925 praat_addAction1 (classPhoto, 0, U"Formula (transparency)...", nullptr, 1, MODIFY_Photo_formula_transparency);
926 praat_addAction1 (classPhoto, 0, U"Extract -", nullptr, 0, nullptr);
927 praat_addAction1 (classPhoto, 0, U"Extract red", nullptr, 1, NEW_Photo_extractRed);
928 praat_addAction1 (classPhoto, 0, U"Extract green", nullptr, 1, NEW_Photo_extractGreen);
929 praat_addAction1 (classPhoto, 0, U"Extract blue", nullptr, 1, NEW_Photo_extractBlue);
930 praat_addAction1 (classPhoto, 0, U"Extract transparency", nullptr, 1, NEW_Photo_extractTransparency);
931 praat_addAction1 (classPhoto, 1, U"Save as PNG file...", nullptr, 0, SAVE_Photo_saveAsPNG);
932 #if defined (macintosh) || defined (_WIN32)
933 praat_addAction1 (classPhoto, 1, U"Save as TIFF file...", nullptr, 0, SAVE_Photo_saveAsTIFF);
934 praat_addAction1 (classPhoto, 1, U"Save as GIF file...", nullptr, 0, SAVE_Photo_saveAsGIF);
935 praat_addAction1 (classPhoto, 1, U"Save as Windows bitmap file...", nullptr, 0, SAVE_Photo_saveAsWindowsBitmapFile);
936 praat_addAction1 (classPhoto, 1, U"Save as lossy JPEG file...", nullptr, 0, SAVE_Photo_saveAsJPEG);
937 #endif
938 #if defined (macintosh)
939 praat_addAction1 (classPhoto, 1, U"Save as JPEG-2000 file...", nullptr, 0, SAVE_Photo_saveAsJPEG2000);
940 praat_addAction1 (classPhoto, 1, U"Save as Apple icon file...", nullptr, 0, SAVE_Photo_saveAsAppleIconFile);
941 praat_addAction1 (classPhoto, 1, U"Save as Windows icon file...", nullptr, 0, SAVE_Photo_saveAsWindowsIconFile);
942 #endif
943
944 praat_addAction1 (classMovie, 1, U"Paint one image...", nullptr, 1, GRAPHICS_Movie_paintOneImage);
945 praat_addAction1 (classMovie, 1, U"View & Edit", nullptr, GuiMenu_ATTRACTIVE, EDITOR_ONE_Movie_viewAndEdit);
946
947 praat_addAction2 (classMatrix, 1, classSound, 1, U"To ParamCurve", nullptr, 0, NEW1_Matrix_to_ParamCurve);
948 praat_addAction2 (classPhoto, 1, classMatrix, 1, U"Replace red", nullptr, 0, MODIFY_Photo_Matrix_replaceRed);
949 praat_addAction2 (classPhoto, 1, classMatrix, 1, U"Replace green", nullptr, 0, MODIFY_Photo_Matrix_replaceGreen);
950 praat_addAction2 (classPhoto, 1, classMatrix, 1, U"Replace blue", nullptr, 0, MODIFY_Photo_Matrix_replaceBlue);
951 praat_addAction2 (classPhoto, 1, classMatrix, 1, U"Replace transparency", nullptr, 0, MODIFY_Photo_Matrix_replaceTransparency);
952 }
953
954 /* End of file praat_Matrix.cpp */