Debian Codegraph @

foned/FormantGridArea.h

raw
1 #ifndef _FormantGridArea_h_
2 #define _FormantGridArea_h_
3 /* FormantGridArea.h
4 *
5 * Copyright (C) 2008-2018,2020,2022 Paul Boersma & David Weenink
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 *
12 * This code is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this work. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "FormantGrid.h"
22 #include "RealTierArea.h"
23
24 Thing_define (FormantGridArea, RealTierArea) {
25 FormantGrid _formantGrid;
26 FormantGrid formantGrid() { return our _formantGrid; }
27
28 bool editingBandwidths = false;
29 integer selectedFormant = 1;
30 GuiMenuItem d_bandwidthsToggle;
31
32 void v_updateScaling () override {
33 if (our editingBandwidths) {
34 Melder_assert (isdefined (our instancePref_bandwidthFloor()));
35 Melder_assert (isdefined (our instancePref_bandwidthCeiling()));
36 our ymin = our instancePref_bandwidthFloor();
37 our ymax = our instancePref_bandwidthCeiling();
38 } else {
39 Melder_assert (isdefined (our instancePref_formantFloor()));
40 Melder_assert (isdefined (our instancePref_formantCeiling()));
41 our ymin = our instancePref_formantFloor();
42 our ymax = our instancePref_formantCeiling();
43 }
44 if (our realTier() && our realTier() -> points.size > 0) {
45 Melder_assert (! (our v_maximumLegalY() < our v_minimumLegalY())); // NaN-safe
46 const double minimumValue = Melder_clipped (our v_minimumLegalY(), RealTier_getMinimumValue (our realTier()), our v_maximumLegalY());
47 const double maximumValue = Melder_clipped (our v_minimumLegalY(), RealTier_getMaximumValue (our realTier()), our v_maximumLegalY());
48 Melder_clipRight (& our ymin, minimumValue);
49 Melder_clipLeft (maximumValue, & our ymax);
50 }
51 if (our ycursor <= our ymin || our ycursor >= our ymax)
52 our ycursor = 0.382 * our ymin + 0.618 * our ymax;
53 }
54 conststring32 v_menuTitle ()
55 override { return U"FormantGrid"; }
56 double v_minimumLegalY ()
57 override { return 0.0; }
58 conststring32 v_rightTickUnits ()
59 override { return U" Hz"; }
60 void v_drawInside ()
61 override;
62 void v_createMenus ()
63 override;
64
65 virtual bool v_hasSourceMenu () { return true; }
66
67 #include "FormantGridArea_prefs.h"
68 };
69
70 DEFINE_FunctionArea_create (FormantGridArea, FormantGrid)
71
72 void FormantGridArea_playPart (FormantGridArea me, double startTime, double endTime, Sound_PlayCallback playCallback, Thing playBoss);
73
74 /* End of file FormantGridArea.h */
75 #endif