Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
CAInterval Class Reference

Music interval expressed with diatonical quality and quantity. More...

#include <interval.h>

List of all members.

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)
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

Detailed Description

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:
    - quality (major, minor, perfect, augmented, diminished)
    - quantity (prime, second, third, fourth etc.)

    \note Quantity can also be negative for intervals down.

    Intervals can be compared with each other, summed with other intervals or diatonic
    pitches and inverted.

    \sa CADiatonicPitch, operator~()

Member Enumeration Documentation

Enumerator:
Major 
Minor 
Perfect 
Augmented 
Diminished 
Enumerator:
Undefined 
Prime 
Second 
Third 
Fourth 
Fifth 
Sixth 
Seventh 
Octave 

Constructor & Destructor Documentation

Constructs a new undefined interval.

Call setQuality() and setQuantity() to set its properties.

References setQuality(), and setQuantity().

Referenced by fromSemitones(), operator+(), operator-(), and operator~().

Here is the call graph for this function:

Here is the caller graph for this function:

CAInterval::CAInterval ( int  qlt,
int  qnt 
)

Constructs an interval with quality qlt and quantity qnt.

References setQuality(), and setQuantity().

Here is the call graph for this function:

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().

Here is the call graph for this function:


Member Function Documentation

CAInterval CAInterval::fromSemitones ( int  semitones) [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, setQuantity(), Seventh, Sixth, and Third.

Referenced by CATranspose::transposeBySemitones().

Here is the call graph for this function:

Here is the caller graph for this function:

CAInterval CAInterval::operator* ( int  numerator) [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-().

Here is the call graph for this function:

Here is the caller graph for this function:

CAInterval CAInterval::operator- ( CAInterval  i) [inline]

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

Here is the call graph for this function:

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().

Here is the call graph for this function:

const int CAInterval::quality ( ) [inline]

References _qlt.

Referenced by CADiatonicPitch::operator+(), operator+(), CADiatonicPitch::operator-(), operator-(), operator~(), and semitones().

Here is the caller graph for this function:

const QString CAInterval::qualityToReadable ( int  k) [static]

Referenced by CATransposeView::on_uiIntervalQuantity_currentIndexChanged().

Here is the caller graph for this function:

const int CAInterval::quantity ( ) [inline]

References _qnt.

Referenced by CAInterval(), fromSemitones(), CADiatonicPitch::operator+(), operator+(), CADiatonicPitch::operator-(), operator-(), operator~(), and semitones().

Here is the caller graph for this function:

const QString CAInterval::quantityToReadable ( int  k) [static]

Referenced by CATransposeView::setupCustomUi().

Here is the caller graph for this function:

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.

Here is the call graph for this function:

void CAInterval::setQuality ( const int  qlt) [inline]

References _qlt.

Referenced by CAInterval().

Here is the caller graph for this function:

void CAInterval::setQuantity ( const int  qnt) [inline]

References _qnt.

Referenced by CAInterval(), fromSemitones(), and CATranspose::transposeByKeySig().

Here is the caller graph for this function:


Member Data Documentation

int CAInterval::_qlt [private]

Referenced by quality(), and setQuality().

int CAInterval::_qnt [private]

Referenced by quantity(), and setQuantity().


The documentation for this class was generated from the following files: