Пример #1
0
inline	void	XMLSaver::SaveKeySig(CXMLWriter& writer, const CKeySigObj& obj)
{
	writer.WriteKeyStart(_T("attributes"));
	writer.WriteKeyStart(_T("key"));

		obj.GetChromAlter(m_CA);

		int nCount = 0;
		if ( obj.mSharp )
			nCount = bitcount(obj.mSharp);
		else if ( obj.mFlat )
			nCount = -bitcount(obj.mFlat);

		writer.WriteInteger(_T("fifths"), nCount);

	writer.WriteKeyEnd();
	writer.WriteKeyEnd();
}
Пример #2
0
inline	void	XMLSaver::SaveClef(CXMLWriter& writer, const CClefObj& obj)
{
	writer.WriteKeyStart(_T("attributes"));
	writer.WriteKeyStart(_T("clef"));

		wxChar chSign[2] = {'G', 0};
		int nLine = 2;
		int nClefOctaveChange = 0;
		switch ( obj.mClefType )
		{
		case	0 :	//Treble
			chSign[0] = 'G'; nLine = 2;
			m_CA.clefShift = 0;
			break;
		case	1 :	//Bass
			chSign[0] = 'F'; nLine = 4;
			m_CA.clefShift = 12;
			break;
		case	2 :	//Alto
			chSign[0] = 'C'; nLine = 3;
			m_CA.clefShift = 0;
			break;
		case	3 :	//Tenor
			chSign[0] = 'G'; nLine = 2;
			nClefOctaveChange = -1;
			m_CA.clefShift = 0;
			break;
		}

		writer.WriteString(_T("sign"), chSign);
		writer.WriteInteger(_T("line"), nLine);
		if ( nClefOctaveChange != 0 )
			writer.WriteInteger(_T("clef-octave-change"), nClefOctaveChange);

	writer.WriteKeyEnd();
	writer.WriteKeyEnd();
}