public static void CreateWeights(Stream weights, ChartFormat chartformat)
        {
            EndianReader writer = new EndianReader(weights, Endianness.LittleEndian);

            NoteChart chart = chartformat.Chart;
            //if (chart.PartVocals == null)
            //	return;

            ulong duration = chart.GetTime(chart.FindLastNote());

            for (ulong i = 0; i < 60 * duration / 1000000; i++)
            {
                //for (ulong i = 0; i < 0x100; i++)
                //writer.Write((byte)0x00);
                writer.Write((byte)0x90);
            }

            /* foreach (var lyric in chart.PartVocals.Lyrics) {
             *      if (!lyric.Value.EndsWith("#") && !lyric.Value.EndsWith("^"))
             *              continue;
             *
             *      var gem = chart.PartVocals.Gems.FirstOrDefault(g => g.Time == lyric.Key.Time);
             *      if (gem == null)
             *              continue;
             *
             *      ulong time = chart.GetTime(gem.Time);
             *      time = 60 * time / 1000000;
             *      for (ulong i = (ulong)writer.Position; i < time; i++)
             *              writer.Write((byte)0xFE);
             *      ulong duration = chart.GetTimeDuration(gem.Time, gem.Duration);
             *      for (ulong i = 0; i < duration; i += 1000000/60)
             *              writer.Write((byte)0x90);
             * } */
        }
Example #2
0
        private void DecodeChartVocalPhrases(SongData song, QbFile qbchart, Notes notes, NoteChart chart)
        {
            uint[]         values     = GetChartValues(notes, qbchart, QbKey.Create(0x032292A7), QbKey.Create(song.ID + "_vocals_phrases"), 4, 1);
            NoteChart.Note lastvnote  = null;
            bool           altvphrase = false;
            int            odcounter  = 1;
            ulong          lastvtime  = 0;

            for (int k = 0; k < values.Length; k += 2)
            {
                if (lastvnote != null)
                {
                    lastvnote.Duration = chart.GetTicksDuration(lastvtime, values[k] - lastvtime) - 1;
                }

                lastvtime = values[k];
                lastvnote = new NoteChart.Note(chart.GetTicks(lastvtime));

                odcounter++;
                odcounter %= 4;
                if (odcounter == 0)
                {
                    chart.PartVocals.Overdrive.Add(lastvnote);
                }

                if (altvphrase)
                {
                    chart.PartVocals.Player2.Add(lastvnote);
                }
                else
                {
                    chart.PartVocals.Player1.Add(lastvnote);
                }
                altvphrase = !altvphrase;
            }
            if (lastvnote != null)
            {
                lastvnote.Duration = chart.FindLastNote() - lastvnote.Time;
            }

            uint[][] jaggedvalues = GetJaggedChartValues(notes, qbchart, QbKey.Create("vocalstarpower"), QbKey.Create("vocalstarpower"), 4, 2);
            if (jaggedvalues != null)
            {
                foreach (uint[] star in jaggedvalues)
                {
                    chart.PartVocals.Overdrive.Add(new NoteChart.Note(chart.GetTicks(star[0]), chart.GetTicksDuration(star[0], star[1])));
                }
            }
        }
        public static void CreatePan(Stream pan, ChartFormat chartformat)
        {
            EndianReader writer = new EndianReader(pan, Endianness.LittleEndian);

            NoteChart chart = chartformat.Chart;
            //if (chart.PartVocals == null)
            //	return;

            ulong duration = chart.GetTime(chart.FindLastNote());

            for (ulong i = 0; i < 8 * 60 * duration / 1000000; i++)
            {
                //for (ulong i = 0; i < 0x100; i++)
                //writer.Write((byte)0x00);
                writer.Write((byte)0xFF);
            }
        }
Example #4
0
        public static void FillSections(NoteChart chart, int length, int gap, int start, List <NoteChart.Note> notes, List <NoteChart.Note> overlap)
        {
            Midi.TimeSignatureEvent previous = new Midi.TimeSignatureEvent(0, 4, 0, 0, 0);
            Midi.TimeSignatureEvent next;
            int   index = -1;
            ulong time  = chart.FindLastNote();
            long  t2;

            while (time > 0)
            {
                try {
                    next = chart.Signature[++index];
                } catch (ArgumentOutOfRangeException) {
                    next = new Midi.TimeSignatureEvent(ulong.MaxValue, 4, 0, 0, 0);
                }

                long measuresize = chart.Division.TicksPerBeat * (long)previous.Numerator;

                t2 = (long)Math.Min(next.Time - previous.Time, time);
                for (long t1 = measuresize * start; t2 - t1 >= measuresize * length; t1 += measuresize * gap)
                {
                    bool           collide = false;
                    NoteChart.Note note    = new NoteChart.Note(previous.Time + (ulong)t1, (ulong)measuresize * (ulong)length);
                    if (overlap != null)
                    {
                        foreach (NoteChart.Note n in overlap)
                        {
                            if (note.IsUnderNote(n, true))
                            {
                                collide = true;
                                break;
                            }
                        }
                    }
                    if (!collide)
                    {
                        notes.Add(note);
                    }
                }
                time -= (ulong)t2;

                previous = next;
            }
        }