Debian Codegraph @

LPC/FormantPath_to_IntervalTier.cpp

raw symbols SCIP
1 /* FormantPath_to_IntervalTier.cpp
2 *
3 * Copyright (C) 2020-2023 David Weenink
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. See the GNU
13 * 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 "FormantPath_to_IntervalTier.h"cxx . . $ `<file>/LPC/FormantPath_to_IntervalTier.h`/
20
21 static void IntervalTier_addCandidatecxx . . $ IntervalTier_addCandidate(767744e7767a6f39). (IntervalTiercxx . . $ IntervalTier# me, double splitTime, integercxx . . $ integer# candidate) {
22 conststring32cxx . . $ conststring32# label = Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (candidate);
23 TextIntervalcxx . . $ TextInterval# last = mycxx . . $ `melder/melder.h:44:9`! intervalscxx . . $ structIntervalTier#intervals..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).mycxx . . $ `melder/melder.h:44:9`! intervalscxx . . $ structIntervalTier#intervals..sizecxx . . $ CollectionOf#size.];
24 last -> xmaxcxx . . $ structFunction#xmax. = splitTime;
25 last -> textcxx . . $ structTextInterval#text. =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (label);
26 autoTextIntervalcxx . . $ autoTextInterval# interval = TextInterval_createcxx . . $ TextInterval_create(69da32435edc95c8). (splitTime, mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., U"");
27 mycxx . . $ `melder/melder.h:44:9`! intervalscxx . . $ structIntervalTier#intervals.. addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (intervalcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).());
28 }
29
30 #if 0
31 autoIntervalTier FormantPath_to_IntervalTier (FormantPath me, double tmin, double tmax) {
32 autoIntervalTier thee = IntervalTier_create (tmin, tmax);
33 integer ifmin, ifmax;
34 Sampled_getWindowSamples (me, tmin, tmax, & ifmin, & ifmax);
35 /*
36 If the interval [tmin, tmax] did not overlap any samples and falls
37 inbetween two successive samples that have index i1 and i1+1,
38 itmin == i1+1 && itmax == i1;
39 */
40 integer startIndex = Sampled_xToNearestIndex (me, tmin);
41 Melder_clipLeft (1_integer, & startIndex);
42 integer candidate = my path [startIndex];
43 for (integer iframe = ifmin; iframe <= ifmax; iframe ++) {
44 if (my path [iframe] != candidate) {
45 const double endTime = Sampled_indexToX (me, iframe) - 0.5 * my dx;
46 IntervalTier_addCandidate (thee.get(), endTime, candidate);
47 candidate = my path [iframe];
48 }
49 }
50 integer endIndex = Sampled_xToNearestIndex (me, tmax);
51 Melder_clipRight (& endIndex, my nx);
52 integer endCandidate = my path [endIndex];
53 if (endCandidate != candidate) {
54 const double endTime = Sampled_indexToX (me, ifmax) + 0.5 * my dx;
55 IntervalTier_addCandidate (thee.get(), endTime, candidate);
56 candidate = endCandidate;
57 }
58 /*
59 Set label on last interval
60 */
61 const TextInterval textInterval = thy intervals.at [thy intervals.size];
62 TextInterval_setText (textInterval, Melder_integer (candidate));
63 return thee;
64 }
65 #endif
66 /* End of file FormantPath_to_IntervalTier.cpp */