resonance 1.0.1
Loading...
Searching...
No Matches
harmony.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <iostream>
5#include <vector>
6
7#include "os/mem.h"
8
24class Harmony {
25public:
34 void *operator new(size_t nSize) {
35 return AllocateTaggedMemory(nSize, "Harmony");
36 }
37
45 void operator delete(void *pBlock) {
46 OperatorDeleteOverride(pBlock, "Harmony");
47 }
48
58 void AddPitch(unsigned char nNote);
59
73 unsigned char SnapToHarmony(unsigned char nNote) const;
74
85 void GetRange(int *pLow, int *pHigh);
86
94 void Print(std::ostream &stream);
95
96 std::vector<unsigned char> mNotes;
97};
The notes of one harmony a track plays from one song position onward.
Definition harmony.h:24
void Print(std::ostream &stream)
Write the notes to a diagnostic stream as ( followed by each note and a space, then ).
unsigned char SnapToHarmony(unsigned char nNote) const
Snap a note to the nearer note of the harmony.
void AddPitch(unsigned char nNote)
Insert a note in ascending order, after any equal note.
std::vector< unsigned char > mNotes
Definition harmony.h:96
void GetRange(int *pLow, int *pHigh)
Report the lowest and highest notes.
void OperatorDeleteOverride(void *pBlock, const char *pszClass)
Release a block that AllocateTaggedMemory() handed out.
void * AllocateTaggedMemory(size_t nSize, const char *pszClass)
Allocate a block for one object of a named class.