Ejemplo n.º 1
0
        /// <summary>
        /// Gets an instance of the <see cref="NoteOffEvent"/> corresponding to the specified
        /// General Sound 'CM-64/CM-32L' percussion.
        /// </summary>
        /// <param name="percussion"><see cref="GeneralSoundCm6432LPercussion"/> 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 GeneralSoundCm6432LPercussion percussion, SevenBitNumber velocity, FourBitNumber channel)
        {
            ThrowIfArgument.IsInvalidEnumValue(nameof(percussion), percussion);

            return(new NoteOffEvent(percussion.AsSevenBitNumber(), velocity)
            {
                Channel = channel
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converts <see cref="GeneralSoundCm6432LPercussion"/> to the corresponding value of the
        /// <see cref="SevenBitNumber"/> type.
        /// </summary>
        /// <param name="percussion"><see cref="GeneralSoundCm6432LPercussion"/> 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 GeneralSoundCm6432LPercussion percussion)
        {
            ThrowIfArgument.IsInvalidEnumValue(nameof(percussion), percussion);

            return((SevenBitNumber)(byte)percussion);
        }