diff options
author | Robert Jonsson <spamatica@gmail.com> | 2010-10-13 19:34:22 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2010-10-13 19:34:22 +0000 |
commit | 8a2c2824a59d7644e13bc52c9a0ecbd641f21f95 (patch) | |
tree | 064ad3f2bf8daab0ad27b128abd86a9bbdb1e496 /muse2/muse/helper.cpp | |
parent | a27706d9629e8b592cca4659f865b70adef24e6d (diff) |
new branch muse2, first checkin
Diffstat (limited to 'muse2/muse/helper.cpp')
-rw-r--r-- | muse2/muse/helper.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp new file mode 100644 index 00000000..605d6f5c --- /dev/null +++ b/muse2/muse/helper.cpp @@ -0,0 +1,40 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: helper.cpp,v 1.1.1.1 2003/10/27 18:51:27 wschweer Exp $ +// (C) Copyright 2003 Werner Schweer (ws@seh.de) +//========================================================= + +#include "helper.h" + +extern bool hIsB; +static const char* vall[] = { + "c","c#","d","d#","e","f","f#","g","g#","a","a#","h" + }; +static const char* valu[] = { + "C","C#","D","D#","E","F","F#","G","G#","A","A#","H" + }; + +//--------------------------------------------------------- +// pitch2string +//--------------------------------------------------------- + +QString pitch2string(int v) + { + if (v < 0 || v > 127) + return QString("----"); + int octave = (v / 12) - 2; + QString o; + o.sprintf("%d", octave); + int i = v % 12; + QString s(octave < 0 ? valu[i] : vall[i]); + if (hIsB) { + if (s == "h") + s = "b"; + else if (s == "H") + s = "B"; + } + return s + o; + } + + |