| 1 |
/* SoundEditor.cpp |
| 2 |
* |
| 3 |
* Copyright (C) 1992-2022 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 "SoundEditor.h" |
| 20 |
#include "EditorM.h" |
| 21 |
|
| 22 |
Thing_implement (SoundEditor, FunctionEditor, 0); |
| 23 |
|
| 24 |
static void menu_cb_SoundEditorHelp (SoundEditor, EDITOR_ARGS) { Melder_help (U"SoundEditor"); } |
| 25 |
static void menu_cb_LongSoundEditorHelp (SoundEditor, EDITOR_ARGS) { Melder_help (U"LongSoundEditor"); } |
| 26 |
|
| 27 |
void structSoundEditor :: v_createMenuItems_help (EditorMenu menu) { |
| 28 |
structFunctionEditor :: v_createMenuItems_help (menu); |
| 29 |
EditorMenu_addCommand (menu, U"SoundEditor help", '?', menu_cb_SoundEditorHelp); |
| 30 |
EditorMenu_addCommand (menu, U"LongSoundEditor help", 0, menu_cb_LongSoundEditorHelp); |
| 31 |
// BUG: add help on Sound area and Sound analysis area |
| 32 |
} |
| 33 |
|
| 34 |
autoSoundEditor SoundEditor_create (conststring32 title, SampledXY soundOrLongSound) { |
| 35 |
Melder_assert (soundOrLongSound); |
| 36 |
Melder_assert (soundOrLongSound -> ny > 0); |
| 37 |
try { |
| 38 |
autoSoundEditor me = Thing_new (SoundEditor); |
| 39 |
if (Thing_isa (soundOrLongSound, classSound)) |
| 40 |
my soundArea() = SoundArea_create (true, nullptr, me.get()); |
| 41 |
else |
| 42 |
my soundArea() = LongSoundArea_create (false, nullptr, me.get()); |
| 43 |
my soundAnalysisArea() = SoundAnalysisArea_create (false, nullptr, me.get()); |
| 44 |
FunctionEditor_init (me.get(), title, soundOrLongSound); |
| 45 |
return me; |
| 46 |
} catch (MelderError) { |
| 47 |
Melder_throw (U"Sound window not created."); |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
/* End of file SoundEditor.cpp */ |