예제 #1
0
 public RhythmPatternModEnd(RhythmPatternBase pattern, RhythmPatternBase patternEnd)
 {
     Debug.Assert(pattern.BeatsPerMeasure == patternEnd.BeatsPerMeasure);
     Debug.Assert(patternEnd.MeasuresCount < pattern.MeasuresCount);
     this.pattern    = pattern;
     this.patternEnd = patternEnd;
 }
예제 #2
0
 public MelodyAtomic(object[] notes, int bpm = 4)
 {
     Debug.Assert(notes.Length % bpm == 0);
     rhythm     = new RhythmPattern(bpm, notes.Select(obj => obj != null).ToArray());
     this.notes = notes.Where(obj => obj != null).ToArray();
     this.bpm   = bpm;
 }
예제 #3
0
 public MelodyAtomic(RhythmPatternBase rhythm, object[] notes)
 {
     Debug.Assert(rhythm.CountNotes() == notes.Length);
     this.rhythm = rhythm;
     Debug.Assert(notes.Length == rhythm.CountNotes());
     foreach (var note in notes)
     {
         Debug.Assert(note is int || note is Note || note is string);
     }
     this.notes = (object[])notes.Clone();
 }
예제 #4
0
        public MelodyAtomic(RhythmPatternBase rhythm, Random rand)
        {
            int count = rhythm.CountNotes();

            notes = new object[count];

            const int maxInterval = 2;

            for (int i = 0; i < count; i++)
            {
                notes[i] = rand.Next(2 * maxInterval + 1) - maxInterval;
            }
        }
예제 #5
0
 public abstract int CountPattern(RhythmPatternBase pattern);
예제 #6
0
 public override int CountPattern(RhythmPatternBase pattern)
 {
     throw new NotImplementedException();
 }
예제 #7
0
 public override int CountPattern(RhythmPatternBase pattern)
 {
     return(pattern == this ? 1 : 0);
 }
예제 #8
0
 public override int CountPattern(RhythmPatternBase pattern)
 {
     return(patterns.Sum(p => p.CountPattern(pattern)));
 }
예제 #9
0
 public override int CountPattern(RhythmPatternBase pattern)
 {
     return(basePattern.CountPattern(pattern));
 }
예제 #10
0
 public RhythmSectionInverse(RhythmPatternBase pattern)
 {
     basePattern = pattern;
 }