/* Artword_Speaker.c */
/* Paul Boersma, February 7, 1999 */

#include "Art_Speaker.h"
#include "Artword_Speaker.h"
#ifdef sgi
	int sginap (long ticks);
#endif

void Artword_Speaker_draw (Artword artword, Speaker speaker, Graphics g, int numberOfSteps) {
	int i;
	double oldLineWidth = Graphics_inqLineWidth (g);
	Art art = Art_create ();
	for (i = 0; i <= numberOfSteps; i ++) {
		Artword_intoArt (artword, art, i * artword -> totalTime / numberOfSteps);
		Graphics_setLineWidth (g, 2 + i + i);
		Art_Speaker_draw (art, speaker, g);
	}
	forget (art);
	Graphics_setLineWidth (g, oldLineWidth);
}

void Artword_Speaker_movie (Artword artword, Speaker speaker, Graphics g) {
	double tim;
	#if defined (sgi)
		double timeStep = 1.0 / 60;
	#else
		double timeStep = 0.00001;
	#endif
	Art art = Art_create ();
	for (tim = 0.0; tim < artword -> totalTime; tim += timeStep) {
		Artword_intoArt (artword, art, tim);
		Graphics_setViewport (g, 0, 1, 0, 1);
		Graphics_clearWs (g);
		Art_Speaker_draw (art, speaker, g);
		Graphics_flushWs (g);
		#ifdef sgi
			sginap (1);
		#endif
	}
}

/* End of file Artword_Speaker.c */
