Exemple #1
0
        public Showlights Genegate(string xmlFile)
        {
            var midiNotes  = new List <Showlight>();
            var chordNotes = new List <Showlight>();
            var ShowL      = new Showlights();
            var song       = Song2014.LoadFromFile(xmlFile);

            // If vocals
            if (song.Phrases == null || song.Tuning == null)
            {
                return(null);
            }
            //Generate ShowlightList
            var tuning = song.Tuning.ToShortArray();

            if (song.Levels != null)
            {
                foreach (var lvl in song.Levels)
                {
                    for (int i = 0; i + 1 <= lvl.Notes.Count(); i++)
                    {
                        var mNote = Sng2014FileWriter.GetMidiNote(tuning,
                                                                  (Byte)lvl.Notes[i].String,
                                                                  (Byte)lvl.Notes[i].Fret,
                                                                  song.Arrangement == "Bass",
                                                                  song.Capo);

                        midiNotes.Add(new Showlight()
                        {
                            Time = lvl.Notes[i].Time, Note = mNote
                        });
                    }
                    for (int i = 0; i + 1 <= lvl.Chords.Count(); i++)
                    {
                        if (lvl.Chords[i].HighDensity == 1)
                        {
                            continue; //speedhack
                        }
                        int mNote = Sng2014FileWriter.getChordNote(tuning,
                                                                   lvl.Chords[i], song.ChordTemplates,
                                                                   song.Arrangement == "Bass",
                                                                   song.Capo);

                        chordNotes.Add(new Showlight()
                        {
                            Time = lvl.Chords[i].Time, Note = mNote
                        });
                    }
                }
            }

            ShowL.PopShList(midiNotes);
            ShowL.PopShList(chordNotes);
            ShowL.Count = ShowL.ShowlightList.Count;

            return(ShowL);
        }
Exemple #2
0
        /// <summary>
        /// Showlights Generator Rev3
        /// using arrangement and level with most notes and chords
        /// </summary>
        /// <param name="xmlFile">Xml file.</param>
        private void Generate(string xmlFile, int maxLevelNdx)
        {
            var midiNotes  = new List <Showlight>();
            var chordNotes = new List <Showlight>();
            var song       = Song2014.LoadFromFile(xmlFile);

            // error checking
            if (song.Phrases == null || song.Levels == null || song.Tuning == null)
            {
                throw new Exception("Arrangement: " + xmlFile + Environment.NewLine +
                                    "Contains no phrases, levels and/or tuning.");
            }

            // tuning used to get proper midi notes
            var tuning = song.Tuning.ToArray();

            foreach (var note in song.Levels[maxLevelNdx].Notes)
            {
                // make showlights changes occure on the beat/measure
                var measOffset = song.Ebeats.Where(eb => eb.Measure != -1 && eb.Time <= note.Time).Last();
                // forcing midi notes for guitar gives more consistent results even with bass arrangements
                var mNote = Sng2014FileWriter.GetMidiNote(tuning, (Byte)note.String, (Byte)note.Fret, false, song.Capo);
                // varying midi notes gives more color changes
                // var mNote = Sng2014FileWriter.GetMidiNote(tuning, (Byte)note.String, (Byte)note.Fret, song.Arrangement == "Bass", song.Capo);
                midiNotes.Add(new Showlight {
                    Time = measOffset.Time, Note = mNote
                });
            }

            foreach (var chord in song.Levels[maxLevelNdx].Chords)
            {
                if (chord.HighDensity == 1)
                {
                    continue; //speedhack
                }
                // make showlights occure on the beat/measure
                var measOffset = song.Ebeats.Where(eb => eb.Measure != -1 && eb.Time <= chord.Time).Last();
                // forcing midi notes for guitar gives more consistent results even with bass arrangements
                var mNote = Sng2014FileWriter.getChordNote(tuning, chord, song.ChordTemplates, false, song.Capo);
                // varying midi notes gives more color changes
                //var mNote = Sng2014FileWriter.getChordNote(tuning, chord, song.ChordTemplates, song.Arrangement == "Bass", song.Capo);
                chordNotes.Add(new Showlight {
                    Time = measOffset.Time, Note = mNote
                });
            }

            ShowlightList = new List <Showlight>();
            AddShowlights(midiNotes);
            AddShowlights(chordNotes);
        }
Exemple #3
0
        /// <summary>
        /// Showlights Generator Rev2
        /// max difficulty with most notes and chords
        /// </summary>
        /// <param name="xmlFile">Xml file.</param>
        public Showlights Generate(string xmlFile)
        {
            var midiNotes  = new List <Showlight>();
            var chordNotes = new List <Showlight>();
            var song       = Song2014.LoadFromFile(xmlFile);

            // If vocals
            if (song.Phrases == null || song.Tuning == null)
            {
                return(null);
            }
            //Generate ShowlightList
            var tuning = song.Tuning.ToArray();

            if (song.Levels != null)
            {
                var mf     = new ManifestFunctions(GameVersion.RS2014);
                int maxDif = mf.GetMaxDifficulty(song);

                for (int i = 0; i < song.Levels[maxDif].Notes.Length; i++)
                {
                    var mNote = Sng2014FileWriter.GetMidiNote(tuning, (Byte)song.Levels[maxDif].Notes[i].String, (Byte)song.Levels[maxDif].Notes[i].Fret, song.Arrangement == "Bass", song.Capo);
                    midiNotes.Add(new Showlight {
                        Time = song.Levels[maxDif].Notes[i].Time, Note = mNote
                    });
                }

                for (int i = 0; i < song.Levels[maxDif].Chords.Length; i++)
                {
                    if (song.Levels[maxDif].Chords[i].HighDensity == 1)
                    {
                        continue; //speedhack
                    }
                    int mNote = Sng2014FileWriter.getChordNote(tuning, song.Levels[maxDif].Chords[i], song.ChordTemplates, song.Arrangement == "Bass", song.Capo);
                    chordNotes.Add(new Showlight {
                        Time = song.Levels[maxDif].Chords[i].Time, Note = mNote
                    });
                }
            }

            PopShList(midiNotes);
            PopShList(chordNotes);

            return(this);
        }