示例#1
0
文件: Barline.cs 项目: notator/Moritz
        /// <summary>
        /// Writes out an SVG Barline.
        /// May be called twice per staff.barline:
        ///     1. for the range between top and bottom stafflines (if Barline.Visible is true)
        ///     2. for the range between the staff's lower edge and the next staff's upper edge
        ///        (if the staff's lower neighbour is in the same group)
        /// </summary>
        /// <param name="w"></param>
        public void WriteSVG(SvgWriter w, float topStafflineY, float bottomStafflineY, float singleBarlineStrokeWidth, float stafflineStrokeWidth, bool isLastNoteObject, bool isConnector)
        {
            float topY = topStafflineY;
            float bottomY = bottomStafflineY;
            if(isLastNoteObject && !isConnector)
            {
                float halfStrokeWidth = (stafflineStrokeWidth / 2);
                topY -= halfStrokeWidth;
                bottomY += halfStrokeWidth;
            }

            string barlineType;
            if(BarlineType == BarlineType.end)
            {
                barlineType = isConnector ? null : "endBarlineLeft";
                w.SvgLine(barlineType,
                    this.Metrics.OriginX - (singleBarlineStrokeWidth * 3F), topY,
                    this.Metrics.OriginX - (singleBarlineStrokeWidth * 3F), bottomY,
                    "black", singleBarlineStrokeWidth, null);

                barlineType = isConnector ? null : "endBarlineRight";
                w.SvgLine(barlineType,
                    this.Metrics.OriginX, topY,
                    this.Metrics.OriginX, bottomY,
                    "black", singleBarlineStrokeWidth * 2F, null);
            }
            else
            {
                barlineType = isConnector ? null : "barline";
                w.SvgLine(barlineType, this.Metrics.OriginX, topY, this.Metrics.OriginX, bottomY, "black", singleBarlineStrokeWidth, null);
            }
        }
示例#2
0
文件: Barline.cs 项目: notator/Moritz
 /// <summary>
 /// This function only writes the staff name and barnumber to the SVG file (if they are present).
 /// The barline itself is drawn when the system (and staff edges) is complete.
 /// </summary>
 public override void WriteSVG(SvgWriter w, bool staffIsVisible)
 {
     BarlineMetrics barlineMetrics = Metrics as BarlineMetrics;
     if(barlineMetrics != null && staffIsVisible)
     {
         barlineMetrics.WriteSVG(w);
     }
 }
示例#3
0
        /// <summary>
        /// Writes out the stafflines and noteObjects of an OutputStaff.
        /// </summary>
        public override void WriteSVG(SvgWriter w, int systemNumber, int staffNumber)
        {
            w.SvgStartGroup("outputStaff");

            base.WriteSVG(w, true, systemNumber, staffNumber);

            w.SvgEndGroup(); // outputStaff
        }
示例#4
0
        /// <summary>
        /// Writes out the stafflines, and noteObjects for an InputStaff.
        /// </summary>
        public override void WriteSVG(SvgWriter w, int systemNumber, int staffNumber)
        {
            w.SvgStartGroup("inputStaff", "sys" + systemNumber.ToString() + "staff" + staffNumber.ToString());

            base.WriteSVG(w, true, systemNumber, staffNumber);

            w.SvgEndGroup(); // InputStaff
        }
示例#5
0
 /// <summary>
 /// Writes this ClefChangeSymbol to the SVG file if both _isVisible is true.
 /// The character metrics have been set in SvgSystem.Justify()
 /// </summary>
 public override void WriteSVG(SvgWriter w, bool staffIsVisible)
 {
     if(_isVisible && staffIsVisible)
     {
         w.SvgStartGroup("clefChange");
         base.WriteSVG(w, staffIsVisible);
         w.SvgEndGroup();
     }
 }
