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, IEquatable<SevenBitNumber>
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 |
| int |
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(SevenBitNumber)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(SevenBitNumber other)
Parameters
| Type |
Name |
Description |
| SevenBitNumber |
other |
An object to compare with this object. |
Returns
| Type |
Description |
| bool |
true if the current object is equal to the other parameter; otherwise, false. |
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 |
| bool |
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 |
| int |
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 |
| bool |
true if input was converted successfully; otherwise, false. |
Operators
explicit operator SevenBitNumber(byte)
Declaration
public static explicit operator SevenBitNumber(byte number)
Parameters
Returns
Exceptions
implicit operator byte(SevenBitNumber)
Declaration
public static implicit operator byte(SevenBitNumber number)
Parameters
Returns
| Type |
Description |
| byte |
number represented as byte. |
Implements