Struct SevenBitNumber
Type that is used to represent a seven-bit number (0-127; or in binary format 0000000-1111111).
Assembly: Melanchall.DryWetMidi.dll
Syntax
public struct SevenBitNumber : IComparable<SevenBitNumber>, IConvertible
Examples
For example, to set a note's number:
var noteOnEvent = new NoteOnEvent();
noteOnEvent.NoteNumber = (SevenBitNumber)100;
or velocity:
var noteOffEvent = new NoteOffEvent(SevenBitNumber.MinValue, (SevenBitNumber)70);
where SevenBitNumber.MinValue
passed to the noteNumber
parameter and
(SevenBitNumber)70
passed to the velocity
one.
Constructors
SevenBitNumber(Byte)
Initializes a new instance of the
SevenBitNumber with the specified value.
Declaration
public SevenBitNumber(byte value)
Parameters
Type |
Name |
Description |
Byte |
value |
Value representing seven-bit number. |
Exceptions
Fields
MaxValue
Declaration
public static readonly SevenBitNumber MaxValue
Field Value
MinValue
Declaration
public static readonly SevenBitNumber MinValue
Field Value
Values
Declaration
public static readonly SevenBitNumber[] Values
Field Value
Methods
CompareTo(SevenBitNumber)
Compares the current instance with another object of the same type and returns
an integer that indicates whether the current instance precedes, follows, or
occurs in the same position in the sort order as the other object.
Declaration
public int CompareTo(SevenBitNumber other)
Parameters
Type |
Name |
Description |
SevenBitNumber |
other |
An object to compare with this instance. |
Returns
Type |
Description |
Int32 |
A value that indicates the relative order of the objects being compared. The
return value has these meanings:
Value | Meaning |
---|
Less than zero | This instance precedes other in the sort order. | Zero | This instance occurs in the same position in the sort order as other . | Greater than zero | This instance follows other in the sort order. |
|
Equals(Object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
The object to compare with the current object. |
Returns
Type |
Description |
Boolean |
true if the specified object is equal to the current object; otherwise, false . |
Overrides
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
Int32 |
A hash code for the current object. |
Overrides
GetTypeCode()
Declaration
public TypeCode GetTypeCode()
Returns
Parse(String)
Converts the string representation of a seven-bit number to its
SevenBitNumber equivalent.
Declaration
public static SevenBitNumber Parse(string input)
Parameters
Type |
Name |
Description |
String |
input |
A string containing a number to convert. |
Returns
Exceptions
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type |
Description |
String |
A string that represents the current object. |
Overrides
TryParse(String, out SevenBitNumber)
Converts the string representation of a seven-bit number to its
SevenBitNumber equivalent.
A return value indicates whether the conversion succeeded.
Declaration
public static bool TryParse(string input, out SevenBitNumber sevenBitNumber)
Parameters
Type |
Name |
Description |
String |
input |
A string containing a number to convert. |
SevenBitNumber |
sevenBitNumber |
When this method returns, contains the SevenBitNumber
equivalent of the seven-bit number contained in input , if the conversion succeeded,
or zero if the conversion failed. The conversion fails if the input is null or
Empty, or is not of the correct format. This parameter is passed uninitialized;
any value originally supplied in result will be overwritten. |
Returns
Type |
Description |
Boolean |
true if input was converted successfully; otherwise, false . |
Operators
Explicit(Byte to SevenBitNumber)
Declaration
public static explicit operator SevenBitNumber(byte number)
Parameters
Returns
Exceptions
Implicit(SevenBitNumber to Byte)
Declaration
public static implicit operator byte (SevenBitNumber number)
Parameters
Returns
Type |
Description |
Byte |
number represented as Byte. |
Explicit Interface Implementations
Converts the value of this instance to an equivalent
Boolean value using the
specified culture-specific formatting information.
Declaration
bool IConvertible.ToBoolean(IFormatProvider provider)
Parameters
Returns
Type |
Description |
Boolean |
A Boolean value equivalent to the value of this instance. |
Converts the value of this instance to an equivalent 8-bit unsigned integer using
the specified culture-specific formatting information.
Declaration
byte IConvertible.ToByte(IFormatProvider provider)
Parameters
Returns
Type |
Description |
Byte |
An 8-bit unsigned integer equivalent to the value of this instance. |
Converts the value of this instance to an equivalent Unicode character using
the specified culture-specific formatting information.
Declaration
char IConvertible.ToChar(IFormatProvider provider)
Parameters
Returns
Type |
Description |
Char |
A Unicode character equivalent to the value of this instance. |
Converts the value of this instance to an equivalent
DateTime using the
specified culture-specific formatting information.
Declaration
DateTime IConvertible.ToDateTime(IFormatProvider provider)
Parameters
Returns
Type |
Description |
DateTime |
A DateTime instance equivalent to the value of this instance. |
Converts the value of this instance to an equivalent
Decimal number using
the specified culture-specific formatting information.
Declaration
decimal IConvertible.ToDecimal(IFormatProvider provider)
Parameters
Returns
Type |
Description |
Decimal |
A Decimal number equivalent to the value of this instance. |
Converts the value of this instance to an equivalent double-precision floating-point
number using the specified culture-specific formatting information.
Declaration
double IConvertible.ToDouble(IFormatProvider provider)
Parameters
Returns
Type |
Description |
Double |
A double-precision floating-point number equivalent to the value of this instance. |
Converts the value of this instance to an equivalent 16-bit signed integer using
the specified culture-specific formatting information.
Declaration
short IConvertible.ToInt16(IFormatProvider provider)
Parameters
Returns
Type |
Description |
Int16 |
An 16-bit signed integer equivalent to the value of this instance. |
Converts the value of this instance to an equivalent 32-bit signed integer using
the specified culture-specific formatting information.
Declaration
int IConvertible.ToInt32(IFormatProvider provider)
Parameters
Returns
Type |
Description |
Int32 |
An 32-bit signed integer equivalent to the value of this instance. |
Converts the value of this instance to an equivalent 64-bit signed integer using
the specified culture-specific formatting information.
Declaration
long IConvertible.ToInt64(IFormatProvider provider)
Parameters
Returns
Type |
Description |
Int64 |
An 64-bit signed integer equivalent to the value of this instance. |
Converts the value of this instance to an equivalent 8-bit signed integer using
the specified culture-specific formatting information.
Declaration
sbyte IConvertible.ToSByte(IFormatProvider provider)
Parameters
Returns
Type |
Description |
SByte |
An 8-bit signed integer equivalent to the value of this instance. |
Converts the value of this instance to an equivalent single-precision floating-point
number using the specified culture-specific formatting information.
Declaration
float IConvertible.ToSingle(IFormatProvider provider)
Parameters
Returns
Type |
Description |
Single |
A single-precision floating-point number equivalent to the value of this instance. |
Converts the value of this instance to an equivalent
String using the
specified culture-specific formatting information.
Declaration
string IConvertible.ToString(IFormatProvider provider)
Parameters
Returns
Type |
Description |
String |
A String instance equivalent to the value of this instance. |
Converts the value of this instance to an System.Object of the specified
Type
that has an equivalent value, using the specified culture-specific formatting
information.
Declaration
object IConvertible.ToType(Type conversionType, IFormatProvider provider)
Parameters
Type |
Name |
Description |
Type |
conversionType |
The Type to which the value of this instance is converted. |
IFormatProvider |
provider |
An IFormatProvider interface implementation that
supplies culture-specific formatting information. |
Returns
Type |
Description |
Object |
An Object instance of type conversionType whose value is equivalent to
the value of this instance. |
Converts the value of this instance to an equivalent 16-bit unsigned integer
using the specified culture-specific formatting information.
Declaration
ushort IConvertible.ToUInt16(IFormatProvider provider)
Parameters
Returns
Type |
Description |
UInt16 |
An 16-bit unsigned integer equivalent to the value of this instance. |
Converts the value of this instance to an equivalent 32-bit unsigned integer
using the specified culture-specific formatting information.
Declaration
uint IConvertible.ToUInt32(IFormatProvider provider)
Parameters
Returns
Type |
Description |
UInt32 |
An 32-bit unsigned integer equivalent to the value of this instance. |
Converts the value of this instance to an equivalent 64-bit unsigned integer
using the specified culture-specific formatting information.
Declaration
ulong IConvertible.ToUInt64(IFormatProvider provider)
Parameters
Returns
Type |
Description |
UInt64 |
An 64-bit unsigned integer equivalent to the value of this instance. |
Implements