Пример #1
0
 /// <summary>
 /// Used by the Assistant Composer
 /// </summary>
 public DurationSymbol(Voice voice, int msDuration, int msPosition, int minimumCrotchetDuration, float fontHeight)
     : base(voice, fontHeight)
 {
     _msDuration = msDuration;
     _msPosition = msPosition;
     this.SetDurationClass(MsDuration, minimumCrotchetDuration);
 }
Пример #2
0
 /// <summary>
 /// Creates a new clef, of the type described, belonging to the given voice.
 /// The clefType must be one of the following strings "t", "t1", "t2", "t3", "b", "b1", "b2", "b3"
 /// </summary>
 /// <param name="voice"></param>
 /// <param name="clefType"></param>
 public ClefSymbol(Voice voice, string clefType, float fontHeight)
     : base(voice)
 {
     _clefType = clefType;
     _fontHeight = fontHeight;
     //CapellaColor = "000000"; -- default
 }
Пример #3
0
        //(Voice voice, InputChordDef umcd, int absMsPosition, int minimumCrotchetDurationMS, float fontSize)
        public CautionaryInputChordSymbol(Voice voice, CautionaryChordDef lccd, int absMsPosition, float fontSize)
            : base(voice, lccd.MsDuration, absMsPosition, 600, fontSize)
        {
            SetNoteheadPitches(lccd.NotatedMidiPitches);

            _durationClass = DurationClass.cautionary;
            _msDuration = 0;
            Stem.Draw = false;
        }
Пример #4
0
 public RestSymbol(Voice voice, IUniqueDef iumdd, int minimumCrotchetDurationMS, float fontHeight)
     : base(voice, iumdd.MsDuration, iumdd.MsPosition, minimumCrotchetDurationMS, fontHeight)
 {
     if(iumdd is CautionaryChordDef)
     {
         Console.WriteLine("rest is CautionaryChordDef!");
     }
     LocalCautionaryChordDef = iumdd as CautionaryChordDef;
 }
Пример #5
0
        public ChordSymbol(Voice voice, int msDuration, int absMsPosition, int minimumCrotchetDurationMS, bool beamContinues, float fontSize)
            : base(voice,  msDuration, absMsPosition, minimumCrotchetDurationMS, fontSize)
        {
            // note that all chord symbols have a stem!
            // Even cautionary, semibreves and breves need a stem direction in order to set chord Metrics correctly.
            Stem = new Stem(this, beamContinues);

            // Beam is currently null. Create when necessary.
        }
Пример #6
0
        public OutputChordSymbol(Voice voice, MidiChordDef umcd, int minimumCrotchetDurationMS, float fontSize)
            : base(voice, umcd.MsDuration, umcd.MsPosition, minimumCrotchetDurationMS, fontSize)
        {
            _midiChordDef = umcd;

            _msDurationToNextBarline = umcd.MsDurationToNextBarline;

            SetNoteheadPitches(umcd.NotatedMidiPitches);

            if(umcd.OrnamentNumberSymbol != 0)
            {
                OrnamentText ornamentText = new OrnamentText(this, "~" + umcd.OrnamentNumberSymbol.ToString(), FontHeight);
                DrawObjects.Add(ornamentText);
            }

            if(umcd.Lyric != null)
            {
                LyricText lyric = new LyricText(this, umcd.Lyric, FontHeight);
                DrawObjects.Add(lyric);
            }
        }
Пример #7
0
        public InputChordSymbol(Voice voice, InputChordDef umcd, int absMsPosition, int minimumCrotchetDurationMS, float fontSize)
            : base(voice, umcd.MsDuration, absMsPosition, minimumCrotchetDurationMS, umcd.BeamContinues, fontSize)
        {
            _inputChordDef = umcd;

            _msDurationToNextBarline = umcd.MsDurationToNextBarline;

            SetNoteheadPitches(umcd.NotatedMidiPitches);

            if(umcd.Lyric != null)
            {
                LyricText lyricText = new LyricText(this, umcd.Lyric, FontHeight);
                DrawObjects.Add(lyricText);
            }

            if(umcd.Dynamic != null)
            {
                DynamicText dynamicText = new DynamicText(this, umcd.Dynamic, FontHeight);
                DrawObjects.Add(dynamicText);
            }
        }
