/// <summary> /// Gets an instance of the <see cref="NoteOffEvent"/> corresponding to the specified /// General Sound 'SFX' percussion. /// </summary> /// <param name="percussion"><see cref="GeneralSoundSfxPercussion"/> 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 GeneralSoundSfxPercussion percussion, SevenBitNumber velocity, FourBitNumber channel) { ThrowIfArgument.IsInvalidEnumValue(nameof(percussion), percussion); return(new NoteOffEvent(percussion.AsSevenBitNumber(), velocity) { Channel = channel }); }
/// <summary> /// Converts <see cref="GeneralSoundSfxPercussion"/> to the corresponding value of the /// <see cref="SevenBitNumber"/> type. /// </summary> /// <param name="percussion"><see cref="GeneralSoundSfxPercussion"/> 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 GeneralSoundSfxPercussion percussion) { ThrowIfArgument.IsInvalidEnumValue(nameof(percussion), percussion); return((SevenBitNumber)(byte)percussion); }