From 55a80652dc0da9506edb4826d4def58f3a34f145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20Warcho=C5=82?= Date: Sat, 7 Sep 2013 11:58:18 +0200 Subject: [PATCH] instruments: declare contexts for MIDI, too - but no sound yet... David Kastrup explained why it didn't work previously: > \midi would be happy to work with any custom-defined context > type, but you don't declare any for \midi. You only declare them > for \layout. --- .../instrument-context-definitions.ily | 38 +++++++++++++++---- templates/predefined-instruments/midi-bug.ly | 37 ++---------------- 2 files changed, 34 insertions(+), 41 deletions(-) diff --git a/templates/predefined-instruments/instrument-context-definitions.ily b/templates/predefined-instruments/instrument-context-definitions.ily index 575944fc..76e5eef6 100644 --- a/templates/predefined-instruments/instrument-context-definitions.ily +++ b/templates/predefined-instruments/instrument-context-definitions.ily @@ -29,7 +29,6 @@ \defaultchild "SopranoVoice" \consists "Ambitus_engraver" - \remove "Staff_performer" midiInstrument = "acoustic grand" \clef G @@ -45,7 +44,6 @@ \description "predefined template for soprano voice" \alias "Voice" - \consists "Staff_performer" } \context { @@ -59,7 +57,6 @@ \defaultchild "AltoVoice" \consists "Ambitus_engraver" - \remove "Staff_performer" midiInstrument = "acoustic grand" \clef G @@ -75,7 +72,6 @@ \description "predefined template for alto voice" \alias "Voice" - \consists "Staff_performer" } \context { @@ -89,7 +85,6 @@ \defaultchild "TenorVoice" \consists "Ambitus_engraver" - \remove "Staff_performer" midiInstrument = "acoustic grand" \clef "G_8" @@ -105,7 +100,6 @@ \description "predefined template for tenor voice" \alias "Voice" - \consists "Staff_performer" } \context { @@ -119,7 +113,6 @@ \defaultchild "BassVoice" \consists "Ambitus_engraver" - \remove "Staff_performer" midiInstrument = "acoustic grand" \clef F @@ -135,7 +128,36 @@ \description "predefined template for bass voice" \alias "Voice" - \consists "Staff_performer" } } + + +\midi { + \context { + \ChoirStaff + \accepts "SopranoStaff" + } + + \context { + \Staff + \name "SopranoStaff" + \description "predefined template for soprano staff" + + \type "Engraver_group" + \alias "Staff" + \accepts "SopranoVoice" + \defaultchild "SopranoVoice" + + midiInstrument = "acoustic grand" + } + + \context { + \Voice + \name "SopranoVoice" + \description "predefined template for soprano voice" + + \alias "Voice" + midiInstrument = "acoustic grand" + } +} diff --git a/templates/predefined-instruments/midi-bug.ly b/templates/predefined-instruments/midi-bug.ly index 6f1a9ceb..f90245b8 100644 --- a/templates/predefined-instruments/midi-bug.ly +++ b/templates/predefined-instruments/midi-bug.ly @@ -1,41 +1,12 @@ \version "2.16.2" \markup \justify { - Below i've defined custom contexts: SopranoStaff and SopranoVoice. - However, they don't work with midi - first i get a - \typewriter "warning: cannot find or create new `SopranoVoice'" - and ten "\lyricsto" fails, saying that it \typewriter "cannot find Voice `sop'". - I suppose that because of some Midi bug a Voice is created instead of - SopranoVoice, and then "\lyricsto" cannot find the SopranoVoice - it is supposed to find. - - Without "\midi" block eveerything works fine. + Why there is no sound in midi output? It appears that + \typewriter { midiInstrument = "acoustic grand" } + from instrument-context-definitions isn't applied. } -\layout { - \context { - \ChoirStaff - \accepts "SopranoStaff" - } - - \context { - \Staff - \type "Engraver_group" - \name "SopranoStaff" - \alias "Staff" - - \accepts "SopranoVoice" - \defaultchild "SopranoVoice" - - instrumentName = "Soprano" - } - - \context { - \Voice - \name "SopranoVoice" - \alias "Voice" - } -} +\include "instrument-context-definitions.ily" \score { <<