Пример #8
0
 /// <summary>
 /// This beam is attached to chords in one voice of a 2-voice staff.
 /// The returned chords are the chords in the other voice whose msPosition
 /// is greater than or equal to the msPosition at the start of this beamBlock,
 /// and less than or equal to the msPosition at the end of this beamBlock. 
 /// </summary>
 public List<ChordSymbol> EnclosedChords(Voice otherVoice)
 {
     Debug.Assert(Chords.Count > 1);
     int startMsPos = Chords[0].MsPosition;
     int endMsPos = Chords[Chords.Count-1].MsPosition;
     List<ChordSymbol> enclosedChordSymbols = new List<ChordSymbol>();
     foreach(ChordSymbol otherChord in otherVoice.ChordSymbols)
     {
         if(otherChord.MsPosition >= startMsPos && otherChord.MsPosition <= endMsPos)
             enclosedChordSymbols.Add(otherChord);
         if(otherChord.MsPosition > endMsPos)
             break;
     }
     return enclosedChordSymbols;
 }
Пример #9
0
 public Barline(Voice voice, BarlineType barlineType)
     : base(voice)
 {
     BarlineType = barlineType;
 }
Пример #10
0
 protected Barline(Voice voice)
     : base(voice)
 {
 }
Пример #11
0
 private bool FirstDurationSymbolOnNextSystemIsCautionary(Voice voiceOnNextSystem)
 {
     bool firstDurationSymbolIsCautionary = false;
     foreach(NoteObject noteObject in voiceOnNextSystem.NoteObjects)
     {
         if(noteObject is CautionaryOutputChordSymbol || noteObject is CautionaryInputChordSymbol)
         {
             firstDurationSymbolIsCautionary = true;
             break;
         }
         else if(noteObject is ChordSymbol || noteObject is RestSymbol)
         {
             break;
         }
     }
     return firstDurationSymbolIsCautionary;
 }
Пример #12
0
 public EndOfScoreBarline(Voice voice)
     : base(voice)
 {
 }
Пример #13
0
 public NoteObject(Voice voice, float fontHeight)
 {
     Voice = voice; // container
     _fontHeight = fontHeight;
 }
Пример #14
0
 public SmallClef(Voice voice, string clefType, int absMsPosition, PageFormat pageFormat)
     : base(voice, clefType, pageFormat.MusicFontHeight * pageFormat.SmallSizeFactor)
 {
     _absMsPosition = absMsPosition;
     _isVisible     = true;
 }
Пример #15
0
 public RestSymbol(Voice voice, int msDuration, int absMsPosition, MNX.Common.Event mnxEventDef, double fontSize)
     : base(voice, msDuration, absMsPosition, mnxEventDef.MNXDurationSymbol, fontSize)
 {
     TupletDefs = mnxEventDef.TupletDefs; // can be null
 }
Пример #16
0
 public AnchorageSymbol(Voice voice, float fontHeight)
     : base(voice, fontHeight)
 {
 }
Пример #17
0
 public AnchorageSymbol(Voice voice)
     : base(voice)
 {
 }
Пример #18
0
 public EndOfScoreRegionBarline(Voice voice, List <DrawObject> drawObjects)
     : base(voice, drawObjects)
 {
 }
Пример #19
0
 public EndAndStartRegionBarline(Voice voice, List <DrawObject> drawObjects)
     : base(voice)
 {
     SetDrawObjects(drawObjects);
 }
Пример #20
0
 /// <summary>
 /// If a small ClefSymbol has no following chord in the voice, it is moved before the final barline.
 /// </summary>
 private void MoveRestClefChangesToEndOfVoice(Voice voice)
 {
     bool restFound = false;
     ClefSymbol smallClef = null;
     int smallClefIndex = -1;
     for(int i = voice.NoteObjects.Count - 1; i >= 0; --i)
     {
         if(voice.NoteObjects[i] is OutputChordSymbol)
         {
             break;
         }
         if(voice.NoteObjects[i] is RestSymbol)
         {
             restFound = true;
         }
         ClefSymbol clef = voice.NoteObjects[i] as ClefSymbol;
         if(clef != null && clef.FontHeight == _pageFormat.CautionaryNoteheadsFontHeight)
         {
             smallClef = clef;
             smallClefIndex = i;
             break;
         }
     }
     if(restFound && (smallClef != null))
     {
         voice.NoteObjects.RemoveAt(smallClefIndex);
         Debug.Assert(voice.NoteObjects[voice.NoteObjects.Count - 1] is Barline);
         voice.NoteObjects.Insert(voice.NoteObjects.Count - 1, smallClef);
     }
 }
Пример #21
0
 public InvisibleSmallClef(Voice voice, string clefType, int absMsPosition)
     : base(voice, clefType, 0.01F)
 {
     _absMsPosition = absMsPosition;
     _isVisible     = true;
 }
