Beispiel #1
0
        public override NoteObject GetNoteObject(Voice voice, IUniqueDef iud, bool firstDefInVoice,
                                                 ref byte currentVelocity, float musicFontHeight)
        {
            NoteObject         noteObject         = null;
            CautionaryChordDef cautionaryChordDef = iud as CautionaryChordDef;
            MidiChordDef       midiChordDef       = iud as MidiChordDef;
            InputChordDef      inputChordDef      = iud as InputChordDef;
            RestDef            restDef            = iud as RestDef;
            ClefChangeDef      clefChangeDef      = iud as ClefChangeDef;

            PageFormat pageFormat              = voice.Staff.SVGSystem.Score.PageFormat;
            float      cautionaryFontHeight    = pageFormat.CautionaryNoteheadsFontHeight;
            int        minimumCrotchetDuration = pageFormat.MinimumCrotchetDuration;

            if (cautionaryChordDef != null && firstDefInVoice)
            {
                CautionaryChordSymbol cautionaryChordSymbol = new CautionaryChordSymbol(voice, cautionaryChordDef, cautionaryFontHeight);
                noteObject = cautionaryChordSymbol;
            }
            else if (midiChordDef != null)
            {
                OutputChordSymbol outputChordSymbol = new OutputChordSymbol(voice, midiChordDef, minimumCrotchetDuration, musicFontHeight);

                if (midiChordDef.MidiVelocity != currentVelocity)
                {
                    outputChordSymbol.AddDynamic(midiChordDef.MidiVelocity, currentVelocity);
                    currentVelocity = midiChordDef.MidiVelocity;
                }
                noteObject = outputChordSymbol;
            }
            else if (inputChordDef != null)
            {
                InputChordSymbol inputChordSymbol = new InputChordSymbol(voice, inputChordDef, minimumCrotchetDuration, musicFontHeight);
                noteObject = inputChordSymbol;
            }
            else if (restDef != null)
            {
                RestSymbol restSymbol = new RestSymbol(voice, iud, minimumCrotchetDuration, musicFontHeight);
                noteObject = restSymbol;
            }
            else if (clefChangeDef != null)
            {
                ClefChangeSymbol clefChangeSymbol = new ClefChangeSymbol(voice, clefChangeDef.ClefType, cautionaryFontHeight, ((IUniqueDef)iud).MsPosition);
                noteObject = clefChangeSymbol;
            }

            return(noteObject);
        }
Beispiel #2
0
        private void SetNextSystemClefType(int staffIndex, List <ClefChangeDef> voice0ClefChangeDefs, List <ClefChangeDef> voice1ClefChangeDefs)
        {
            Debug.Assert(voice0ClefChangeDefs.Count > 0 || voice1ClefChangeDefs.Count > 0);

            ClefChangeDef lastVoice0Def = null;

            if (voice0ClefChangeDefs.Count > 0)
            {
                lastVoice0Def = voice0ClefChangeDefs[voice0ClefChangeDefs.Count - 1];
            }
            ClefChangeDef lastVoice1Def = null;

            if (voice1ClefChangeDefs.Count > 0)
            {
                lastVoice1Def = voice1ClefChangeDefs[voice1ClefChangeDefs.Count - 1];
            }
            string lastClefType = null;

            if (lastVoice0Def != null)
            {
                if ((lastVoice1Def == null) || (lastVoice0Def.MsPosition > lastVoice1Def.MsPosition))
                {
                    lastClefType = lastVoice0Def.ClefType;
                }
            }

            if (lastVoice1Def != null)
            {
                if ((lastVoice0Def == null) || (lastVoice1Def.MsPosition >= lastVoice0Def.MsPosition))
                {
                    lastClefType = lastVoice1Def.ClefType;
                }
            }

            _pageFormat.ClefsList[staffIndex] = lastClefType;
        }