示例#6
0
 /// <summary>
 /// Writes this ClefChangeSymbol to the SVG file if both _isVisible is true.
 /// The character metrics have been set in SvgSystem.Justify()
 /// </summary>
 public override void WriteSVG(SvgWriter w, bool staffIsVisible)
 {
     if(_isVisible && staffIsVisible)
     {
         w.SvgStartGroup(null, "clefChange" + SvgScore.UniqueID_Number);
         base.WriteSVG(w, staffIsVisible);
         w.SvgEndGroup();
     }
 }
示例#7
0
文件: TrkRef.cs 项目: notator/Moritz
 internal void WriteSvg(SvgWriter w)
 {
     w.WriteStartElement("trkRef");
     w.WriteAttributeString("midiChannel", MidiChannel.ToString());
     w.WriteAttributeString("msPosition", _trkMsPosition.ToString());
     w.WriteAttributeString("nMidiObjects", _trkNumMidiObjects.ToString());
     if(TrkOptions != null)
     {
         TrkOptions.WriteSvg(w, false);
     }
     w.WriteEndElement(); // trk
 }
示例#8
0
文件: TrkOn.cs 项目: suvjunmd/Moritz
 internal void WriteSvg(SvgWriter w)
 {
     w.WriteStartElement("trkOn");
     w.WriteAttributeString("midiChannel", _trkMidiChannel.ToString());
     w.WriteAttributeString("msPosition", _trkMsPosition.ToString());
     w.WriteAttributeString("nMidiObjects", _trkNumMidiObjects.ToString());
     if(_inputControls != null)
     {
         _inputControls.WriteSvg(w);
     }
     w.WriteEndElement(); // trkOn
 }
        public override void WriteSVG(SvgWriter w, bool staffIsVisible)
        {
            if(Visible && staffIsVisible)
            {
                w.SvgStartGroup("cautionaryChord");
                w.SvgStartGroup(null);

                this.ChordMetrics.WriteSvg(w);

                w.SvgEndGroup();
                w.SvgEndGroup();
            }
        }
示例#10
0
        /// <summary>
        /// Writes out the (invisible) voices
        /// </summary>
        public override void WriteSVG(SvgWriter w, int systemNumber, int staffNumber)
        {
            w.SvgStartGroup("outputStaff");
            w.WriteAttributeString("score", "invisible", null, "1");

            int voiceNumber = 1;
            foreach(Voice voice in Voices)
            {
                voice.WriteSVG(w, false, systemNumber, staffNumber, voiceNumber++);
            }

            w.SvgEndGroup(); // outputStaff
        }
示例#11
0
        public override void WriteSVG(SvgWriter w, bool staffIsVisible)
        {
            if(Visible && staffIsVisible)
            {
                w.SvgStartGroup(null, "cautionaryChord" + SvgScore.UniqueID_Number);
                w.SvgStartGroup(null, null);

                this.ChordMetrics.WriteSvg(w);

                w.SvgEndGroup();
                w.SvgEndGroup();
            }
        }
示例#12
0
        public override void WriteSVG(SvgWriter w, bool staffIsVisible, int systemNumber, int staffNumber, int voiceNumber)
        {
            w.SvgStartGroup("outputVoice");

            if(MasterVolume != null) // is non-null only in the first system
            {
                w.WriteAttributeString("score", "midiChannel", null, MidiChannel.ToString());
                w.WriteAttributeString("score", "masterVolume", null, MasterVolume.ToString());
            }

            base.WriteSVG(w, staffIsVisible);
            w.SvgEndGroup(); // outputVoice
        }
示例#13
0
        /// <summary>
        /// Writes out the noteObjects, and possibly the performanceOptions for an InputVoice.
        /// </summary>
        public override void WriteSVG(SvgWriter w, bool staffIsVisible, int systemNumber, int staffNumber, int voiceNumber)
        {
            w.SvgStartGroup("inputVoice", "sys" + systemNumber.ToString() + "staff" + staffNumber.ToString() + "voice" + voiceNumber.ToString());

            if(_midiChannel < byte.MaxValue)
            {
                // This can only happen on the first system in the score. See SetMidiChannel(...) below.
                w.WriteAttributeString("score", "midiChannel", null, MidiChannel.ToString());
            }

            base.WriteSVG(w, true); // input voices are always visible

            w.SvgEndGroup(); // inputVoice
        }
