Esempio n. 1
0
// ----------------------------------------------------------------------------
TYPE_DURATION GRTempo::getDuration (const char * str) const
{
	int num, denom;
	TYPE_DURATION duration;
	if( sscanf( str,"%d/%d", &num, &denom ) == 2 ) {
		duration.set ( num, denom );
		duration.normalize();
	}
	return duration;
}
Esempio n. 2
0
float GRSpring::calcconst(GRNotationElement * grn)
{
	GRGlue * glue;
	GRTag * tmp;
	if (grn &&
		(glue = dynamic_cast<GRGlue *>(grn)) != NULL)
		sconst = glue->getSConst();
	else if (grn && 
		(tmp = dynamic_cast<GRTag *>(grn)) != NULL)
		sconst = tmp->getSConst();
	else if (dur == DURATION_0) {
		if (dynamic_cast<GREmpty *>(grn))
            sconst = (isProportionalElement ? 1 : 200.0f);
		else
			sconst = (isProportionalElement ? 1 : 20.0f);
	}
	else if (grn && (dynamic_cast<GRRest *>(grn))) {
		// rests are treated as if they were
		// 8 times shorter -> this results
		// in a nicer spacing when rests occur ...
		// this must be adjusted for optimal output!
		TYPE_DURATION mydur;
		if ((float) dur>0.125)
			mydur.set( dur.getNumerator(), dur.getDenominator() * 2);
		else
			mydur = dur;

		sconst = (isProportionalElement ? 1 : defconst(mydur, funcpar));
	}
	else
		sconst = (isProportionalElement ? 1 : defconst(dur, funcpar));

	assert(sconst != 0);

	return sconst;
}