[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
note-name-engraver: add user-defined note names support (issue 8593046)
From: |
fanziye1 |
Subject: |
note-name-engraver: add user-defined note names support (issue 8593046) |
Date: |
Sat, 20 Apr 2013 00:03:17 +0000 |
Reviewers: janek,
Message:
Hi Janek,
It seems I forgot to publish this issue in list. This is for the
googlecode issue 1367. Only a few c++ code was added, nothing done with
regression test and docs. Was it appropriate to post a patch like this?
Or is there anything I should do for an issue? I think I will add them
later.
Thanks very much!
note-name-engraver: add user-defined note names support
Property "noteNameList" added in order to display
note names in languages other than Deutsch.
Example:
\version "2.13.37"
\include "espanol.ly"
notes = \relative do' { do re mi do }
\new Staff <<
\notes
\context NoteNames {
\set noteNameList = #'("la" "si" "do" "re" "mi" "fa" "sol")
\notes }
Fan Ziye
Description:
note-name-engraver: add user-defined note names support
Property "noteNameList" added in order to display
note names in languages other than Deutsch.
Example:
\version "2.13.37"
\include "espanol.ly"
notes = \relative do' { do re mi do }
\new Staff <<
\notes
\context NoteNames {
\set noteNameList = #'("la" "si" "do" "re" "mi" "fa" "sol")
\notes }
Please review this at https://codereview.appspot.com/8593046/
Affected files:
M lily/note-name-engraver.cc
Index: lily/note-name-engraver.cc
diff --git a/lily/note-name-engraver.cc b/lily/note-name-engraver.cc
index
c96b3776c0980bddfbe66f0c366b370006db1e96..93a176639a2567857b323aa62f077ca960849df9
100644
--- a/lily/note-name-engraver.cc
+++ b/lily/note-name-engraver.cc
@@ -45,6 +45,17 @@ Note_name_engraver::listen_note (Stream_event *ev)
void
Note_name_engraver::process_music ()
{
+ // Get users notename list
+ SCM scm_note_name_list = get_property("noteNameList");
+ vector<string> note_name_list;
+ int note_name_list_length = scm_to_int(scm_length(scm_note_name_list));
+ if (scm_list_p (scm_note_name_list) && !scm_null_p (scm_note_name_list))
+ for (vsize i = 0; i < note_name_list_length; i ++)
+ note_name_list.push_back (ly_scm2string (scm_list_ref
(scm_note_name_list, scm_from_int(i))));
+ else
+ for (char c = 'a'; c <= 'g'; c ++)
+ note_name_list.push_back(string(1, c));
+
string s;
for (vsize i = 0; i < events_.size (); i++)
{
@@ -54,9 +65,13 @@ Note_name_engraver::process_music ()
if (!to_boolean (get_property ("printOctaveNames")))
p = Pitch (-1, p.get_notename (), p.get_alteration ());
+
+ int note_name_index = p.to_string().c_str()[0] - 'a';
- s += p.to_string ();
+ s += note_name_list[note_name_index];
}
+
+
if (s.length ())
{
Item *t = make_item ("NoteName", events_[0]->self_scm ());
- note-name-engraver: add user-defined note names support (issue 8593046),
fanziye1 <=