/// <summary> /// Gets an instance of the <see cref="NoteOffEvent"/> corresponding to the specified /// General Sound 'Power' percussion. /// </summary> /// <param name="percussion"><see cref="GeneralSoundPowerPercussion"/> to get an event for.</param> /// <param name="velocity">Velocity of the <see cref="NoteOffEvent"/>.</param> /// <param name="channel">Channel an event should be created for.</param> /// <returns>An instance of the <see cref="NoteOffEvent"/> corresponding to the specified /// <paramref name="percussion"/>.</returns> /// <exception cref="InvalidEnumArgumentException"><paramref name="percussion"/> specified an invalid value.</exception> public static NoteOffEvent GetNoteOffEvent(this GeneralSoundPowerPercussion percussion, SevenBitNumber velocity, FourBitNumber channel) { ThrowIfArgument.IsInvalidEnumValue(nameof(percussion), percussion); return(new NoteOffEvent(percussion.AsSevenBitNumber(), velocity) { Channel = channel }); }
/// <summary> /// Converts <see cref="GeneralSoundPowerPercussion"/> to the corresponding value of the /// <see cref="SevenBitNumber"/> type. /// </summary> /// <param name="percussion"><see cref="GeneralSoundPowerPercussion"/> to convert to <see cref="SevenBitNumber"/>.</param> /// <returns><see cref="SevenBitNumber"/> representing the <paramref name="percussion"/>.</returns> /// <exception cref="InvalidEnumArgumentException"><paramref name="percussion"/> specified an invalid value.</exception> public static SevenBitNumber AsSevenBitNumber(this GeneralSoundPowerPercussion percussion) { ThrowIfArgument.IsInvalidEnumValue(nameof(percussion), percussion); return((SevenBitNumber)(byte)percussion); }