示例#14
0
        public override void WriteSVG(SvgWriter w, bool staffIsVisible)
        {
            if(LocalCautionaryChordDef == null)
            {
                w.SvgStartGroup("rest", "rest" + SvgScore.UniqueID_Number);

                Debug.Assert(_msDuration > 0);
                if(staffIsVisible)
                {
                    w.WriteAttributeString("score", "alignmentX", null, ((Metrics.Left + Metrics.Right) / 2).ToString(M.En_USNumberFormat));
                }
                w.WriteAttributeString("score", "msDuration", null, _msDuration.ToString());

                if(this.Metrics != null && staffIsVisible)
                    this.Metrics.WriteSVG(w);

                w.SvgEndGroup();
            }
        }
示例#15
0
        public void WriteSVG(SvgWriter w)
        {
            w.WriteStartElement("sliders");

            if(PitchWheelMsbs != null && PitchWheelMsbs.Count > 0
                && !(PitchWheelMsbs.Count == 1 && PitchWheelMsbs[0] == M.DefaultPitchWheel))
                w.WriteAttributeString("pitchWheel", M.ByteListToString(PitchWheelMsbs));
            if(PanMsbs != null && PanMsbs.Count > 0
                && !(PanMsbs.Count == 1 && PanMsbs[0] == M.DefaultPan))
                w.WriteAttributeString("pan", M.ByteListToString(PanMsbs));
            if(ModulationWheelMsbs != null && ModulationWheelMsbs.Count > 0
                && !(ModulationWheelMsbs.Count == 1 && ModulationWheelMsbs[0] == M.DefaultModulationWheel))
                w.WriteAttributeString("modulationWheel", M.ByteListToString(ModulationWheelMsbs));
            if(ExpressionMsbs != null && ExpressionMsbs.Count > 0
                && !(ExpressionMsbs.Count == 1 && ExpressionMsbs[0] == M.DefaultExpression))
                w.WriteAttributeString("expressionSlider", M.ByteListToString(ExpressionMsbs));

            w.WriteEndElement();
        }
示例#16
0
        public override void WriteSVG(SvgWriter w, bool staffIsVisible)
        {
            if(staffIsVisible && ChordMetrics.BeamBlock != null)
                ChordMetrics.BeamBlock.WriteSVG(w);

            w.SvgStartGroup("outputChord", "outputChord" + SvgScore.UniqueID_Number);
            if(staffIsVisible)
            {
                w.WriteAttributeString("score", "alignmentX", null, ChordMetrics.OriginX.ToString(M.En_USNumberFormat));
            }

            _midiChordDef.WriteSvg(w);

            if(staffIsVisible)
            {
                w.SvgStartGroup(null, "graphics" + SvgScore.UniqueID_Number);
                ChordMetrics.WriteSVG(w);
                w.SvgEndGroup();
            }

            w.SvgEndGroup();
        }
示例#17
0
        internal void WriteSvg(SvgWriter w)
        {
            w.WriteStartElement("inputNote");
            w.WriteAttributeString("notatedKey", _notatedMidiPitch.ToString());

            if(TrkOptions != null)
            {
                TrkOptions.WriteSvg(w, false);
            }

            if(NoteOn != null)
            {
                NoteOn.WriteSvg(w);
            }

            if(NoteOff != null)
            {
                NoteOff.WriteSvg(w);
            }

            w.WriteEndElement(); // score:inputNote N.B. This element can be empty!
        }
