2011-08-27 16:06:28 +00:00
|
|
|
//
|
|
|
|
// File: VLPitchName.h - Translate between (MIDI) pitches and their UTF-8 representation
|
|
|
|
//
|
|
|
|
// Author(s):
|
|
|
|
//
|
|
|
|
// (MN) Matthias Neeracher
|
|
|
|
//
|
|
|
|
// Copyright © 2011 Matthias Neeracher
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
|
|
const int kVLSharpChar = 0x266F;
|
|
|
|
const int kVLFlatChar = 0x266D;
|
|
|
|
extern const char * kVLSharpStr;
|
|
|
|
extern const char * kVLFlatStr;
|
|
|
|
extern const char * kVL2SharpStr;
|
|
|
|
extern const char * kVL2FlatStr;
|
|
|
|
extern const char * kVLNaturalStr;
|
2011-08-28 15:21:12 +00:00
|
|
|
extern const char * kVLFancyNames[];
|
2011-09-26 02:49:44 +00:00
|
|
|
extern const char * kVLFancyChordNames[];
|
2011-08-28 15:21:12 +00:00
|
|
|
extern const char * kVLLilypondNames[];
|
2011-08-27 16:06:28 +00:00
|
|
|
//
|
|
|
|
// UTF-8 representation of pitch
|
|
|
|
//
|
2011-08-28 15:21:12 +00:00
|
|
|
std::string VLPitchName(int8_t pitch, uint16_t accidental, int * octave = 0,
|
|
|
|
const char * names[] = kVLFancyNames);
|
2011-08-27 16:06:28 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Parse pitch, erase from string
|
|
|
|
//
|
|
|
|
enum { kPitchError = -1 };
|
|
|
|
int8_t VLParsePitch(std::string & str, size_t at, uint16_t * accidental);
|
2011-08-27 20:50:29 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// UTF-8 representation of chord
|
|
|
|
//
|
|
|
|
void VLChordName(int8_t pitch, uint16_t accidental, uint32_t steps,
|
|
|
|
int8_t rootPitch, uint16_t rootAccidental,
|
2011-08-28 15:21:12 +00:00
|
|
|
std::string & baseName, std::string & extName, std::string & rootName,
|
2011-09-26 02:49:44 +00:00
|
|
|
const char * names[] = kVLFancyChordNames);
|
2011-08-27 20:50:29 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Parse chord name, erase from string
|
|
|
|
//
|
|
|
|
int8_t VLParseChord(std::string & str, uint16_t * accidental, uint32_t * steps,
|
|
|
|
int8_t * rootPitch, uint16_t * rootAccidental);
|