Пример #1
0
        List <MusicSymbol> AddBars(List <ChordSymbol> chords, TimeSignature time,
                                   int lastStart)
        {
            List <MusicSymbol> symbols = new List <MusicSymbol>();

            TimeSigSymbol timesig = new TimeSigSymbol(time.Numerator, time.Denominator);

            symbols.Add(timesig);

            /* The starttime of the beginning of the measure */
            int measuretime = 0;

            int i = 0;

            while (i < chords.Count)
            {
                if (measuretime <= chords[i].StartTime)
                {
                    symbols.Add(new BarSymbol(measuretime));
                    measuretime += time.Measure;
                }
                else
                {
                    symbols.Add(chords[i]);
                    i++;
                }
            }

            /* Keep adding bars until the last StartTime (the end of the song) */
            while (measuretime < lastStart)
            {
                symbols.Add(new BarSymbol(measuretime));
                measuretime += time.Measure;
            }

            /* Add the final vertical bar to the last measure */
            symbols.Add(new BarSymbol(measuretime));
            return(symbols);
        }
Пример #2
0
        /** Add in the vertical bars delimiting measures.
         *  Also, add the time signature symbols.
         */
        private List<MusicSymbol> AddBars(List<ChordSymbol> chords, TimeSignature time,
            int lastStart)
        {
            List<MusicSymbol> symbols = new List<MusicSymbol>();

            TimeSigSymbol timesig = new TimeSigSymbol(time.Numerator, time.Denominator);
            symbols.Add(timesig);

            /* The starttime of the beginning of the measure */
            int measuretime = 0;

            int i = 0;
            while (i < chords.Count) {
            if (measuretime <= chords[i].StartTime) {
                symbols.Add(new BarSymbol(measuretime) );
                measuretime += time.Measure;
            }
            else {
                symbols.Add(chords[i]);
                i++;
            }
            }

            /* Keep adding bars until the last StartTime (the end of the song) */
            while (measuretime < lastStart) {
            symbols.Add(new BarSymbol(measuretime) );
            measuretime += time.Measure;
            }

            /* Add the final vertical bar to the last measure */
            symbols.Add(new BarSymbol(measuretime) );
            return symbols;
        }