示例#18
0
文件: SvgPage.cs 项目: notator/Moritz
        /// <summary>
        /// Writes this page.
        /// </summary>
        /// <param name="w"></param>
        public void WriteSVG(SvgWriter w, Metadata metadata)
        {
            int nOutputVoices = 0;
            int nInputVoices = 0;
            GetNumbersOfVoices(Systems[0], ref nOutputVoices, ref nInputVoices);

            w.WriteStartDocument(); // standalone="no"
            //<?xml-stylesheet href="../../fontsStyleSheet.css" type="text/css"?>
            w.WriteProcessingInstruction("xml-stylesheet", "href=\"../../fontsStyleSheet.css\" type=\"text/css\"");
            w.WriteStartElement("svg", "http://www.w3.org/2000/svg");

            WriteSvgHeader(w);

            WriteSodipodiNamedview(w);

            metadata.WriteSVG(w, _pageNumber, _score.PageCount, _pageFormat.AboutLinkURL, nOutputVoices, nInputVoices);

            _score.WriteDefs(w);

            #region layers

            int layerNumber = 1;

            if(_pageNumber > 0)
            {
                WriteFrameLayer(w, layerNumber++, "frame", _pageFormat.Right, _pageFormat.Bottom);
            }

            WriteScoreLayer(w, layerNumber++, "score", _pageNumber, metadata);

            WriteEmptyLayer(w, layerNumber++, "user annotations", true);
            #endregion layers

            w.WriteEndElement(); // close the svg element
            w.WriteEndDocument();
        }
示例#19
0
 /// <summary>
 /// Writes objects to the SVG file (in front of the stafflines).
 /// The CharacterMetrics have been set by calling CreateMetrics() in SvgSystem.Justify()
 /// </summary>
 public abstract void WriteSVG(SvgWriter w, bool staffIsVisible);
示例#20
0
        private void WriteFontDefs(SvgWriter w)
        {
            string fontDefs =
            @"
            @font-face
            {
                font-family: 'CLicht';
                src: url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.eot');
                src: url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.eot?#iefix') format('embedded-opentype'),
                url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.woff') format('woff'),
                url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.ttf') format('truetype'),
                url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.svg#webfontl9D2oOyX') format('svg');
                font-weight: normal;
                font-style: normal;
            }
            @font-face
            {
                font-family: 'Arial';
                src: url('http://james-ingram-act-two.de/fonts/arial.ttf') format('truetype');
                font-weight:400;
                font-style: normal;
            }
            @font-face
            {
                font-family: 'Open Sans';
                src: url('http://james-ingram-act-two.de/fonts/OpenSans-Regular.ttf') format('truetype');
                font-weight:400;
                font-style: normal;
            }
            @font-face
            {
                font-family: 'Open Sans Condensed';
                src: url('http://james-ingram-act-two.de/fonts/OpenSans-CondBold.ttf') format('truetype');
                font-weight:600;
                font-style: normal;
            }
            ";

            w.WriteStartElement("style");
            w.WriteAttributeString("type", "text/css");
            w.WriteString(fontDefs);
            w.WriteEndElement();
        }
示例#21
0
 public void WriteDefs(SvgWriter w)
 {
     Debug.Assert(Notator != null);
     w.SvgStartDefs(null);
     WriteFontDefs(w);
     Notator.SymbolSet.WriteSymbolDefinitions(w);
     w.SvgEndDefs(); // end of defs
 }
示例#22
0
        /// <summary>
        /// Writes an SVG file containing one page of the score.
        /// </summary>
        public void SaveSVGPage(string pagePath, SvgPage page, Metadata metadata)
        {
            if(File.Exists(pagePath))
            {
                File.Delete(pagePath);
            }

            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.IndentChars = ("\t");
            settings.CloseOutput = true;
            settings.NewLineOnAttributes = true;
            settings.NamespaceHandling = NamespaceHandling.OmitDuplicates;
            settings.Encoding = Encoding.GetEncoding("utf-8");

            using(SvgWriter w = new SvgWriter(pagePath, settings))
            {
                page.WriteSVG(w, metadata);
            }
        }
