Example #1
0
        GetLyrics(List <MidiTrack> tracks)
        {
            bool hasLyrics = false;

            List <LyricSymbol>[] result = new List <LyricSymbol> [tracks.Count];
            for (int tracknum = 0; tracknum < tracks.Count; tracknum++)
            {
                MidiTrack track = tracks[tracknum];
                if (track.Lyrics == null)
                {
                    continue;
                }
                hasLyrics        = true;
                result[tracknum] = new List <LyricSymbol>();
                foreach (MidiEvent ev in track.Lyrics)
                {
                    String      text = UTF8Encoding.UTF8.GetString(ev.Value, 0, ev.Value.Length);
                    LyricSymbol sym  = new LyricSymbol(ev.StartTime, text);
                    result[tracknum].Add(sym);
                }
            }
            if (!hasLyrics)
            {
                return(null);
            }
            else
            {
                return(result);
            }
        }
Example #2
0
 /** Get the lyrics for each track */
 private static List<LyricSymbol>[] GetLyrics(List<MidiTrack> tracks)
 {
     bool hasLyrics = false;
     List<LyricSymbol>[] result = new List<LyricSymbol>[tracks.Count];
     for (int tracknum = 0; tracknum < tracks.Count; tracknum++) {
     MidiTrack track = tracks[tracknum];
     if (track.Lyrics == null) {
         continue;
     }
     hasLyrics = true;
     result[tracknum] = new List<LyricSymbol>();
     foreach (MidiEvent ev in track.Lyrics) {
         String text = UTF8Encoding.UTF8.GetString(ev.Value, 0, ev.Value.Length);
         LyricSymbol sym = new LyricSymbol(ev.StartTime, text);
         result[tracknum].Add(sym);
     }
     }
     if (!hasLyrics) {
     return null;
     }
     else {
     return result;
     }
 }