2011-08-28 02:57:49 +00:00
|
|
|
//
|
|
|
|
// File: VLPitchGrid.h - Translate between (MIDI) pitches and their vertical position
|
|
|
|
//
|
|
|
|
// Author(s):
|
|
|
|
//
|
|
|
|
// (MN) Matthias Neeracher
|
|
|
|
//
|
|
|
|
// Copyright © 2011 Matthias Neeracher
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
2011-08-28 04:12:44 +00:00
|
|
|
//
|
|
|
|
// Inquire about accidentals
|
|
|
|
//
|
|
|
|
uint16_t VLVisualInKey(int8_t pitch, int key);
|
|
|
|
|
2011-08-28 02:57:49 +00:00
|
|
|
//
|
|
|
|
// Grid position is defined from middle C
|
|
|
|
//
|
2011-08-28 18:47:25 +00:00
|
|
|
uint16_t VLPitchAccidental(int8_t pitch, uint16_t visual, int key);
|
|
|
|
int VLPitchToGrid(int8_t pitch, uint16_t visual, int key);
|
|
|
|
int8_t VLGridToPitch(int gridPos, uint16_t visual, int key);
|
2011-08-28 02:57:49 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Avoid repeating accidentals
|
|
|
|
//
|
|
|
|
class VLVisualFilter {
|
|
|
|
public:
|
2011-08-28 18:47:25 +00:00
|
|
|
VLVisualFilter(int key=0) { ResetWithKey(key); }
|
2011-08-28 02:57:49 +00:00
|
|
|
|
2011-08-28 18:47:25 +00:00
|
|
|
void ResetWithKey(int key);
|
2011-08-28 02:57:49 +00:00
|
|
|
uint16_t operator()(int gridPos, uint16_t visual);
|
|
|
|
private:
|
|
|
|
uint16_t fState[7];
|
|
|
|
};
|