src/tool-chantize.cpp
void Tool_chantize::fixEditorialAccidentals(HumdrumFile& infile) {
	m_pstates.resize(infile.getMaxTrack() + 1);
	m_estates.resize(infile.getMaxTrack() + 1);
	m_kstates.resize(infile.getMaxTrack() + 1);

	for (int i=0; i<(int)m_pstates.size(); i++) {
		m_pstates[i].resize(70);
		fill(m_pstates[i].begin(), m_pstates[i].end(), 0);
		m_kstates[i].resize(70);
		fill(m_kstates[i].begin(), m_kstates[i].end(), 0);
		m_estates[i].resize(70);
		fill(m_estates[i].begin(), m_estates[i].end(), false);
	}

	for (int i=0; i<infile.getLineCount(); i++) {
		if (infile[i].isInterpretation()) {
			updateKeySignatures(infile, i);
			continue;
		} else if (infile[i].isBarline()) {
			clearStates();
			continue;
		} else if (infile[i].isData()) {
			checkDataLine(infile, i);
		}
	}
}
//////////////////////////////
//
// Tool_chantize::fixEditorialAccidentals -- checkDataLine() does
//       all of the work for this function, which only manages
//       key signature and barline processing.
//    Rules for accidentals in Tasso in Music Project:
//    (1) Only note accidentals printed in the source editions
//        are displayed as regular accidentals.  These accidentals
//        are postfixed with an "X" in the **kern data.
//    (2) Editorial accidentals are given an "i" marker but not
//        a "X" marker in the **kern data.  This editorial accidental
//        is displayed above the note.
//    This algorithm makes adjustments to the input data because
//    Sibelius will drop editorial information after the frist
//    editorial accidental on that pitch in the measure.
//    (3) If a note is the same pitch as a previous note in the
//        measure and the previous note has an editorial accidental,
//        then make the note an editorial note.  However, if the
//        accidental state of the note matches the key-signature,
//        then do not add an editorial accidental, and there will be
//        no accidental displayed on the note.  In that case, add a "y"
//        after the accidental to indicate that it is interpreted
//        and not visible in the original score.
//
:fixEditorialAccidentals -- checkDataLine() does
all of the work for this function, which only manages
key signature and barline processing.
Rules for accidentals in Tasso in Music Project:
(1) Only note accidentals printed in the source editions
are displayed as regular accidentals.  These accidentals
are postfixed with an "X" in the **kern data.
(2) Editorial accidentals are given an "i" marker but not
a "X" marker in the **kern data.  This editorial accidental
is displayed above the note.
This algorithm makes adjustments to the input data because
Sibelius will drop editorial information after the frist
editorial accidental on that pitch in the measure.
(3) If a note is the same pitch as a previous note in the
measure and the previous note has an editorial accidental,
then make the note an editorial note.  However, if the
accidental state of the note matches the key-signature,
then do not add an editorial accidental, and there will be
no accidental displayed on the note.  In that case, add a "y"
after the accidental to indicate that it is interpreted
and not visible in the original score.
: fixEditorialAccidentals -- checkDataLine () does all of the work for this function which only manages key signature and barline processing . Rules for accidentals in Tasso in Music Project : ( 1 ) Only note accidentals printed in the source editions are displayed as regular accidentals . These accidentals are postfixed with an " X " in the ** kern data . ( 2 ) Editorial accidentals are given an " i " marker but not a " X " marker in the ** kern data . This editorial accidental is displayed above the note . This algorithm makes adjustments to the input data because Sibelius will drop editorial information after the frist editorial accidental on that pitch in the measure . ( 3 ) If a note is the same pitch as a previous note in the measure and the previous note has an editorial accidental then make the note an editorial note . However if the accidental state of the note matches the key - signature then do not add an editorial accidental and there will be no accidental displayed on the note . In that case add a " y " after the accidental to indicate that it is interpreted and not visible in the original score .
void Tool_chantize::fixEditorialAccidentals(HumdrumFile& infile) {
	m_pstates.resize(infile.getMaxTrack() + 1);
	m_estates.resize(infile.getMaxTrack() + 1);
	m_kstates.resize(infile.getMaxTrack() + 1);
	for (int i=0; i<(int)m_pstates.size(); i++) {
		m_pstates[i].resize(70);
		fill(m_pstates[i].begin(), m_pstates[i].end(), 0);
		m_kstates[i].resize(70);
		fill(m_kstates[i].begin(), m_kstates[i].end(), 0);
		m_estates[i].resize(70);
		fill(m_estates[i].begin(), m_estates[i].end(), false);
	}
	for (int i=0; i<infile.getLineCount(); i++) {
		if (infile[i].isInterpretation()) {
			updateKeySignatures(infile, i);
			continue;
		} else if (infile[i].isBarline()) {
			clearStates();
			continue;
		} else if (infile[i].isData()) {
			checkDataLine(infile, i);
		}
	}
}
void Tool_chantize :: fixEditorialAccidentals ( HumdrumFile & infile ) { m_pstates . resize ( infile . getMaxTrack ( ) + 1 ) ; m_estates . resize ( infile . getMaxTrack ( ) + 1 ) ; m_kstates . resize ( infile . getMaxTrack ( ) + 1 ) ; for ( int i = 0 ; i < ( int ) m_pstates . size ( ) ; i ++ ) { m_pstates [ i ] . resize ( 70 ) ; fill ( m_pstates [ i ] . begin ( ) , m_pstates [ i ] . end ( ) , 0 ) ; m_kstates [ i ] . resize ( 70 ) ; fill ( m_kstates [ i ] . begin ( ) , m_kstates [ i ] . end ( ) , 0 ) ; m_estates [ i ] . resize ( 70 ) ; fill ( m_estates [ i ] . begin ( ) , m_estates [ i ] . end ( ) , false ) ; } for ( int i = 0 ; i < infile . getLineCount ( ) ; i ++ ) { if ( infile [ i ] . isInterpretation ( ) ) { updateKeySignatures ( infile , i ) ; continue ; } else if ( infile [ i ] . isBarline ( ) ) { clearStates ( ) ; continue ; } else if ( infile [ i ] . isData ( ) ) { checkDataLine ( infile , i ) ; } } }
Tool_chantize::fixEditorialAccidentals -- checkDataLine() does
all of the work for this function, which only manages
key signature and barline processing.
Tool_chantize :: fixEditorialAccidentals -- checkDataLine () does all of the work for this function which only manages key signature and barline processing .