| 1 | /* FujisakiPitch.cpp |
| 2 | * |
| 3 | * Copyright (C) 2002-2011,2015,2016,2017 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 "FujisakiPitch.h"cxx . . $ `<file>/fon/FujisakiPitch.h`/ |
| 20 | |
| 21 | #include "oo_DESTROY.h"cxx . . $ `<file>/sys/oo_DESTROY.h`/ |
| 22 | #include "FujisakiPitch_def.h"cxx . . $ `<file>/fon/FujisakiPitch_def.h`/ |
| 23 | #include "oo_COPY.h"cxx . . $ `<file>/sys/oo_COPY.h`/ |
| 24 | #include "FujisakiPitch_def.h"cxx . . $ `<file>/fon/FujisakiPitch_def.h`/ |
| 25 | #include "oo_EQUAL.h"cxx . . $ `<file>/sys/oo_EQUAL.h`/ |
| 26 | #include "FujisakiPitch_def.h"cxx . . $ `<file>/fon/FujisakiPitch_def.h`/ |
| 27 | #include "oo_CAN_WRITE_AS_ENCODING.h"cxx . . $ `<file>/sys/oo_CAN_WRITE_AS_ENCODING.h`/ |
| 28 | #include "FujisakiPitch_def.h"cxx . . $ `<file>/fon/FujisakiPitch_def.h`/ |
| 29 | #include "oo_WRITE_TEXT.h"cxx . . $ `<file>/sys/oo_WRITE_TEXT.h`/ |
| 30 | #include "FujisakiPitch_def.h"cxx . . $ `<file>/fon/FujisakiPitch_def.h`/ |
| 31 | #include "oo_READ_TEXT.h"cxx . . $ `<file>/sys/oo_READ_TEXT.h`/ |
| 32 | #include "FujisakiPitch_def.h"cxx . . $ `<file>/fon/FujisakiPitch_def.h`/ |
| 33 | #include "oo_WRITE_BINARY.h"cxx . . $ `<file>/sys/oo_WRITE_BINARY.h`/ |
| 34 | #include "FujisakiPitch_def.h"cxx . . $ `<file>/fon/FujisakiPitch_def.h`/ |
| 35 | #include "oo_READ_BINARY.h"cxx . . $ `<file>/sys/oo_READ_BINARY.h`/ |
| 36 | #include "FujisakiPitch_def.h"cxx . . $ `<file>/fon/FujisakiPitch_def.h`/ |
| 37 | #include "oo_DESCRIPTION.h"cxx . . $ `<file>/sys/oo_DESCRIPTION.h`/ |
| 38 | #include "FujisakiPitch_def.h"cxx . . $ `<file>/fon/FujisakiPitch_def.h`/ |
| 39 | |
| 40 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (FujisakiCommand, Function, 0); |
| 41 | |
| 42 | autoFujisakiCommand FujisakiCommand_createcxx . . $ FujisakiCommand_create(27326c7f24c4d9af). (double tmin, double tmax, double amplitude) { |
| 43 | try { |
| 44 | autoFujisakiCommand me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (FujisakiCommand); |
| 45 | Function_initcxx . . $ Function_init(ac72a71dd6ac1bfb). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tmin, tmax); |
| 46 | mycxx . . $ `melder/melder.h:44:9`! amplitude = amplitude; |
| 47 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 48 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 49 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Fujisaki command not created."); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (FujisakiPitch, Function, 0); |
| 54 | |
| 55 | autoFujisakiPitch FujisakiPitch_createcxx . . $ FujisakiPitch_create(160996f2be18c0fc). (double tmin, double tmax, |
| 56 | double baseFrequency, double alpha, double beta, double gamma) |
| 57 | { |
| 58 | try { |
| 59 | autoFujisakiPitch me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (FujisakiPitch); |
| 60 | Function_initcxx . . $ Function_init(ac72a71dd6ac1bfb). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tmin, tmax); |
| 61 | mycxx . . $ `melder/melder.h:44:9`! baseFrequency = baseFrequency; |
| 62 | mycxx . . $ `melder/melder.h:44:9`! alpha = alpha; |
| 63 | mycxx . . $ `melder/melder.h:44:9`! beta = beta; |
| 64 | mycxx . . $ `melder/melder.h:44:9`! gamma = gamma; |
| 65 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 66 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 67 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"FujisakiPitch not created."); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | autoFujisakiPitch Pitch_to_FujisakiPitchcxx . . $ Pitch_to_FujisakiPitch(d36f04cb4385c13f). (Pitchcxx . . $ Pitch# me, double gamma, double /* timeResolution */, |
| 72 | autoFujisakiPitch *intermediate1, autoFujisakiPitch *intermediate2, autoFujisakiPitch *intermediate3) |
| 73 | { |
| 74 | try { |
| 75 | autoFujisakiPitch thee = FujisakiPitch_createcxx . . $ FujisakiPitch_create(160996f2be18c0fc). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax., 0, 0, 0, gamma); |
| 76 | /* |
| 77 | * Get phrase commands. |
| 78 | */ |
| 79 | while (/* ... */ 0) { |
| 80 | double onsetTime = /* ... */ 0.0; |
| 81 | double offsetTime = /* ... */ 3.0; |
| 82 | double amplitude = /* ... */ 1.0; |
| 83 | autoFujisakiCommand phraseCommand = FujisakiCommand_createcxx . . $ FujisakiCommand_create(27326c7f24c4d9af). (onsetTime, offsetTime, amplitude); |
| 84 | thycxx . . $ `melder/melder.h:45:9`! phraseCommands. addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (phraseCommandcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).()); |
| 85 | } |
| 86 | if (intermediate1) *intermediate1 =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 87 | /* |
| 88 | * Get accent commands. |
| 89 | */ |
| 90 | while (/* ... */ 0) { |
| 91 | double onsetTime = /* ... */ 0.0; |
| 92 | double offsetTime = /* ... */ 3.0; |
| 93 | double amplitude = /* ... */ 1.0; |
| 94 | autoFujisakiCommand accentCommand = FujisakiCommand_createcxx . . $ FujisakiCommand_create(27326c7f24c4d9af). (onsetTime, offsetTime, amplitude); |
| 95 | thycxx . . $ `melder/melder.h:45:9`! accentCommands. addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (accentCommandcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).()); |
| 96 | } |
| 97 | if (intermediate2) *intermediate2 =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 98 | /* |
| 99 | * Do some extra processing. |
| 100 | */ |
| 101 | /* ... */ |
| 102 | if (intermediate3) *intermediate3 =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 103 | /* |
| 104 | * Tidy up. |
| 105 | */ |
| 106 | for (integercxx . . $ integer# i = 1; i <= thycxx . . $ `melder/melder.h:45:9`! phraseCommands.sizecxx . . $ CollectionOf#size.; i ++) { |
| 107 | FujisakiCommand phraseCommand = thycxx . . $ `melder/melder.h:45:9`! phraseCommands.atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 108 | /* ... */ |
| 109 | } |
| 110 | for (integercxx . . $ integer# i = 1; i <= thycxx . . $ `melder/melder.h:45:9`! accentCommands.sizecxx . . $ CollectionOf#size.; i ++) { |
| 111 | FujisakiCommand accentCommand = thycxx . . $ `melder/melder.h:45:9`! accentCommands.atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 112 | /* ... */ |
| 113 | } |
| 114 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 115 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 116 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to FujisakiPitch."); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | /* End of file FujisakiPitch.cpp */ |