|
Canorus
0.0
|
Music interval expressed with diatonical quality and quantity. More...
#include <interval.h>
Public Types | |
| enum | CAQuality { Major = 1, Minor = -1, Perfect = 0, Augmented = 2, Diminished = -2 } |
| enum | CAQuantity { Undefined = 0, Prime = 1, Second = 2, Third = 3, Fourth = 4, Fifth = 5, Sixth = 6, Seventh = 7, Octave = 8 } |
Public Member Functions | |
| CAInterval () | |
| CAInterval (int qlt, int qnt) | |
| CAInterval (CADiatonicPitch note1, CADiatonicPitch note2, bool absolute=true) | |
| CAInterval | operator~ () |
| CAInterval | operator+ (CAInterval) |
| CAInterval | operator- (CAInterval i) |
| CAInterval | operator* (int numerator) |
| bool | operator== (CAInterval i) |
| bool | operator!= (CAInterval i) |
| const int | quality () |
| const int | quantity () |
| void | setQuality (const int qlt) |
| void | setQuantity (const int qnt) |
| int | semitones () |
Static Public Member Functions | |
| static CAInterval | fromSemitones (int semitones) |
| static const QString | qualityToReadable (int k) |
| static const QString | quantityToReadable (int k) |
Private Attributes | |
| int | _qlt |
| int | _qnt |
Music interval expressed with diatonical quality and quantity.
Copyright (c) 2008, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.
Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE.GPL for details.
This class represent an interval between two notes. eg. major second, minor sixth, perfect prime, perfect fifth, augmented fifth etc.
It consists of two properties:
Intervals can be compared to each other, summed with other intervals or diatonic pitches and inverted.
| CAInterval::CAInterval | ( | ) |
Constructs a new undefined interval.
Call setQuality() and setQuantity() to set its properties.
References setQuality(), and setQuantity().
Referenced by fromSemitones(), operator+(), operator-(), and operator~().


| CAInterval::CAInterval | ( | int | qlt, |
| int | qnt | ||
| ) |
Constructs an interval with quality qlt and quantity qnt.
References setQuality(), and setQuantity().

| CAInterval::CAInterval | ( | CADiatonicPitch | pitch1, |
| CADiatonicPitch | pitch2, | ||
| bool | absolute = true |
||
| ) |
Constructs an interval between the pitches pitch1 and pitch2. Interval quantity is positive regardless of the order of pitches, if absolute is True (default). Otherwise, quantity is negative, if second pitch is lower than the first one.
References CADiatonicPitch::accs(), CADiatonicPitch::noteName(), quantity(), setQuality(), and setQuantity().

|
static |
Creates an interval out of the given semitones. Semitones can also be negative to produce intervals down.
The interval found in major/minor scales is returned. Augmented fourth is used for the tritone.
This is an injective mapping.
References Augmented, CAInterval(), Fifth, Fourth, Major, Minor, Perfect, Prime, quantity(), Second, semitones(), setQuantity(), Seventh, Sixth, and Third.
Referenced by CATranspose::transposeBySemitones().


|
inline |
|
inline |
| CAInterval CAInterval::operator+ | ( | CAInterval | i | ) |
Returns the sum of two intervals.
eg. perfect fifth + major third = major seventh
References CAInterval(), quality(), and quantity().
Referenced by operator-().


|
inline |
References CAInterval(), operator+(), quality(), and quantity().

|
inline |
References _qlt, _qnt, quality(), and quantity().
Referenced by operator!=().


| CAInterval CAInterval::operator~ | ( | ) |
Returns the inverse of the interval. The reversed interval is always positive.
eg. seventh -> second, major -> minor and vice versa
References CAInterval(), quality(), and quantity().

|
inline |
References _qlt.
Referenced by CADiatonicPitch::operator+(), operator+(), CADiatonicPitch::operator-(), operator-(), operator==(), operator~(), and semitones().

|
static |
Referenced by CATransposeView::on_uiIntervalQuantity_currentIndexChanged().

|
inline |
References _qnt.
Referenced by CAInterval(), CADiatonicPitch::diatonicPitchFromMidiPitchKey(), fromSemitones(), CADiatonicPitch::operator+(), operator+(), CADiatonicPitch::operator-(), operator-(), operator==(), operator~(), semitones(), and CATranspose::transposeByKeySig().

|
static |
| int CAInterval::semitones | ( | ) |
Returns the number of semitones in the interval.
This is a surjective mapping.
References Augmented, Diminished, Fifth, Fourth, Minor, Prime, quality(), quantity(), Second, Seventh, Sixth, and Third.
Referenced by CADiatonicPitch::diatonicPitchFromMidiPitchKey(), and fromSemitones().


|
inline |
|
inline |
References _qnt.
Referenced by CAInterval(), CADiatonicPitch::diatonicPitchFromMidiPitchKey(), fromSemitones(), and CATranspose::transposeByKeySig().

|
private |
Referenced by operator==(), quality(), and setQuality().
|
private |
Referenced by operator==(), quantity(), and setQuantity().