Exemple #1
0
void CSongState::AssignToSection(CIntRange BeatRange, int SectionIdx)
{
	CIntRange	ChordRange, Offset;
	ChordRange = FindChordRange(BeatRange, Offset);
	// for each chord in range
	for (int iChord = ChordRange.Start; iChord <= ChordRange.End; iChord++)
		m_SectionMap[iChord] = SectionIdx;	// assign chord to section
	MakeSections();	// rebuild sections from section map
}
Exemple #2
0
void CSongState::MergeImplicitSections()
{
	int	iImplicit = m_Section.FindImplicit();	// find first implicit section
	if (iImplicit < 0)	// if no implicit sections exist
		return;	// nothing to do
	int	nChords = GetChordCount();
	for (int iChord = 0; iChord < nChords; iChord++) {	// for each chord
		// if chord belongs to any implicit section
		if (m_Section[m_SectionMap[iChord]].Implicit())
			m_SectionMap[iChord] = iImplicit;	// assign it to first implicit section
	}
	MakeSections();	// rebuild sections from section map
}
Exemple #3
0
   void CELF2MAC<ELFSTRUCTURES,MACSTRUCTURES>::Convert() {
   // Do the conversion
   // Some compilers require this-> for accessing members of template base class,
   // according to the so-called two-phase lookup rule.

   // Call the subfunctions
   ToFile.SetFileType(FILETYPE_MACHO_LE);             // Set type of new file
   MakeFileHeader();                                  // Make file header
   MakeSectionsIndex();                               // Make sections index translation table
   FindUnusedSymbols();                               // Check if symbols used, remove unused symbols
   MakeSymbolTable();                                 // Make symbol table and string tables
   MakeSections();                                    // Make sections and relocation tables
   MakeBinaryFile();                                  // Put sections together
   *this << ToFile;                                   // Take over new file buffer
}
Exemple #4
0
bool CSongState::ChangeLength(CIntRange& BeatRange, double Scale)
{
	CIntRange	ChordRange, Offset;
	ChordRange = FindChordRange(BeatRange, Offset);
	bool	RoundingError = FALSE;
	int	NewSelDur = 0;
	for (int iChord = ChordRange.Start; iChord <= ChordRange.End; iChord++) {
		CSong::CChord&	ch = m_Chord[iChord];
		double	fDur = ch.m_Duration * Scale;	// scale chord duration
		int	iDur = round(fDur);	// chord durations are stored as integers
		if (fabs(iDur - fDur) > .01)	// if rounding error exceeds +/- 1%
			RoundingError = TRUE;	// set flag
		iDur = max(iDur, 1);	// enforce minimum duration
		ch.m_Duration = iDur;	// update chord duration
		NewSelDur += iDur;	// add duration to selection length
	}
	MakeSections();	// rebuild sections from section map
	// return scaled beat range to caller by overwriting beat range argument
	int	iStartBeat = GetStartBeat(ChordRange.Start);
	BeatRange = CIntRange(iStartBeat, iStartBeat + NewSelDur - 1);
	return(!RoundingError);	// return false if rounding errors occurred
}
Exemple #5
0
void CSongState::OnChordCountChange()
{
	MergeDuplicateChords();
	MakeSections();	// rebuild sections from section map
}