Class Octave
Represents an octave defined by its number.
Assembly: Melanchall.DryWetMidi.dll
Syntax
public sealed class Octave
Fields
MaxOctaveNumber
The largest possible value of an octave's number.
Declaration
public static readonly int MaxOctaveNumber
Field Value
Middle
The octave which contains the middle C note (C4).
Declaration
public static readonly Octave Middle
Field Value
MinOctaveNumber
The smallest possible value of an octave's number.
Declaration
public static readonly int MinOctaveNumber
Field Value
OctaveSize
The size of an octave, i.e. number of notes within an octave.
Declaration
public const int OctaveSize = 12
Field Value
Properties
A
Gets the A note of an octave defined by the current
Octave.
Declaration
Property Value
Exceptions
ASharp
Gets the A# note of an octave defined by the current
Octave.
Declaration
public Note ASharp { get; }
Property Value
Exceptions
B
Gets the B note of an octave defined by the current
Octave.
Declaration
Property Value
Exceptions
C
Gets the C note of an octave defined by the current
Octave.
Declaration
Property Value
Exceptions
CSharp
Gets the C# note of an octave defined by the current
Octave.
Declaration
public Note CSharp { get; }
Property Value
Exceptions
D
Gets the D note of an octave defined by the current
Octave.
Declaration
Property Value
Exceptions
DSharp
Gets the D# note of an octave defined by the current
Octave.
Declaration
public Note DSharp { get; }
Property Value
Exceptions
E
Gets the E note of an octave defined by the current
Octave.
Declaration
Property Value
Exceptions
F
Gets the F note of an octave defined by the current
Octave.
Declaration
Property Value
Exceptions
FSharp
Gets the F# note of an octave defined by the current
Octave.
Declaration
public Note FSharp { get; }
Property Value
Exceptions
G
Gets the G note of an octave defined by the current
Octave.
Declaration
Property Value
Exceptions
GSharp
Gets the G# note of an octave defined by the current
Octave.
Declaration
public Note GSharp { get; }
Property Value
Exceptions
Number
Gets the number of an octave represented by the current
Octave.
Declaration
public int Number { get; }
Property Value
Methods
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
Get(int)
Gets an octave by the specified octave number.
Declaration
public static Octave Get(int octaveNumber)
Parameters
Type |
Name |
Description |
int |
octaveNumber |
The number of an octave. |
Returns
Type |
Description |
Octave |
An octave with the specified number. |
Exceptions
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
int |
A hash code for the current object. |
Overrides
GetNote(NoteName)
Gets a note by the specified note name using current octave.
Declaration
public Note GetNote(NoteName noteName)
Parameters
Type |
Name |
Description |
NoteName |
noteName |
The name of a note. |
Returns
Type |
Description |
Note |
Note with the specified note name and current octave. |
Exceptions
Parse(string)
Converts the string representation of a musical octave to its
Octave equivalent.
Declaration
public static Octave Parse(string input)
Parameters
Type |
Name |
Description |
string |
input |
A string containing an octave to convert. |
Returns
Type |
Description |
Octave |
A Octave equivalent to the musical note contained in input . |
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 Octave)
Converts the string representation of a musical octave to its
Octave equivalent.
A return value indicates whether the conversion succeeded.
Declaration
public static bool TryParse(string input, out Octave octave)
Parameters
Type |
Name |
Description |
string |
input |
A string containing an octave to convert. |
Octave |
octave |
When this method returns, contains the Octave
equivalent of the musical octave contained in input , if the conversion succeeded,
or null 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
operator ==(Octave, Octave)
Determines if two
Octave objects are equal.
Declaration
public static bool operator ==(Octave octave1, Octave octave2)
Parameters
Returns
Type |
Description |
bool |
true if the octaves are equal, false otherwise. |
operator !=(Octave, Octave)
Determines if two
Octave objects are not equal.
Declaration
public static bool operator !=(Octave octave1, Octave octave2)
Parameters
Returns
Type |
Description |
bool |
false if the octaves are equal, true otherwise. |