qreal StaffTypeTablature::chordStemLength(const Chord *chord) const { qreal stemLen; // if stems are through staff, length is from fartest note to a fixed point aboe/below staff if (stemThrough()) stemLen = stemsDown() ? STAFFTYPE_TAB_DEFAULTSTEMLEN_DN + STAFFTYPE_TAB_DEFAULTSTEMDIST_DN + (_lines-1 - chord->upString()) * _lineDistance.val() : STAFFTYPE_TAB_DEFAULTSTEMLEN_UP + STAFFTYPE_TAB_DEFAULTSTEMDIST_UP + chord->downString() * _lineDistance.val(); // if stems beside staff, length is fixed, but take into account shorter half note stems else { bool shrt = (minimStyle() == TAB_MINIM_SHORTER) && (chord->durationType().type() == TDuration::V_HALF); stemLen = (stemsDown() ? STAFFTYPE_TAB_DEFAULTSTEMLEN_DN : STAFFTYPE_TAB_DEFAULTSTEMLEN_UP) * (shrt ? 0.5 : 1.0); } return stemLen; }
QPointF StaffTypeTablature::chordStemPos(const Chord *chord) const { qreal y; qreal delta = // displacement for half note stems (if used) // if half notes have not a short stem OR not a half note => 0 (minimStyle() != TAB_MINIM_SHORTER || chord->durationType().type() != TDuration::V_HALF) ? 0.0 : // if stems are up, displace of half stem length down (positive) // if stems are down, displace of half stem length up (negative) (stemsDown() ? STAFFTYPE_TAB_DEFAULTSTEMLEN_DN : -STAFFTYPE_TAB_DEFAULTSTEMLEN_UP) * 0.5; // if stems are through staff, stem goes from fartest note string if (stemThrough()) y = (stemsDown() ? chord->upString() : chord->downString()) * _lineDistance.val(); else // if stems beside staff, position are fixed, but take into account delta y = (stemsDown() ? (_lines-1)*_lineDistance.val() + STAFFTYPE_TAB_DEFAULTSTEMPOSY_DN : STAFFTYPE_TAB_DEFAULTSTEMPOSY_UP) + delta; return QPointF(STAFFTYPE_TAB_DEFAULTSTEMPOSX, y); }
qreal StaffType::chordStemLength(const Chord* chord) const { qreal stemLen; // if stems are through staff, length should be computed by relevant chord algorithm; // here, just return default length (= 1 'octave' = 3.5 line spaces) if (stemThrough()) return STAFFTYPE_TAB_DEFAULTSTEMLEN_THRU * _lineDistance.val(); // if stems beside staff, length is fixed, but take into account shorter half note stems else { bool shrt = (minimStyle() == TablatureMinimStyle::SHORTER) && (chord->durationType().type() == TDuration::DurationType::V_HALF); stemLen = (stemsDown() ? STAFFTYPE_TAB_DEFAULTSTEMLEN_DN : STAFFTYPE_TAB_DEFAULTSTEMLEN_UP) * (shrt ? STAFFTYPE_TAB_SHORTSTEMRATIO : 1.0) * chord->mag(); } return stemLen; }
QPointF StaffTypeTablature::chordStemPosBeam(const Chord *chord) const { qreal y = ( stemsDown() ? chord->downString() : chord->upString() ) * _lineDistance.val(); return QPointF(STAFFTYPE_TAB_DEFAULTSTEMPOSX, y); }
QPointF StaffType::chordStemPosBeam(const Chord* chord) const { qreal y = ( stemsDown() ? chord->downString() : chord->upString() ) * _lineDistance.val(); return QPointF(chordStemPosX(chord), y); }