Example #1
0
        /// <summary>
        /// Sets the note number of the <see cref="NoteEvent"/> with the specified note name and octave.
        /// </summary>
        /// <param name="noteEvent">Note event to set the note number of.</param>
        /// <param name="noteName">Name of the note.</param>
        /// <param name="octave">Number of the octave.</param>
        /// <remarks>
        /// Octave number is specified in scientific pitch notation which means that 4 must be
        /// passed to get the number of the middle C.
        /// </remarks>
        /// <exception cref="ArgumentNullException"><paramref name="noteEvent"/> is null.</exception>
        /// <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 static void SetNoteNumber(this NoteEvent noteEvent, NoteName noteName, int octave)
        {
            ThrowIfArgument.IsNull(nameof(noteEvent), noteEvent);

            noteEvent.NoteNumber = GetNoteNumber(noteName, octave);
        }
Example #2
0
        /// <summary>
        /// Gets octave of the note presented by the specified <see cref="NoteOnEvent"/>.
        /// </summary>
        /// <param name="noteEvent">Note event to get note octave of.</param>
        /// <returns>Note octave of the <paramref name="noteEvent"/>.</returns>
        /// <remarks>
        /// Octave number will be returned in scientific pitch notation which means
        /// that 4 will be returned for 60 note number.
        /// </remarks>
        /// <exception cref="ArgumentNullException"><paramref name="noteEvent"/> is null.</exception>
        public static int GetNoteOctave(this NoteEvent noteEvent)
        {
            ThrowIfArgument.IsNull(nameof(noteEvent), noteEvent);

            return(GetNoteOctave(noteEvent.NoteNumber));
        }
Example #3
0
        /// <summary>
        /// Gets name of the note presented by the specified <see cref="NoteEvent"/>.
        /// </summary>
        /// <param name="noteEvent">Note event to get note name of.</param>
        /// <returns>Note name of the <paramref name="noteEvent"/>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="noteEvent"/> is null.</exception>
        public static NoteName GetNoteName(this NoteEvent noteEvent)
        {
            ThrowIfArgument.IsNull(nameof(noteEvent), noteEvent);

            return(NoteUtilities.GetNoteName(noteEvent.NoteNumber));
        }
Example #4
0
 // Token: 0x06003482 RID: 13442 RVA: 0x00018223 File Offset: 0x00016423
 public static NoteName GetNoteName(this NoteEvent noteEvent)
 {
     return(NoteUtilities.GetNoteName(noteEvent.NoteNumber));
 }
Example #5
0
 // Token: 0x06003484 RID: 13444 RVA: 0x0001823D File Offset: 0x0001643D
 public static void SetNoteNumber(this NoteEvent noteEvent, NoteName noteName, int octave)
 {
     noteEvent.NoteNumber = NoteUtilities.GetNoteNumber(noteName, octave);
 }
Example #6
0
 // Token: 0x06003483 RID: 13443 RVA: 0x00018230 File Offset: 0x00016430
 public static int GetNoteOctave(this NoteEvent noteEvent)
 {
     return(NoteUtilities.GetNoteOctave(noteEvent.NoteNumber));
 }