Debian Codegraph @

fon/praat_TimeFunction.cpp

raw symbols SCIP
1 /* praat_TimeFunction.cpp
2 *
3 * Copyright (C) 1992-2017,2022,2023 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 2 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 "praat_TimeFunction.h"cxx . . $ `<file>/fon/praat_TimeFunction.h`/
20
21 // MARK: - TIMEFUNCTION
22
23 // MARK: Query
24
25 DIRECTcxx . . $ `sys/praatM.h:412:9`! (REAL_TimeFunction_getStartTime) {
26 QUERY_ONE_FOR_REALcxx . . $ `sys/praatM.h:827:9`! (Function)
27 double result = mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin.;
28 QUERY_ONE_FOR_REAL_ENDcxx . . $ `sys/praatM.h:829:9`! (U" seconds")
29 }
30
31 DIRECTcxx . . $ `sys/praatM.h:412:9`! (REAL_TimeFunction_getEndTime) {
32 QUERY_ONE_FOR_REALcxx . . $ `sys/praatM.h:827:9`! (Function)
33 double result = mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.;
34 QUERY_ONE_FOR_REAL_ENDcxx . . $ `sys/praatM.h:829:9`! (U" seconds")
35 }
36
37 DIRECTcxx . . $ `sys/praatM.h:412:9`! (REAL_TimeFunction_getTotalDuration) {
38 QUERY_ONE_FOR_REALcxx . . $ `sys/praatM.h:827:9`! (Function)
39 double result = mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax. - mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin.;
40 QUERY_ONE_FOR_REAL_ENDcxx . . $ `sys/praatM.h:829:9`! (U" seconds")
41 }
42
43 // MARK: Modify
44
45 FORMcxx . . $ `sys/praatM.h:79:9`! (MODIFY_TimeFunction_shiftTimesBy, U"Shift times by", nullptr) {
46 REALcxx . . $ `sys/praatM.h:92:9`! (shift, U"Shift (s)", U"0.5")
47 OKcxx . . $ `sys/praatM.h:327:9`!
48 DOcxx . . $ `sys/praatM.h:354:9`!
49 MODIFY_EACHcxx . . $ `sys/praatM.h:1017:9`! (Function)
50 Function_shiftXBycxx . . $ Function_shiftXBy(730db58827849a4c). (me, shift);
51 MODIFY_EACH_ENDcxx . . $ `sys/praatM.h:1020:9`!
52 }
53
54 FORMcxx . . $ `sys/praatM.h:79:9`! (MODIFY_TimeFunction_shiftTimesTo, U"Shift times to", nullptr) {
55 CHOICEcxx . . $ `sys/praatM.h:216:9`! (shift, U"Shift", 1)
56 OPTIONcxx . . $ `sys/praatM.h:246:9`! (U"start time")
57 OPTIONcxx . . $ `sys/praatM.h:246:9`! (U"centre time")
58 OPTIONcxx . . $ `sys/praatM.h:246:9`! (U"end time")
59 REALcxx . . $ `sys/praatM.h:92:9`! (toTime, U"To time (s)", U"0.0")
60 OKcxx . . $ `sys/praatM.h:327:9`!
61 DOcxx . . $ `sys/praatM.h:354:9`!
62 MODIFY_EACHcxx . . $ `sys/praatM.h:1017:9`! (Function)
63 Function_shiftXTocxx . . $ Function_shiftXTo(ac72a71dd6ac1bfb). (me, shift == 1 ? mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin. : shift == 2 ? 0.5 * (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin. + mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.) : mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., toTime);
64 MODIFY_EACH_ENDcxx . . $ `sys/praatM.h:1020:9`!
65 }
66
67 DIRECTcxx . . $ `sys/praatM.h:412:9`! (MODIFY_TimeFunction_shiftToZero) {
68 MODIFY_EACHcxx . . $ `sys/praatM.h:1017:9`! (Function)
69 Function_shiftXTocxx . . $ Function_shiftXTo(ac72a71dd6ac1bfb). (me, mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., 0.0);
70 MODIFY_EACH_ENDcxx . . $ `sys/praatM.h:1020:9`!
71 }
72
73 FORMcxx . . $ `sys/praatM.h:79:9`! (MODIFY_TimeFunction_scaleTimesBy, U"Scale times by", nullptr) {
74 POSITIVEcxx . . $ `sys/praatM.h:104:9`! (factor, U"Factor", U"2.0")
75 OKcxx . . $ `sys/praatM.h:327:9`!
76 DOcxx . . $ `sys/praatM.h:354:9`!
77 MODIFY_EACHcxx . . $ `sys/praatM.h:1017:9`! (Function)
78 Function_scaleXBycxx . . $ Function_scaleXBy(730db58827849a4c). (me, factor);
79 MODIFY_EACH_ENDcxx . . $ `sys/praatM.h:1020:9`!
80 }
81
82 FORMcxx . . $ `sys/praatM.h:79:9`! (MODIFY_TimeFunction_scaleTimesTo, U"Scale times to", nullptr) {
83 REALcxx . . $ `sys/praatM.h:92:9`! (newStartTime, U"New start time (s)", U"0.0")
84 REALcxx . . $ `sys/praatM.h:92:9`! (newEndTime, U"New end time (s)", U"1.0")
85 OKcxx . . $ `sys/praatM.h:327:9`!
86 DOcxx . . $ `sys/praatM.h:354:9`!
87 if (newStartTime >= newEndTime) Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"New end time should be greater than new start time.");
88 MODIFY_EACHcxx . . $ `sys/praatM.h:1017:9`! (Function)
89 Function_scaleXTocxx . . $ Function_scaleXTo(ac72a71dd6ac1bfb). (me, newStartTime, newEndTime);
90 MODIFY_EACH_ENDcxx . . $ `sys/praatM.h:1020:9`!
91 }
92
93 // MARK: - buttons
94
95 void praat_TimeFunction_query_initcxx . . $ praat_TimeFunction_query_init(b2b8400651464df9). (ClassInfocxx . . $ ClassInfo# klas) {
96 praat_addAction1cxx . . $ `sys/praat.h:72:9`! (klas, 1, U"Query time domain", nullptr, 1, nullptr);
97 praat_addAction1cxx . . $ `sys/praat.h:72:9`! (klas, 1, U"Get start time || Get starting time", nullptr, 2, REAL_TimeFunction_getStartTime);
98 // alternatives COMPATIBILITY <= 2006
99 praat_addAction1cxx . . $ `sys/praat.h:72:9`! (klas, 1, U"Get end time || Get finishing time", nullptr, 2, REAL_TimeFunction_getEndTime);
100 // alternatives COMPATIBILITY <= 2006
101 praat_addAction1cxx . . $ `sys/praat.h:72:9`! (klas, 1, U"Get total duration || Get duration", nullptr, 2, REAL_TimeFunction_getTotalDuration);
102 // alternatives COMPATIBILITY <= 2004
103 }
104
105 void praat_TimeFunction_modify_initcxx . . $ praat_TimeFunction_modify_init(b2b8400651464df9). (ClassInfocxx . . $ ClassInfo# klas) {
106 praat_addAction1cxx . . $ `sys/praat.h:72:9`! (klas, 0, U"Modify times", nullptr, 1, nullptr);
107 praat_addAction1cxx . . $ `sys/praat.h:72:9`! (klas, 0, U"Shift times by...", nullptr, 2, MODIFY_TimeFunction_shiftTimesBy);
108 praat_addAction1cxx . . $ `sys/praat.h:72:9`! (klas, 0, U"Shift times to...", nullptr, 2, MODIFY_TimeFunction_shiftTimesTo);
109 praat_addAction1cxx . . $ `sys/praat.h:72:9`! (klas, 0, U"Shift to zero", nullptr, GuiMenu_DEPTH_2cxx . . $ `sys/Gui.h:863:9`! | GuiMenu_DEPRECATED_2008cxx . . $ `sys/Gui.h:878:9`!, MODIFY_TimeFunction_shiftToZero);
110 // replace with "Shift times to..."
111 praat_addAction1cxx . . $ `sys/praat.h:72:9`! (klas, 0, U"Scale times by...", nullptr, 2, MODIFY_TimeFunction_scaleTimesBy);
112 praat_addAction1cxx . . $ `sys/praat.h:72:9`! (klas, 0, U"Scale times to... || Scale times...", nullptr, 2, MODIFY_TimeFunction_scaleTimesTo);
113 // alternatives COMPATIBILITY <= 2008
114 }
115
116 /* End of file praat_TimeFunction.cpp */