コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Note"/> with the specified
        /// note number, length and absolute time.
        /// </summary>
        /// <param name="noteNumber">Number of the note (60 is middle C).</param>
        /// <param name="length">Length of the note in units defined by time division of a MIDI file.</param>
        /// <param name="time">Absolute time of the note in units defined by the time division of a MIDI file.</param>
        public Note(SevenBitNumber noteNumber, long length, long time)
        {
            _note = MusicTheory.Note.Get(noteNumber);

            Length = length;
            Time = time;
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NoteDescriptor"/> with the specified note,
        /// velocity and length.
        /// </summary>
        /// <param name="note">Note.</param>
        /// <param name="velocity">Velocity of the note.</param>
        /// <param name="length">Length of the note.</param>
        /// <exception cref="ArgumentNullException">
        /// <para>One of the following errors occured:</para>
        /// <list type="bullet">
        /// <item>
        /// <description><paramref name="note"/> is <c>null</c>.</description>
        /// </item>
        /// <item>
        /// <description><paramref name="length"/> is <c>null</c>.</description>
        /// </item>
        /// </list>
        /// </exception>
        public NoteDescriptor(MusicTheory.Note note, SevenBitNumber velocity, ITimeSpan length)
        {
            ThrowIfArgument.IsNull(nameof(note), note);
            ThrowIfArgument.IsNull(nameof(length), length);

            Note     = note;
            Velocity = velocity;
            Length   = length;
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Note"/> with the specified
        /// Note On and Note Off timed events.
        /// </summary>
        /// <param name="timedNoteOnEvent">Wrapped <see cref="NoteOnEvent"/>.</param>
        /// <param name="timedNoteOffEvent">Wrapped <see cref="NoteOffEvent"/>.</param>
        internal Note(TimedEvent timedNoteOnEvent, TimedEvent timedNoteOffEvent)
        {
            Debug.Assert(timedNoteOnEvent != null);
            Debug.Assert(timedNoteOnEvent.Event is NoteOnEvent, "Timed event doesn't wrap a Note On event.");

            Debug.Assert(timedNoteOffEvent != null);
            Debug.Assert(timedNoteOffEvent.Event is NoteOffEvent, "Timed event doesn't wrap a Note Off event.");

            //

            var noteOnEvent = (NoteOnEvent)timedNoteOnEvent.Event;
            var noteOffEvent = (NoteOffEvent)timedNoteOffEvent.Event;

            TimedNoteOnEvent = timedNoteOnEvent;
            TimedNoteOffEvent = timedNoteOffEvent;

            _note = MusicTheory.Note.Get(noteOnEvent.NoteNumber);

            Velocity = noteOnEvent.Velocity;
            OffVelocity = noteOffEvent.Velocity;
            Channel = noteOnEvent.Channel;
        }
コード例 #4
0
ファイル: Note.cs プロジェクト: joschemd/drywetmidi
 /// <summary>
 /// Sets note name and octave for current <see cref="Note"/>.
 /// </summary>
 /// <param name="noteName">Name of the note.</param>
 /// <param name="octave">Number of the octave in scientific pitch notation.</param>
 /// <remarks>
 /// Octave number is specified in scientific pitch notation which means that 4 must be
 /// passed to <paramref name="octave"/> to get the number of the middle C.
 /// </remarks>
 /// <exception cref="InvalidEnumArgumentException"><paramref name="noteName"/> specified an
 /// invalid value.</exception>
 /// <exception cref="ArgumentException">Note number is out of range for the specified note
 /// name and octave.</exception>
 public void SetNoteNameAndOctave(NoteName noteName, int octave)
 {
     UnderlyingNote = MusicTheory.Note.Get(noteName, octave);
 }
コード例 #5
0
 public AddNoteAction(MusicTheory.Note note, SevenBitNumber velocity, ITimeSpan length)
 {
     Note     = note;
     Velocity = velocity;
     Length   = length;
 }
コード例 #6
0
 public NoteDescriptor(MusicTheory.Note note, SevenBitNumber velocity, ITimeSpan length)
 {
     Note     = note;
     Velocity = velocity;
     Length   = length;
 }