Exemplo n.º 1
0
 /// <summary>
 /// returns true if this inputVoice contains inputChord, otherwise false.
 /// </summary>
 /// <param name="inputChordDef"></param>
 /// <returns></returns>
 internal bool Contains(InputChordSymbol inputChord)
 {
     bool contains = false;
     foreach(InputChordSymbol localChord in InputChordSymbols)
     {
         if(localChord == inputChord)
         {
             contains = true;
             break;
         }
     }
     return contains;
 }
Exemplo n.º 2
0
        /// <summary>
        /// returns true if this inputVoice contains inputChord, otherwise false.
        /// </summary>
        /// <param name="inputChordDef"></param>
        /// <returns></returns>
        internal bool Contains(InputChordSymbol inputChord)
        {
            bool contains = false;

            foreach (InputChordSymbol localChord in InputChordSymbols)
            {
                if (localChord == inputChord)
                {
                    contains = true;
                    break;
                }
            }
            return(contains);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public override NoteObject GetNoteObject(Voice voice, int absMsPosition, 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)
            {
                if(cautionaryChordDef.NotatedMidiVelocities != null)
                {
                    CautionaryOutputChordSymbol cautionaryOutputChordSymbol = new CautionaryOutputChordSymbol(voice, cautionaryChordDef, absMsPosition, cautionaryFontHeight);
                    noteObject = cautionaryOutputChordSymbol;
                }
                else
                {
                    CautionaryInputChordSymbol cautionaryInputChordSymbol = new CautionaryInputChordSymbol(voice, cautionaryChordDef, absMsPosition, cautionaryFontHeight);
                    noteObject = cautionaryInputChordSymbol;

                }
            }
            else if(midiChordDef != null)
            {
                OutputChordSymbol outputChordSymbol = new OutputChordSymbol(voice, midiChordDef, absMsPosition, minimumCrotchetDuration, musicFontHeight);

                if(this._coloredVelocities == true)
                {
                    outputChordSymbol.SetNoteheadColors();
                }
                else if(midiChordDef.NotatedMidiVelocities[0] != currentVelocity)
                {
                    outputChordSymbol.AddDynamic(midiChordDef.NotatedMidiVelocities[0], currentVelocity);
                    currentVelocity = midiChordDef.NotatedMidiVelocities[0];
                }
                noteObject = outputChordSymbol;
            }
            else if(inputChordDef != null)
            {
                InputChordSymbol inputChordSymbol = new InputChordSymbol(voice, inputChordDef, absMsPosition, minimumCrotchetDuration, musicFontHeight);
                noteObject = inputChordSymbol;
            }
            else if(restDef != null)
            {
                RestSymbol restSymbol = new RestSymbol(voice, iud, absMsPosition, minimumCrotchetDuration, musicFontHeight);
                noteObject = restSymbol;
            }
            else if(clefChangeDef != null)
            {
                ClefChangeSymbol clefChangeSymbol = new ClefChangeSymbol(voice, clefChangeDef.ClefType, absMsPosition, cautionaryFontHeight);
                noteObject = clefChangeSymbol;
            }

            return noteObject;
        }