Пример #22
0
 /// <summary>
 /// used by CautonaryInputChordSymbol
 /// </summary>
 public InputChordSymbol(Voice voice, int msDuration, int absMsPosition, int minimumCrotchetDurationMS, float fontSize)
     : base(voice,  msDuration, absMsPosition, minimumCrotchetDurationMS, false, fontSize)
 {
 }
Пример #23
0
 public Clef(Voice voice, MNX.Common.Clef mnxClefDef, double fontHeight)
     : base(voice)
 {
     _clefType   = GetClefType(mnxClefDef).ToString();
     _fontHeight = fontHeight;
 }
Пример #24
0
 private void InsertInvisibleClefChanges(Voice voice, List<ClefChangeDef> clefChangeDefs)
 {
     foreach(ClefChangeDef ccd in clefChangeDefs)
     {
         ClefChangeSymbol invisibleClefChangeSymbol = new ClefChangeSymbol(voice, ccd.ClefType, _pageFormat.CautionaryNoteheadsFontHeight, ccd.MsPosition);
         invisibleClefChangeSymbol.IsVisible = false;
         InsertInvisibleClefChangeInNoteObjects(voice, invisibleClefChangeSymbol);
     }
 }
Пример #25
0
 public TimeSignature(Voice voice, MNX.Common.TimeSignature mnxTimeSigDef, double fontHeight)
     : base(voice)
 {
     Signature  = mnxTimeSigDef.Signature;
     FontHeight = fontHeight;
 }
Пример #26
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;
        }
Пример #27
0
 protected BRLine(Voice voice)
     : base(voice)
 {
 }
Пример #28
0
 public ClefChangeSymbol(Voice voice, string clefType, int absMsPosition, float fontHeight)
     : base(voice, clefType, fontHeight)
 {
     _absMsPosition = absMsPosition;
     _isVisible = true;
 }
Пример #29
0
 public AnchorageSymbol(Voice voice)
     : base(voice)
 {
 }
Пример #30
0
 public Barline(Voice voice)
     : base(voice)
 {
 }
Пример #31
0
 public AnchorageSymbol(Voice voice, float fontHeight)
     : base(voice, fontHeight)
 {
 }
Пример #32
0
 public void ShiftStemsForOtherVoice(Voice otherVoice)
 {
     float minMsPosition = Chords[0].MsPosition;
     float maxMsPosition = Chords[Chords.Count - 1].MsPosition;
     List<ChordSymbol> otherChords = new List<ChordSymbol>();
     foreach(ChordSymbol otherChordSymbol in otherVoice.ChordSymbols)
     {
         if(otherChordSymbol.MsPosition >= minMsPosition && otherChordSymbol.MsPosition <= maxMsPosition)
             otherChords.Add(otherChordSymbol);
         if(otherChordSymbol.MsPosition > maxMsPosition)
             break;
     }
     if(otherChords.Count > 0)
     {
         float minimumDistanceToChords = _gap * 2F;
         float distanceToChords = DistanceToChords(otherChords);
         if(_stemDirection == VerticalDir.up) // move the beam up
         {
             if(distanceToChords < minimumDistanceToChords)
             {
                 float deltaY = -(minimumDistanceToChords - distanceToChords);
                 this.Move(deltaY);
                 foreach(ChordSymbol chord in Chords)
                 {
                     float newStemTipY = chord.ChordMetrics.StemMetrics.Top + deltaY;
                     chord.ChordMetrics.MoveOuterStemTip(newStemTipY, VerticalDir.up);
                 }
             }
         }
         else // _stemDirection == VerticalDir.down, move the beam down
         {
             if(distanceToChords < minimumDistanceToChords)
             {
                 float deltaY = minimumDistanceToChords - distanceToChords;
                 this.Move(deltaY);
                 foreach(ChordSymbol chord in Chords)
                 {
                     float newStemTipY = chord.ChordMetrics.StemMetrics.Bottom + deltaY;
                     chord.ChordMetrics.MoveOuterStemTip(newStemTipY, VerticalDir.down);
                 }
             }
         }
     }
 }
Пример #33
0
 private List<NoteObjectMoment> GetVoiceMoments(Voice voice, List<NoteObjectMoment> systemMoments)
 {
     List<NoteObjectMoment> voiceMoments = new List<NoteObjectMoment>();
     NoteObjectMoment voiceNOM = null;
     foreach(NoteObjectMoment systemNOM in systemMoments)
     {
         voiceNOM = null;
         foreach(NoteObject noteObject in systemNOM.NoteObjects)
         {
             if(noteObject.Voice == voice)
             {
                 if(voiceNOM == null)
                 {
                     // noteObject in voice 1
                     voiceNOM = new NoteObjectMoment(systemNOM.AbsMsPosition);
                     voiceNOM.Add(noteObject);
                     voiceNOM.AlignmentX = systemNOM.AlignmentX;
                 }
                 else // noteObject in voice 2
                 {
                     voiceNOM.Add(noteObject);
                 }
             }
         }
         if(voiceNOM != null)
             voiceMoments.Add(voiceNOM);
     }
     return voiceMoments;
 }
