Exemple #1
0
 /// <summary>
 /// Creates a new Timing Point from the <see cref="Editor_Reader.ControlPoint"/>.
 /// </summary>
 /// <param name="cp">The control point value from <see cref="Editor_Reader"/></param>
 public TimingPoint(Editor_Reader.ControlPoint cp)
 {
     MpB              = cp.BeatLength;
     Offset           = cp.Offset;
     SampleIndex      = cp.CustomSamples;
     SampleSet        = (SampleSet)cp.SampleSet;
     Meter            = new TempoSignature(cp.TimeSignature);
     Volume           = cp.Volume;
     Kiai             = (cp.EffectFlags & 1) > 0;
     OmitFirstBarLine = (cp.EffectFlags & 8) > 0;
     Uninherited      = cp.TimingChange;
 }
Exemple #2
0
 public TimingPoint()
 {
     MpB              = 60000;
     Offset           = 0;
     Meter            = new TempoSignature(4, 4);
     SampleSet        = new SampleSet();
     SampleIndex      = 0;
     Volume           = 100;
     Uninherited      = false;
     Kiai             = false;
     OmitFirstBarLine = false;
 }
Exemple #3
0
 /// <summary>
 /// Creates a new <see cref="TimingPoint"/>
 /// </summary>
 /// <param name="offset">The offset from the start of the audio in milliseconds</param>
 /// <param name="mpb">The milliseconds per beat. (Quarter Note in Music Theory terms.) </param>
 /// <param name="meter">The tempo signature object.</param>
 /// <param name="sampleSet">The <see cref="SampleSet"/> that is used from the timing point</param>
 /// <param name="sampleIndex"></param>
 /// <param name="volume"></param>
 /// <param name="uninherited"></param>
 /// <param name="kiai"></param>
 /// <param name="omitFirstBarLine"></param>
 public TimingPoint(double offset, double mpb, TempoSignature meter, SampleSet sampleSet, int sampleIndex, double volume, bool uninherited, bool kiai, bool omitFirstBarLine)
 {
     Offset           = offset;
     MpB              = mpb;
     Meter            = meter;
     SampleSet        = sampleSet;
     SampleIndex      = sampleIndex;
     Volume           = volume;
     Uninherited      = uninherited;
     Kiai             = kiai;
     OmitFirstBarLine = omitFirstBarLine;
 }
Exemple #4
0
        /// <summary>
        /// Sets a <see cref="TimingPoint"/> from the line of the beatmap file.
        /// </summary>
        /// <param name="line"></param>
        /// <exception cref="BeatmapParsingException">If the beatmap can not be read correctly.</exception>
        public void SetLine(string line)
        {
            string[] values = line.Split(',');

            if (TryParseDouble(values[0], out double offset))
            {
                Offset = offset;
            }
            else
            {
                throw new BeatmapParsingException("Failed to parse offset of timing point", line);
            }

            if (TryParseDouble(values[1], out double mpb))
            {
                MpB = mpb;
            }
            else
            {
                throw new BeatmapParsingException("Failed to parse milliseconds per beat of timing point", line);
            }

            if (TryParseInt(values[2], out int meter))
            {
                Meter = new TempoSignature(meter);
            }
            else
            {
                throw new BeatmapParsingException("Failed to parse meter of timing point", line);
            }

            if (Enum.TryParse(values[3], out SampleSet ss))
            {
                SampleSet = ss;
            }
            else
            {
                throw new BeatmapParsingException("Failed to parse sampleset of timing point", line);
            }

            if (TryParseInt(values[4], out int ind))
            {
                SampleIndex = ind;
            }
            else
            {
                throw new BeatmapParsingException("Failed to parse sample index of timing point", line);
            }

            if (TryParseDouble(values[5], out double vol))
            {
                Volume = vol;
            }
            else
            {
                throw new BeatmapParsingException("Failed to parse volume of timing point", line);
            }

            Uninherited = values[6] == "1";

            if (values.Length <= 7)
            {
                return;
            }
            if (TryParseInt(values[7], out int style))
            {
                BitArray b = new BitArray(new int[] { style });
                Kiai             = b[0];
                OmitFirstBarLine = b[3];
            }
            else
            {
                throw new BeatmapParsingException("Failed to style of timing point", line);
            }
        }