| 1 | #ifndef _FormantPathArea_h_ |
| 2 | #define _FormantPathArea_h_ |
| 3 | /* FormantPathEditor.h |
| 4 | * |
| 5 | * Copyright (C) 2020-2023 David Weenink, 2022-2024,2026 Paul Boersma |
| 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 3 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 "FormantPath.h" |
| 22 | #include "SoundAnalysisArea.h" |
| 23 | #include "TextGrid.h" |
| 24 | |
| 25 | /* |
| 26 | The explanation following is for analyses with different maximum formant frequencies (i.e. different ceiling frequencies). |
| 27 | The <name>-log tier can have multiple intervals. Each interval shows a particular analysis prefered by the user. It shows first the <ceiling> that was selected by the user, then a ';' separator and finally the number of parameters per track of the formant modeler. |
| 28 | Its content could be, for example '5000; 5 5 5', which means that the analysis with a ceiling of 5000 Hz was chosen and the Formant modeler used F1, F2, and F3 in the modelling and reserved 5 coefficients to model F1, 5 coefficients to model F2 and 5 coefficients to model F3. The <ceiling> number must match one of the possible ceiling frequencies (rounded to integer Hz values) |
| 29 | An empty interval always implies the default analysis. Therefore only intervals where you want a non-default have to be specified. |
| 30 | |
| 31 | There is no need to permanently store the FormantModelers because they can easily |
| 32 | be calculated whenever they are needed from the information in the tiers. |
| 33 | |
| 34 | Multichannel sounds don't make sense with respect to the analysis part. If both channels are the same sound, one is redundant. |
| 35 | If two different sounds, then average (convert to mono), as in other editors. |
| 36 | */ |
| 37 | |
| 38 | Thing_define (FormantPathArea, SoundAnalysisArea) { |
| 39 | FormantPath _formantPath; |
| 40 | FormantPath formantPath() const { return our _formantPath; } |
| 41 | bool formantPathAnalysisParametersKnown = false; |
| 42 | |
| 43 | double maximumInitialLengthOfWindow() override { |
| 44 | return 5.0; |
| 45 | } |
| 46 | void v_formantsInfo () const |
| 47 | override; |
| 48 | void v_draw_analysis_formants () |
| 49 | override; |
| 50 | void v_createMenuItems_formant (EditorMenu menu) |
| 51 | override; |
| 52 | bool v_mouse (GuiDrawingArea_MouseEvent event, double x_world, double localY_fraction) |
| 53 | override; |
| 54 | void v_reset_analysis () override { |
| 55 | our d_spectrogramList. reset(); |
| 56 | our d_pitch. reset(); |
| 57 | our d_intensity. reset(); |
| 58 | our d_pulses. reset(); |
| 59 | // not our formant! |
| 60 | } |
| 61 | |
| 62 | #include "FormantPathArea_prefs.h" |
| 63 | }; |
| 64 | |
| 65 | Thing_define (FormantPathArea_without_Sound, FormantPathArea) { |
| 66 | virtual bool v_hasSpectrogram () { return false; } |
| 67 | virtual bool v_hasPitch () { return false; } |
| 68 | virtual bool v_hasIntensity () { return false; } |
| 69 | virtual bool v_hasPulses () { return false; } |
| 70 | }; |
| 71 | |
| 72 | DEFINE_FunctionArea_create (FormantPathArea, Sound) |
| 73 | DEFINE_FunctionArea_create (FormantPathArea_without_Sound, Sound) |
| 74 | |
| 75 | /* End of file FormantPathArea.h */ |
| 76 | #endif |