Пример #34
0
 public abstract NoteObject GetNoteObject(Voice voice, IUniqueDef iud, bool firstLmddInVoice,
     ref byte currentVelocity, float musicFontHeight);
Пример #35
0
 public Voice(Staff staff, Voice voice)
 {
     Staff = staff;
     StemDirection = voice.StemDirection;
     this.AppendNoteObjects(voice.NoteObjects);
 }
Пример #36
0
        private string FindClefTypeAtEndOfStaff1(Voice staff1voice0)
        {
            ClefSymbol mainStaff1Clef = staff1voice0.NoteObjects[0] as ClefSymbol;
            Debug.Assert(mainStaff1Clef != null);

            string clefTypeAtEndOfStaff1 = mainStaff1Clef.ClefType;
            foreach(NoteObject noteObject in staff1voice0.NoteObjects)
            {
                ClefChangeSymbol ccs = noteObject as ClefChangeSymbol;
                if(ccs != null)
                {
                    clefTypeAtEndOfStaff1 = ccs.ClefType;
                }

            }
            return clefTypeAtEndOfStaff1;
        }
Пример #37
0
 private void InsertInvisibleClefChanges(Voice voice, int systemAbsMsPos, List<ClefChangeDef> clefChangeDefs)
 {
     foreach(ClefChangeDef ccd in clefChangeDefs)
     {
         int absPos = systemAbsMsPos + ccd.MsPositionReFirstUD;
         ClefChangeSymbol invisibleClefChangeSymbol = new ClefChangeSymbol(voice, ccd.ClefType, absPos, _pageFormat.CautionaryNoteheadsFontHeight);
         invisibleClefChangeSymbol.IsVisible = false;
         InsertInvisibleClefChangeInNoteObjects(voice, invisibleClefChangeSymbol);
     }
 }
Пример #38
0
 public NoteObject(Voice voice)
 {
     Voice = voice; // container
 }
Пример #39
0
 public NoteObject(Voice voice)
 {
     Voice = voice; // container
 }
Пример #40
0
 private List<ClefSymbol> GetClefs(Voice voice)
 {
     List<ClefSymbol> clefs = new List<ClefSymbol>();
     foreach(NoteObject noteObject in voice.NoteObjects)
     {
         ClefSymbol clef = noteObject as ClefSymbol;
         if(clef != null)
             clefs.Add(clef);
     }
     return clefs;
 }
Пример #41
0
        private void InsertInvisibleClefChangeInNoteObjects(Voice voice, ClefChangeSymbol invisibleClefChangeSymbol)
        {
            Debug.Assert(!(voice.NoteObjects[voice.NoteObjects.Count - 1] is Barline));

            int msPos = invisibleClefChangeSymbol.MsPosition;
            List<DurationSymbol> durationSymbols = new List<DurationSymbol>();
            foreach(DurationSymbol durationSymbol in voice.DurationSymbols)
            {
                durationSymbols.Add(durationSymbol);
            }

            Debug.Assert(durationSymbols.Count > 0);

            if(msPos <= durationSymbols[0].MsPosition)
            {
                InsertBeforeDS(voice.NoteObjects, durationSymbols[0], invisibleClefChangeSymbol);
            }
            else if(msPos > durationSymbols[durationSymbols.Count - 1].MsPosition)
            {
                // the noteObjects do not yet have a final barline (see Debug.Assert() above)
                voice.NoteObjects.Add(invisibleClefChangeSymbol);
            }
            else
            {
                Debug.Assert(durationSymbols.Count > 1);
                for(int i = 1; i < durationSymbols.Count; ++i)
                {
                    if(durationSymbols[i - 1].MsPosition < msPos && durationSymbols[i].MsPosition >= msPos)
                    {
                        InsertBeforeDS(voice.NoteObjects, durationSymbols[i], invisibleClefChangeSymbol);
                        break;
                    }
                }
            }
        }
Пример #42
0
 public NoteObject(Voice voice, double fontHeight)
 {
     Voice       = voice; // container
     _fontHeight = fontHeight;
 }
Пример #43
0
 public NormalBarline(Voice voice)
     : base(voice)
 {
 }