示例#23
0
        /// <summary>
        /// Writes a metadata element compatible with Inkscape's
        /// </summary>
        /// <param name="w"></param>
        /// <param name="pageNumber"></param>
        /// <param name="nScorePages"></param>
        public void WriteSVG(SvgWriter w, int pageNumber, int nScorePages, string aboutThePieceLinkURL, int nOutputVoices, int nInputVoices)
        {
            Debug.Assert(!String.IsNullOrEmpty(MainTitle));

            string pageTitle;
            if(pageNumber == 0)
            {
                pageTitle = MainTitle + " (scroll)";
            }
            else
            {
                pageTitle = MainTitle + ", page " + pageNumber.ToString() + " of " + nScorePages.ToString();
            }

            w.WriteStartElement("title");
            w.WriteAttributeString("id", "pageTitle");
            w.WriteString(pageTitle);
            w.WriteEndElement();

            w.WriteStartElement("metadata"); // Inkscape compatible
            w.WriteAttributeString("id", "metadata");
            w.WriteStartElement("rdf", "RDF", null);
            w.WriteStartElement("cc", "Work", null);
            w.WriteAttributeString("rdf", "about", null, "");

            w.WriteStartElement("dc", "format", null);
            w.WriteString("image/svg+xml");
            w.WriteEndElement(); // ends the dc:format element

            w.WriteStartElement("dc", "type", null);
            w.WriteAttributeString("rdf", "resource", null, "http://purl.org/dc/dcmitype/StillImage");
            w.WriteEndElement(); // ends the dc:type element

            w.WriteStartElement("dc", "title", null);
            w.WriteString(pageTitle);
            w.WriteEndElement(); // ends the dc:title element

            w.WriteStartElement("dc", "date", null);
            w.WriteString(M.NowString);
            w.WriteEndElement(); // ends the dc:date element

            w.WriteStartElement("dc", "creator", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString("James Ingram");
            w.WriteEndElement(); // ends the dc:title element
            w.WriteEndElement(); // ends the cc:Agent element
            w.WriteEndElement(); // ends the dc:creator element

            w.WriteStartElement("dc", "source", null);
            w.WriteString("Website: http://www.james-ingram-act-two.de");
            w.WriteEndElement(); // ends the dc:source element

            if(!string.IsNullOrEmpty(Keywords))
            {
                w.WriteStartElement("dc", "subject", null);
                w.WriteStartElement("rdf", "Bag", null);
                w.WriteStartElement("rdf", "li", null);
                w.WriteString(Keywords);
                w.WriteEndElement(); // ends the rdf:li element
                w.WriteEndElement(); // ends the rdf:Bag element
                w.WriteEndElement(); // ends the dc:subject element
            }

            StringBuilder desc = new StringBuilder("About: " + aboutThePieceLinkURL );
            if(pageNumber == 0)
            {
                desc.Append("\nNumber of pages in the score: 1");
            }
            else
            {
                desc.Append("\nNumber of pages in the score: " + nScorePages.ToString());
            }
            desc.Append("\nNumber of output voices: " + nOutputVoices.ToString());
            desc.Append("\nNumber of input voices: " + nInputVoices.ToString());
            if(!String.IsNullOrEmpty(Comment))
                desc.Append("\nComments: " + Comment);

            w.WriteStartElement("dc", "description", null);
            w.WriteString(desc.ToString());
            w.WriteEndElement(); // ends the dc:description element

            string contributor = "Originally created using Assistant Composer software:" +
                            "\nhttp://james-ingram-act-two.de/moritz3/assistantComposer/assistantComposer.html" +
                            "\nAnnotations, if there are any, have been made using Inkscape.";
            w.WriteStartElement("dc", "contributor", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString(contributor);
            w.WriteEndElement(); // ends the dc:title element
            w.WriteEndElement(); // ends the cc:Agent element
            w.WriteEndElement(); // ends the dc:creator element

            w.WriteEndElement(); // ends the cc:Work element
            w.WriteEndElement(); // ends the rdf:RDF element
            w.WriteEndElement(); // ends the metadata element
        }
示例#24
0
        /// <summary>
        /// Note that, unlike Rests, MidiChordDefs do not have a msDuration attribute.
        /// Their msDuration is deduced from the contained BasicMidiChords.
        /// Patch indices already set in the BasicMidiChordDefs take priority over those set in the main MidiChordDef.
        /// However, if BasicMidiChordDefs[0].PatchIndex is null, and this.Patch is set, BasicMidiChordDefs[0].PatchIndex is set to Patch.
        /// The same is true for Bank settings.  
        /// The AssistantPerformer therefore only needs to look at BasicMidiChordDefs to find Bank and Patch changes.
        /// While constructing Tracks, the AssistantPerformer should monitor the current Bank and/or Patch, so that it can decide
        /// whether or not to actually construct and send bank and/or patch change messages.
        /// </summary>
        public void WriteSvg(SvgWriter w)
        {
            w.WriteStartElement("score", "midiChord", null);

            Debug.Assert(BasicMidiChordDefs != null && BasicMidiChordDefs.Count > 0);

            if(BasicMidiChordDefs[0].BankIndex == null && Bank != null)
            {
                BasicMidiChordDefs[0].BankIndex = Bank;
            }
            if(BasicMidiChordDefs[0].PatchIndex == null && Patch != null)
            {
                BasicMidiChordDefs[0].PatchIndex = Patch;
            }
            if(HasChordOff == false)
                w.WriteAttributeString("hasChordOff", "0");
            if(PitchWheelDeviation != null && PitchWheelDeviation != M.DefaultPitchWheelDeviation)
                w.WriteAttributeString("pitchWheelDeviation", PitchWheelDeviation.ToString());
            if(MinimumBasicMidiChordMsDuration != M.DefaultMinimumBasicMidiChordMsDuration)
                w.WriteAttributeString("minBasicChordMsDuration", MinimumBasicMidiChordMsDuration.ToString());

            w.WriteStartElement("basicChords");
            foreach(BasicMidiChordDef basicMidiChord in BasicMidiChordDefs) // containing basic <midiChord> elements
                basicMidiChord.WriteSVG(w);
            w.WriteEndElement();

            if(MidiChordSliderDefs != null)
                MidiChordSliderDefs.WriteSVG(w); // writes sliders element

            w.WriteEndElement(); // score:midiChord
        }
示例#25
0
 public override void WriteSVG(SvgWriter w)
 {
     w.SvgStartGroup(null, "beamBlock" + SvgScore.UniqueID_Number);
     foreach(Beam beam in Beams)
     {
         if(!(beam is QuaverBeam))
         {
             float topLeft = 0F;
             float topRight = 0F;
             if(_stemDirection == VerticalDir.down)
             {
                 topLeft = beam.LeftTopY + _beamThickness;
                 topRight = beam.RightTopY + _beamThickness;
             }
             else
             {
                 topLeft = beam.LeftTopY - _beamThickness;
                 topRight = beam.RightTopY - _beamThickness;
             }
             w.SvgBeam("beam" + SvgScore.UniqueID_Number, beam.LeftX, beam.RightX, topLeft, topRight, _beamThickness * 1.5F, 0F, 0.65F);
         }
         w.SvgBeam("beam" + SvgScore.UniqueID_Number, beam.LeftX, beam.RightX, beam.LeftTopY, beam.RightTopY, _beamThickness, _strokeThickness, 1.0F);
     }
     w.SvgEndGroup();
 }
示例#26
0
 private void WriteMaxMinVolume(SvgWriter w)
 {
     if(_maximumVolume == null || _minimumVolume == null)
     {
         Debug.Assert(false,
             "If any of the continuous controllers is set to control the *volume*,\n" +
             "then both MaximumVolume and MinimumVolume must also be set.\n\n" +
             "Use either the PressureVolume(...) or ModWheelVolume(...) constructor.");
     }
     if(_maximumVolume <= _minimumVolume)
     {
         Debug.Assert(false,
             "MaximumVolume must be greater than MinimumVolume.");
     }
     w.WriteAttributeString("maxVolume", _maximumVolume.ToString());
     w.WriteAttributeString("minVolume", _minimumVolume.ToString());
 }
示例#27
0
        public void WriteSvg(SvgWriter w, string elementName)
        {
            Debug.Assert((_pressureOption != CControllerType.undefined || _pressureVolumeOption == true)
                    || (_modWheelOption != CControllerType.undefined || _modWheelVolumeOption == true)
                    || (_pitchWheelOption != PitchWheelOption.undefined), "Attempt to write an empty TrackCCSettings element.");

            w.WriteStartElement(elementName);

            if(_midiChannel != null)
            {
                w.WriteAttributeString("midiChannel", _midiChannel.ToString());
            }

            bool isControllingVolume = false;
            if(_pressureOption != CControllerType.undefined)
            {
                w.WriteAttributeString("pressure", _pressureOption.ToString());
            }
            else if(_pressureVolumeOption == true)
            {
                w.WriteAttributeString("pressure", "volume");
                WriteMaxMinVolume(w);
                isControllingVolume = true;
            }

            if(_pitchWheelOption != PitchWheelOption.undefined)
            {
                w.WriteAttributeString("pitchWheel", _pitchWheelOption.ToString());
                switch(_pitchWheelOption)
                {
                    case PitchWheelOption.pitch:
                        //(range 0..127)
                        Debug.Assert(_pitchWheelDeviationOption != null && _pitchWheelDeviationOption >= 0 && _pitchWheelDeviationOption <= 127);
                        w.WriteAttributeString("pitchWheelDeviation", _pitchWheelDeviationOption.ToString());
                        break;
                    case PitchWheelOption.pan:
                        //(range 0..127, centre is 64)
                        Debug.Assert(_panOriginOption != null && _panOriginOption >= 0 && _panOriginOption <= 127);
                        w.WriteAttributeString("panOrigin", _panOriginOption.ToString());
                        break;
                    case PitchWheelOption.speed:
                        // maximum speed is when durations = durations / speedDeviation
                        // minimum speed is when durations = durations * speedDeviation
                        Debug.Assert(_speedDeviationOption != null && _speedDeviationOption >= 1);
                        w.WriteAttributeString("speedDeviation", ((float)_speedDeviationOption).ToString(M.En_USNumberFormat));
                        break;
                }
            }

            if(_modWheelOption != CControllerType.undefined)
            {
                w.WriteAttributeString("modWheel", _modWheelOption.ToString());
            }
            else if(_modWheelVolumeOption == true)
            {
                Debug.Assert(isControllingVolume == false, "Can't control volume with both pressure and modWheel.");
                w.WriteAttributeString("modWheel", "volume");
                WriteMaxMinVolume(w);
                isControllingVolume = true;
            }

            w.WriteEndElement(); // "default" or "track"
        }
示例#28
0
        public void WriteSvg(SvgWriter w)
        {
            w.WriteStartElement("score", "ccSettings", null);

            if(_defaultSettings != null)
            {
                _defaultSettings.WriteSvg(w, "default");
            }
            if(_overrideSettings != null)
            {
                foreach(TrackCCSettings tccs in _overrideSettings)
                {
                    tccs.WriteSvg(w, "track");
                }
            }
            w.WriteEndElement(); // score:ccSettings
        }
示例#29
0
        public override void WriteSVG(SvgWriter w, bool staffIsVisible)
        {
            if(ChordMetrics.BeamBlock != null)
                ChordMetrics.BeamBlock.WriteSVG(w);

            w.SvgStartGroup("inputChord");

            Debug.Assert(_msDuration > 0);

            if(staffIsVisible)
            {
                w.WriteAttributeString("score", "alignmentX", null, ChordMetrics.OriginX.ToString(M.En_USNumberFormat));
            }
            w.WriteAttributeString("score", "msDuration", null, _msDuration.ToString());

            _inputChordDef.WriteSvg(w);

            w.SvgStartGroup("graphics");
            ChordMetrics.WriteSVG(w);
            w.SvgEndGroup();

            w.SvgEndGroup();
        }
示例#30
0
 public abstract void WriteSymbolDefinitions(SvgWriter w);
示例#31
0
        public void WriteSVG(SvgWriter w, int pageNumber, int nScorePages, int nOutputVoices)
        {
            string pageTitle;

            if (pageNumber == 0)
            {
                pageTitle = base.Title + " (scroll)";
            }
            else
            {
                pageTitle = base.Title + ", page " + pageNumber.ToString() + " of " + nScorePages.ToString();
            }

            w.WriteStartElement("title");
            w.WriteAttributeString("class", "pageTitle");
            w.WriteString(pageTitle);
            w.WriteEndElement();

            w.WriteStartElement(CSSObjectClass.metadata.ToString()); // Inkscape compatible
            w.WriteAttributeString("class", CSSObjectClass.metadata.ToString());
            w.WriteStartElement("rdf", "RDF", null);
            w.WriteStartElement("cc", "Work", null);
            w.WriteAttributeString("rdf", "about", null, "");

            w.WriteStartElement("dc", "format", null);
            w.WriteString("image/svg+xml");
            w.WriteEndElement();             // ends the dc:format element

            w.WriteStartElement("dc", "type", null);
            w.WriteAttributeString("rdf", "resource", null, "http://purl.org/dc/dcmitype/StillImage");
            w.WriteEndElement();             // ends the dc:type element

            w.WriteStartElement("dc", "title", null);
            w.WriteString(pageTitle);
            w.WriteEndElement();             // ends the dc:title element

            w.WriteStartElement("dc", "date", null);
            w.WriteString(M.NowString);
            w.WriteEndElement();             // ends the dc:date element

            w.WriteStartElement("dc", "creator", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString("James Ingram");
            w.WriteEndElement();             // ends the dc:title element
            w.WriteEndElement();             // ends the cc:Agent element
            w.WriteEndElement();             // ends the dc:creator element

            w.WriteStartElement("dc", "source", null);
            w.WriteString("Website: https://www.james-ingram-act-two.de");
            w.WriteEndElement();             // ends the dc:source element

            if (!string.IsNullOrEmpty(Keywords))
            {
                w.WriteStartElement("dc", "subject", null);
                w.WriteStartElement("rdf", "Bag", null);
                w.WriteStartElement("rdf", "li", null);
                w.WriteString(Keywords);
                w.WriteEndElement();                 // ends the rdf:li element
                w.WriteEndElement();                 // ends the rdf:Bag element
                w.WriteEndElement();                 // ends the dc:subject element
            }

            StringBuilder desc = new StringBuilder();

            if (pageNumber == 0)
            {
                desc.Append("\nNumber of pages in the score: 1");
            }
            else
            {
                desc.Append("\nNumber of pages in the score: " + nScorePages.ToString());
            }
            desc.Append("\nNumber of output voices: " + nOutputVoices.ToString());
            if (!String.IsNullOrEmpty(Comment))
            {
                desc.Append("\nComments: " + Comment);
            }

            w.WriteStartElement("dc", "description", null);
            w.WriteString(desc.ToString());
            w.WriteEndElement();             // ends the dc:description element

            string contributor = "Originally created using Assistant Composer software:" +
                                 "\nhttps://james-ingram-act-two.de/moritz3/assistantComposer/assistantComposer.html" +
                                 "\nAnnotations, if there are any, have been made using Inkscape.";

            w.WriteStartElement("dc", "contributor", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString(contributor);
            w.WriteEndElement();             // ends the dc:title element
            w.WriteEndElement();             // ends the cc:Agent element
            w.WriteEndElement();             // ends the dc:creator element

            w.WriteEndElement();             // ends the cc:Work element
            w.WriteEndElement();             // ends the rdf:RDF element
            w.WriteEndElement();             // ends the metadata element
        }