| 1 |
#ifndef _PitchTierEditor_h_ |
| 2 |
#define _PitchTierEditor_h_ |
| 3 |
/* PitchTierEditor.h |
| 4 |
* |
| 5 |
* Copyright (C) 1992-2005,2007,2009-2012,2015-2018,2020-2022 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 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 "FunctionEditor.h" |
| 22 |
#include "PitchTierArea.h" |
| 23 |
#include "SoundArea.h" |
| 24 |
#include "PitchTier_to_Sound.h" |
| 25 |
|
| 26 |
Thing_define (PitchTierEditor, FunctionEditor) { |
| 27 |
DEFINE_FunctionArea (1, PitchTierArea, pitchTierArea) |
| 28 |
DEFINE_FunctionArea (2, SoundArea, soundArea) |
| 29 |
|
| 30 |
void v1_dataChanged (Editor sender) override { |
| 31 |
our PitchTierEditor_Parent :: v1_dataChanged (sender); |
| 32 |
our pitchTierArea() -> functionChanged (static_cast <PitchTier> (our data())); |
| 33 |
if (our soundArea()) |
| 34 |
our soundArea() -> functionChanged (nullptr); // BUG: the copy probably doesn't change |
| 35 |
} |
| 36 |
void v_distributeAreas () override { |
| 37 |
if (our soundArea()) { |
| 38 |
our pitchTierArea() -> setGlobalYRange_fraction (0.0, 0.618); |
| 39 |
our soundArea() -> setGlobalYRange_fraction (0.618, 1.0); |
| 40 |
} else { |
| 41 |
our pitchTierArea() -> setGlobalYRange_fraction (0.0, 1.0); |
| 42 |
} |
| 43 |
} |
| 44 |
void v_createMenuItems_help (EditorMenu menu) |
| 45 |
override; |
| 46 |
void v_play (double startTime, double endTime) override { |
| 47 |
if (our soundArea()) |
| 48 |
Sound_playPart (our soundArea() -> sound(), startTime, endTime, theFunctionEditor_playCallback, this); |
| 49 |
else |
| 50 |
PitchTier_playPart (our pitchTierArea() -> pitchTier(), startTime, endTime, false, theFunctionEditor_playCallback, this); |
| 51 |
} |
| 52 |
void v_drawLegends () override { |
| 53 |
FunctionArea_drawLegend (our pitchTierArea().get(), |
| 54 |
FunctionArea_legend_LINES_SPECKLES U" ##modifiable PitchTier", |
| 55 |
DataGui_defaultForegroundColour (our pitchTierArea().get(), false) |
| 56 |
); |
| 57 |
if (our soundArea()) |
| 58 |
FunctionArea_drawLegend (our soundArea().get(), |
| 59 |
FunctionArea_legend_WAVEFORM U" %%non-modifiable copy of sound", |
| 60 |
DataGui_defaultForegroundColour (our soundArea().get(), false) |
| 61 |
); |
| 62 |
} |
| 63 |
}; |
| 64 |
|
| 65 |
autoPitchTierEditor PitchTierEditor_create (conststring32 title, PitchTier pitch, Sound optionalSoundToCopy); |
| 66 |
|
| 67 |
/* End of file PitchTierEditor.h */ |
| 68 |
#endif |