/// <summary> /// Initializes a new instance of the <see cref="Note"/> with the specified /// note name, octave, length and absolute time. /// </summary> /// <param name="noteName">Name of the note.</param> /// <param name="octave">Number of the octave in scientific pitch notation.</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> /// <remarks> /// Octave number is specified in scientific pitch notation which means that 4 must be /// passed to <paramref name="octave"/> to get 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 Note(NoteName noteName, int octave, long length, long time) : this(NoteUtilities.GetNoteNumber(noteName, octave)) { Length = length; Time = time; }
/// <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) { NoteNumber = NoteUtilities.GetNoteNumber(noteName, octave); }
/// <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 = NoteUtilities.GetNoteNumber(noteName, octave); }
public NoteInfo(NoteName noteName, int octave, ITimeSpan time, ITimeSpan length, SevenBitNumber velocity) : this(NoteUtilities.GetNoteNumber(noteName, octave), time, length, velocity) { }
/// <summary> /// Returns a <see cref="NoteDefinition"/> for the specified note name and octave number. /// </summary> /// <param name="noteName">The name of a note.</param> /// <param name="octave">The octave number.</param> /// <returns>A <see cref="NoteDefinition"/> for the <paramref name="noteName"/> and <paramref name="octave"/>.</returns> /// <remarks> /// Octave number is specified in scientific pitch notation which means that 4 must be /// passed to <paramref name="octave"/> to get the middle C definition. /// </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 static NoteDefinition Get(NoteName noteName, int octave) { return(Get(NoteUtilities.GetNoteNumber(noteName, octave))); }