Skip to content
Snippets Groups Projects
Commit a1b71e02 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Implement *MidiInstrument setting for a staff

parent f796a3d1
No related branches found
No related tags found
No related merge requests found
../orchestrallily.ly
\ No newline at end of file
../../orchestrallily.ly
\ No newline at end of file
......@@ -260,28 +260,35 @@ orchestralScoreStructure = #(define-music-function (parser location structure) (
)
)
% Given a property name and the extensions, either generate the pair to set
% the property or an empty list, if no pre-defined variable could be found
#(define (oly:generate_property_pair prop piece instr type)
(let* ((val (namedPieceInstrObject piece instr type)))
(if (not-null? val) (list 'assign prop val) '())
)
)
% Generate the properties for the staff for piece and instr. Typically, these
% are the instrument name and the short instrument name (if defined).
% return a (possibly empty) list of all assignments.
#(define (oly:make_staff_properties piece instr)
(let* (
(instrName (namedPieceInstrObject piece instr "InstrumentName"))
(shortInstrName (namedPieceInstrObject piece instr "ShortInstrumentName"))
(props '())
(mapping '(
(instrumentName . "InstrumentName")
(shortInstrumentName . "ShortInstrumentName")
(midiInstrument . "MidiInstrument")
))
(assignments (map
(lambda (pr)
(oly:generate_property_pair (car pr) piece instr (cdr pr))
)
mapping))
(props (filter not-null? assignments))
)
(if (not-null? instrName)
(set! props (append props (list (list 'assign 'instrumentName instrName)))))
(if (not-null? shortInstrName)
(set! props (append props (list (list 'assign 'shortInstrumentName shortInstrName)))))
(display props)
props
)
)
#(define (oly:settings_pair setting value)
(if (not-null? value)
(list setting value)
'()
)
)
#(define (oly:make_staff_group parser piece instr stafftype instruments)
(let* (
(staves (oly:make_parallel_staves parser piece instr instruments))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment