示例#1
0
        public override IEnumerable <SoundEvent> Render(RenderParameters parameters, double start)
        {
            var on = new NoteOn(start, parameters.Instrument, this.Frequency);

            yield return(on);

            var off = new NoteOff(start + this.Duration, on);

            yield return(off);

            // Extra octave depends on density
            //if (MusicManager.Random.NextDouble() < parameters.Density) {
            //    var startOctave = new NoteOn(0, parameters.Instrument, this.Frequency * 2, parameters.Volume);
            //    yield return startOctave;
            //    var endOctave = new NoteOff(this.Duration, startOctave);
            //    yield return endOctave;
            //}
        }
示例#2
0
 public NoteOff(double startTime, NoteOn noteOn)
     : base(startTime)
 {
     this.noteOn = noteOn;
 }