Exemplo n.º 1
0
        /// <summary>
        /// Sets an ornament having the shape and number of elements in the ornamentEnvelope.
        /// If ornamentEnvelope == null, BasicMidiChords[0] is set to the NotatedMidiChord.
        /// using the NotatedMidiPitches as the first chord.
        /// Uses the current Gamut.
        /// Replaces any existing ornament.
        /// Sets the OrnamentNumberSymbol to the number of BasicMidiChordDefs.
        /// </summary>
        /// <param name="ornamentEnvelope"></param>
        public void SetOrnament(Gamut gamut, Envelope ornamentEnvelope)
        {
            Debug.Assert(gamut != null);
            List<int> basicMidiChordRootPitches = gamut.PitchSequence(_notatedMidiPitches[0], ornamentEnvelope);
            // If ornamentEnvelope is null, basicMidiChordRootPitches will only contain rootNotatedpitch.

            BasicMidiChordDefs = new List<BasicMidiChordDef>();
            foreach(int rootPitch in basicMidiChordRootPitches)
            {
                BasicMidiChordDef bmcd = new BasicMidiChordDef(1000, gamut, rootPitch, _notatedMidiPitches.Count);
                BasicMidiChordDefs.Add(bmcd);
            }
            this.MsDuration = _msDuration; // resets the BasicMidiChordDef msDurations.

            if(basicMidiChordRootPitches.Count > 1)
            {
                _ornamentNumberSymbol = basicMidiChordRootPitches.Count;
            }
        }