| 1 | /* Artword_Speaker_Sound.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2005,2006,2011,2015-2017,2019 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 "Artword_Speaker_Sound.h"cxx . . $ `<file>/artsynth/Artword_Speaker_Sound.h`/ |
| 20 | #include "Artword_Speaker.h"cxx . . $ `<file>/artsynth/Artword_Speaker.h`/ |
| 21 | #include "Art_Speaker.h"cxx . . $ `<file>/artsynth/Art_Speaker.h`/ |
| 22 | |
| 23 | Thing_definecxx . . $ `sys/Thing.h:60:9`! (Artword_Speaker_Sound_PlayInfo, Thing) { |
| 24 | Artwordcxx . . $ Artword# artwordcxx . . $ structArtword_Speaker_Sound_PlayInfo#artword.; |
| 25 | Speakercxx . . $ Speaker# speakercxx . . $ structArtword_Speaker_Sound_PlayInfo#speaker.; |
| 26 | Graphicscxx . . $ Graphics# graphicscxx . . $ structArtword_Speaker_Sound_PlayInfo#graphics.; |
| 27 | }; |
| 28 | |
| 29 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (Artword_Speaker_Sound_PlayInfo, Thing, 0); |
| 30 | |
| 31 | static int playCallbackcxx . . $ playCallback(aa102997fab2ca24). (Artword_Speaker_Sound_PlayInfocxx . . $ Artword_Speaker_Sound_PlayInfo# me, int /* phase */, double /* tmin */, double /* tmax */, double t) { |
| 32 | static autoArtcxx . . $ autoArt# artcxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).; |
| 33 | if (! art) |
| 34 | art =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Art_createcxx . . $ Art_create(23bf0cc812f7d3d7). (); |
| 35 | Artword_intoArtcxx . . $ Artword_intoArt(f7b57e22445e6228). (mycxx . . $ `melder/melder.h:44:9`! artwordcxx . . $ structArtword_Speaker_Sound_PlayInfo#artword., art.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), t); |
| 36 | Graphics_beginMovieFramecxx . . $ Graphics_beginMovieFrame(39e73bcf122a4f1d). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structArtword_Speaker_Sound_PlayInfo#graphics., & Melder_WHITEcxx . . $ Melder_WHITE.); |
| 37 | Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structArtword_Speaker_Sound_PlayInfo#graphics., 0.0, 1.0, 0.0, 1.0); |
| 38 | Art_Speaker_drawcxx . . $ Art_Speaker_draw(f3b734e345fa3399). (art.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), mycxx . . $ `melder/melder.h:44:9`! speakercxx . . $ structArtword_Speaker_Sound_PlayInfo#speaker., mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structArtword_Speaker_Sound_PlayInfo#graphics.); |
| 39 | Graphics_endMovieFramecxx . . $ Graphics_endMovieFrame(2514a1c07b6be5e2). (mycxx . . $ `melder/melder.h:44:9`! graphicscxx . . $ structArtword_Speaker_Sound_PlayInfo#graphics., 0.0); |
| 40 | return 1; |
| 41 | } |
| 42 | |
| 43 | void Artword_Speaker_Sound_playMoviecxx . . $ Artword_Speaker_Sound_playMovie(143a55b462cb9298). (Artwordcxx . . $ Artword# artword, Speakercxx . . $ Speaker# speaker, Soundcxx . . $ Sound# sound, Graphicscxx . . $ Graphics# graphics) { |
| 44 | try { |
| 45 | static autoArtword_Speaker_Sound_PlayInfocxx . . $ autoArtword_Speaker_Sound_PlayInfo# infocxx . . $ autoSomeThing#autoSomeThing(49f6e7a06ebc5aa8).; |
| 46 | if (! info) |
| 47 | info =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Thing_newcxx . . $ `sys/Thing.h:514:9`! (Artword_Speaker_Sound_PlayInfo); |
| 48 | info ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). artwordcxx . . $ structArtword_Speaker_Sound_PlayInfo#artword. = artword; |
| 49 | info ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). speakercxx . . $ structArtword_Speaker_Sound_PlayInfo#speaker. = speaker; |
| 50 | info ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). graphicscxx . . $ structArtword_Speaker_Sound_PlayInfo#graphics. = graphics; |
| 51 | if (sound) { |
| 52 | Sound_playcxx . . $ Sound_play(8cd75def0156a342). (sound, playCallbackcxx . . $ MelderCallback#MelderCallback(b367fc31b94dacdb)., info.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 53 | } else { |
| 54 | autoSoundcxx . . $ autoSound# silence = Sound_createSimplecxx . . $ Sound_createSimple(fcb03a673f737ce). (1, artword -> totalTimecxx . . $ structArtword#totalTime., 44100.0); |
| 55 | Sound_playcxx . . $ Sound_play(8cd75def0156a342). (silence.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), playCallbackcxx . . $ MelderCallback#MelderCallback(b367fc31b94dacdb)., info.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 56 | } |
| 57 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 58 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (artword, U" & ", speaker, U": movie not played."); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | /* End of file Artword_Speaker_Sound.cpp */ |