| 1 | /* DurationTier.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2008,2010-2012,2015-2018,2020-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 "DurationTier.h"cxx . . $ `<file>/fon/DurationTier.h`/ |
| 20 | |
| 21 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (DurationTier, RealTier, 0); |
| 22 | |
| 23 | void structDurationTiercxx . . $ structDurationTier# :: v1_infocxx . . $ structDurationTier#v1_info(49f6e7a06ebc5aa8). () { |
| 24 | ourcxx . . $ `melder/melder.h:42:9`! structDaatacxx . . $ structDaata# :: v1_infocxx . . $ structThing#v1_info(49f6e7a06ebc5aa8). (); |
| 25 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Time domain:"); |
| 26 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Start time: ", ourcxx . . $ `melder/melder.h:42:9`! xmincxx . . $ structFunction#xmin., U" seconds"); |
| 27 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" End time: ", ourcxx . . $ `melder/melder.h:42:9`! xmaxcxx . . $ structFunction#xmax., U" seconds"); |
| 28 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U" Total original duration: ", ourcxx . . $ `melder/melder.h:42:9`! xmaxcxx . . $ structFunction#xmax. - ourcxx . . $ `melder/melder.h:42:9`! xmincxx . . $ structFunction#xmin., U" seconds"); |
| 29 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Number of points: ", ourcxx . . $ `melder/melder.h:42:9`! pointscxx . . $ structRealTier#points..sizecxx . . $ CollectionOf#size.); |
| 30 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Minimum relative duration value: ", RealTier_getMinimumValuecxx . . $ RealTier_getMinimumValue(77f29e426b60f650). (this)); |
| 31 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"Maximum relative duration value: ", RealTier_getMaximumValuecxx . . $ RealTier_getMaximumValue(77f29e426b60f650). (this)); |
| 32 | } |
| 33 | |
| 34 | autoDurationTiercxx . . $ autoDurationTier# DurationTier_createcxx . . $ DurationTier_create(a86647bd247c7eaf). (double tmin, double tmax) { |
| 35 | try { |
| 36 | autoDurationTiercxx . . $ autoDurationTier# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (DurationTier); |
| 37 | RealTier_initcxx . . $ RealTier_init(d84c0874d617a544). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), tmin, tmax); |
| 38 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 39 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 40 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"DurationTier not created."); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | void DurationTier_drawcxx . . $ DurationTier_draw(a9f4bba9dcf93f36). (DurationTiercxx . . $ DurationTier# me, Graphicscxx . . $ Graphics# g, double tmin, double tmax, |
| 45 | double ymin, double ymax, conststring32cxx . . $ conststring32# method, bool garnish) |
| 46 | { |
| 47 | RealTier_drawcxx . . $ RealTier_draw(91d4c8857589b937). (me, g, tmin, tmax, ymin, ymax, garnish, method, U"Relative duration"); |
| 48 | } |
| 49 | |
| 50 | autoDurationTiercxx . . $ autoDurationTier# PointProcess_upto_DurationTiercxx . . $ PointProcess_upto_DurationTier(17ca69b9acd6ee86). (PointProcesscxx . . $ PointProcess# me) { |
| 51 | try { |
| 52 | autoDurationTiercxx . . $ autoDurationTier# thee = DurationTier_createcxx . . $ DurationTier_create(a86647bd247c7eaf). (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin., mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax.); |
| 53 | for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! ntcxx . . $ structPointProcess#nt.; i ++) |
| 54 | RealTier_addPointcxx . . $ RealTier_addPoint(d84c0874d617a544). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! tcxx . . $ structPointProcess#t. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i], 1.0); |
| 55 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 56 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 57 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to DurationTier."); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | autoDurationTiercxx . . $ autoDurationTier# RealTier_to_DurationTiercxx . . $ RealTier_to_DurationTier(8304911fd5de3757). (RealTiercxx . . $ RealTier# me) { |
| 62 | try { |
| 63 | autoDurationTiercxx . . $ autoDurationTier# thee = Thing_newcxx . . $ `sys/Thing.h:514:9`! (DurationTier); |
| 64 | mycxx . . $ `melder/melder.h:44:9`! structRealTiercxx . . $ structRealTier# :: v1_copycxx . . $ structRealTier#v1_copy(42659c2335f2eda7). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 65 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 66 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 67 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to DurationTier."); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | /* End of file DurationTier.cpp */ |