Esempio n. 1
0
 protected override void OnNextBeat(int section, int bar, int beat, double dspTime, double beatTime)
 {
     if (beat == (instrument.noteOffset + 8) % 4)
     {
         double playDspTime = dspTime + System.Math.Abs(0.5 * beatTime * instrument.noteOffset);
         instrument.PlayNote(playDspTime, HarmonicProgression.GetHarmonic(section, bar));
     }
 }
Esempio n. 2
0
    protected override void OnNextBeat(int section, int bar, int beat, double dspTime, double beatTime)
    {
        double relativeBeat = beatOffset - beat;

        if (relativeBeat >= 0.0 && relativeBeat < 1.0)
        {
            double playTime = dspTime + relativeBeat * beatTime;
            instrument.PlayNote(playTime, HarmonicProgression.GetHarmonic(section, bar) + noteOffset);
        }
    }
Esempio n. 3
0
    protected override void OnNextBeat(int section, int bar, int beat, double dspTime, double beatTime)
    {
        SectionType sectionType = SongStructure.GetSection(section);

        if (beat == beatOffset || (sectionType == SectionType.CHORUS && beat == ((beatOffset + 2) % 4)))
        {
            lastNote += RandomNumber.NextInt(-Scale.scaleLength / 4, Scale.scaleLength / 2);
            lastNote  = System.Math.Max(-Scale.scaleLength / 4, System.Math.Min(Scale.scaleLength, lastNote));

            Dictionary <int, int> sectionLines = null;
            if (lines.TryGetValue(sectionType, out sectionLines))
            {
                int key       = bar * numBeats + beat;
                int noteIndex = 0;
                if (!sectionLines.TryGetValue(key, out noteIndex))
                {
                    noteIndex = HarmonicProgression.GetHarmonic(section, bar) + lastNote;
                    sectionLines.Add(key, noteIndex);
                }
                instrument.PlayNote(dspTime, noteIndex, RandomNumber.NextFloat(0.9f, 1.0f));
            }
        }
    }