|
resonance 1.0.1
|
The notes of one harmony a track plays from one song position onward. More...
#include <harmony.h>
Public Member Functions | |
| void * | operator new (size_t nSize) |
| Allocate a harmony from the tagged heap under the tag Harmony. | |
| void | operator delete (void *pBlock) |
| Release a harmony to the tagged heap. | |
| void | AddPitch (unsigned char nNote) |
| Insert a note in ascending order, after any equal note. | |
| unsigned char | SnapToHarmony (unsigned char nNote) const |
| Snap a note to the nearer note of the harmony. | |
| void | GetRange (int *pLow, int *pHigh) |
| Report the lowest and highest notes. | |
| void | Print (std::ostream &stream) |
| Write the notes to a diagnostic stream as ( followed by each note and a space, then ). | |
Public Attributes | |
| std::vector< unsigned char > | mNotes |
The notes of one harmony a track plays from one song position onward.
The class emits no RTTI, because it is not polymorphic. Its title is attested by the allocation tag Harmony, under which TrackData allocates it and its deleter releases it. The object is 12 bytes, one vector of one-byte notes kept in ascending order. LevelConverter builds one note at a time through AddPitch() and hands it to TrackData::AddHarmony(), which copies it.
The notes are unsigned. The two binary searches and every reader load them zero-extended and compare them unsigned. Print() alone loads them sign-extended, which is the conversion to char that printing a note performs.
The constructors, the destructor, and the assignment are implicitly declared. The copy constructor is the vector copy constructor instantiation at 0x001d73f8.
|
inline |
Allocate a harmony from the tagged heap under the tag Harmony.
No out-of-line body exists. TrackData::AddHarmony() expands the call inline.
| nSize | The object size the compiler supplies. |
|
inline |
Release a harmony to the tagged heap.
No out-of-line body exists. TrackData's deleter expands the call inline.
| pBlock | The block. |
| void Harmony::AddPitch | ( | unsigned char | nNote | ) |
Insert a note in ascending order, after any equal note.
The position comes from std::upper_bound(), instantiated at 0x001a4f80.
| nNote | The note. |
| unsigned char Harmony::SnapToHarmony | ( | unsigned char | nNote | ) | const |
Snap a note to the nearer note of the harmony.
The routine finds the first note not below nNote with std::lower_bound(), instantiated at 0x001a4fd0, stepping back one when the search runs off the end, and takes the note below that one as well when one exists. A note above the midpoint of the two resolves to the higher one, and a note at or below it to the lower one.
| nNote | The note. |
| void Harmony::GetRange | ( | int * | pLow, |
| int * | pHigh ) |
Report the lowest and highest notes.
The title is inferred.
| pLow | Receives the first note, or 20 when the harmony is empty. |
| pHigh | Receives the last note, or 120 when the harmony is empty. |
| void Harmony::Print | ( | std::ostream & | stream | ) |
Write the notes to a diagnostic stream as ( followed by each note and a space, then ).
| stream | The stream to write to. |
| std::vector<unsigned char> Harmony::mNotes |
The notes, one byte each, ascending. +0x00