1 /* Artword_Speaker.cpp
2  *
3  * Copyright (C) 1992-2005,2011,2015-2017,2019-2021 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 "Art_Speaker.h"
20 #include "Artword_Speaker.h"
21 
Artword_Speaker_draw(Artword artword,Speaker speaker,Graphics graphics,integer numberOfSteps)22 void Artword_Speaker_draw (Artword artword, Speaker speaker, Graphics graphics, integer numberOfSteps) {
23 	const double oldLineWidth = Graphics_inqLineWidth (graphics);
24 	autoArt art = Art_create ();
25 	for (integer i = 0; i <= numberOfSteps; i ++) {
26 		Artword_intoArt (artword, art.get(), i * artword -> totalTime / numberOfSteps);
27 		Graphics_setLineWidth (graphics, 2 + i + i);
28 		Art_Speaker_draw (art.get(), speaker, graphics);
29 	}
30 	Graphics_setLineWidth (graphics, oldLineWidth);
31 }
32 
Artword_Speaker_playMovie(Artword artword,Speaker speaker,Graphics graphics)33 void Artword_Speaker_playMovie (Artword artword, Speaker speaker, Graphics graphics) {
34 	constexpr double timeStep = 0.03;
35 	autoArt art = Art_create ();
36 	for (double tim = 0.0; tim < artword -> totalTime; tim += timeStep) {
37 		Artword_intoArt (artword, art.get(), tim);
38 		Graphics_beginMovieFrame (graphics, & Melder_WHITE);
39 		Graphics_setWindow (graphics, 0.0, 1.0, 0.0, 1.0);
40 		Art_Speaker_draw (art.get(), speaker, graphics);
41 		Graphics_endMovieFrame (graphics, timeStep);
42 	}
43 }
44 
45 /* End of file Artword_Speaker.cpp */
46