UNPKG

vexflow-musicxml

Version:

MusicXml Parser for vexflow

2,274 lines (594 loc) 25.1 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Measure</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: Measure</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span>Measure<span class="signature">()</span><span class="type-signature"></span></h2> <div class="class-description">Class representation of a measure</div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="Measure"><span class="type-signature"></span>new Measure<span class="signature">()</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_Measure.js.html">src/xml/Measure.js</a>, <a href="src_xml_Measure.js.html#line10">line 10</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Extends</h3> <ul> <li><a href="XmlObject.html">XmlObject</a></li> </ul> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="accept"><span class="type-signature"></span>accept<span class="signature">(visitor)</span><span class="type-signature"></span></h4> <div class="description"> Methods to hook in converters that can use this XML type for formatting </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>visitor</code></td> <td class="type"> <span class="param-type">Visitor</span> </td> <td class="description last">that converts XML to other formats</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="XmlObject.html#accept">XmlObject#accept</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line23">line 23</a> </li></ul></dd> </dl> <h4 class="name" id="addConnector"><span class="type-signature"></span>addConnector<span class="signature">(stave1:, stave2:, type:)</span><span class="type-signature"></span></h4> <div class="description"> Adds a connector between two staves </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>stave1:</code></td> <td class="type"> <span class="param-type">Stave</span> </td> <td class="description last">First stave</td> </tr> <tr> <td class="name"><code>stave2:</code></td> <td class="type"> <span class="param-type">Stave</span> </td> <td class="description last">Second stave</td> </tr> <tr> <td class="name"><code>type:</code></td> <td class="type"> <span class="param-type">Flow.StaveConnector.type</span> </td> <td class="description last">Type of connector</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_vex_Measure.js.html">src/vex/Measure.js</a>, <a href="src_vex_Measure.js.html#line100">line 100</a> </li></ul></dd> </dl> <h4 class="name" id="childExists"><span class="type-signature"></span>childExists<span class="signature">(name)</span><span class="type-signature"> &rarr; {bool}</span></h4> <div class="description"> childExists - Check if a child exists </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The tag name of the child</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="XmlObject.html#childExists">XmlObject#childExists</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line85">line 85</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> true if child exists, false otherwise </div> <dl> <dt> Type </dt> <dd> <span class="param-type">bool</span> </dd> </dl> <h4 class="name" id="getAttribute"><span class="type-signature"></span>getAttribute<span class="signature">(name)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> getAttribute - Gets a string representation of an attribute </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Attribute name</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="XmlObject.html#getAttribute">XmlObject#getAttribute</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line144">line 144</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Attribute value </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id="getChild"><span class="type-signature"></span>getChild<span class="signature">(name)</span><span class="type-signature"> &rarr; {DOMNode}</span></h4> <div class="description"> getChild - Gets a (usally the first) child by its tag name </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The tag name of the child</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="XmlObject.html#getChild">XmlObject#getChild</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line33">line 33</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> DOM node representation of the child </div> <dl> <dt> Type </dt> <dd> <span class="param-type">DOMNode</span> </dd> </dl> <h4 class="name" id="getChildren"><span class="type-signature"></span>getChildren<span class="signature">(name)</span><span class="type-signature"> &rarr; {DOMNodeList}</span></h4> <div class="description"> getChildren - Gets all children by its tag name </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The tag name of the child. If empty all children will be given</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="XmlObject.html#getChildren">XmlObject#getChildren</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line43">line 43</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> DOM node list representation of the children </div> <dl> <dt> Type </dt> <dd> <span class="param-type">DOMNodeList</span> </dd> </dl> <h4 class="name" id="getNotesByStaff"><span class="type-signature"></span>getNotesByStaff<span class="signature">(Number)</span><span class="type-signature"> &rarr; {<a href="Note.html">Note</a>}</span></h4> <div class="description"> Get all the notes belonging to the given staff. The staff number can be retrieved from getStaves </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>Number</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">of the staff.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_Measure.js.html">src/xml/Measure.js</a>, <a href="src_xml_Measure.js.html#line78">line 78</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>getStaves</li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> A Note class object </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Note.html">Note</a></span> </dd> </dl> <h4 class="name" id="getNum"><span class="type-signature"></span>getNum<span class="signature">(name)</span><span class="type-signature"> &rarr; {float}</span></h4> <div class="description"> getNum - Get the numeric representation of the node. Will return NaN if failed </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The tag name of the child</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="XmlObject.html#getNum">XmlObject#getNum</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line129">line 129</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Value of the node </div> <dl> <dt> Type </dt> <dd> <span class="param-type">float</span> </dd> </dl> <h4 class="name" id="getSiblings"><span class="type-signature"></span>getSiblings<span class="signature">(name)</span><span class="type-signature"> &rarr; {DOMNodeList}</span></h4> <div class="description"> getSiblings - Gets all siblings by its tag name </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The tag name of the sibling.</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="XmlObject.html#getSiblings">XmlObject#getSiblings</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line53">line 53</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> DOM node list representation of the children </div> <dl> <dt> Type </dt> <dd> <span class="param-type">DOMNodeList</span> </dd> </dl> <h4 class="name" id="getStaves"><span class="type-signature"></span>getStaves<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> Get the unique numbers of all staves in this measure </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_Measure.js.html">src/xml/Measure.js</a>, <a href="src_xml_Measure.js.html#line120">line 120</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Staves in this measure </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> <h4 class="name" id="getText"><span class="type-signature"></span>getText<span class="signature">(name)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> getText - Get the string representation of a node's text content </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The tag name of the child</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="XmlObject.html#getText">XmlObject#getText</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line95">line 95</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> string of the text content </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id="getTextArray"><span class="type-signature"></span>getTextArray<span class="signature">(name)</span><span class="type-signature"> &rarr; {Arrray}</span></h4> <div class="description"> getTextArray - Get the strings of the given child tags as array instead of string </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The tag name of the child</td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="XmlObject.html#getTextArray">XmlObject#getTextArray</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line112">line 112</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> string array of the text content </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Arrray</span> </dd> </dl> <h4 class="name" id="hasAttributes"><span class="type-signature"></span>hasAttributes<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Check if this Measure has Attributes </div> <dl class="details"> <dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>since version 0.2 every measure has attributes.</li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_Measure.js.html">src/xml/Measure.js</a>, <a href="src_xml_Measure.js.html#line130">line 130</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Indicates if the measure has Attributes </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id="isFirst"><span class="type-signature"></span>isFirst<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Check if this element is the first in the tag </div> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="XmlObject.html#isFirst">XmlObject#isFirst</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="src_xml_XmlObject.js.html">src/xml/XmlObject.js</a>, <a href="src_xml_XmlObject.js.html#line151">line 151</a> </li></ul></dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Test.html">Test</a></li></ul><h3>Classes</h3><ul><li><a href="ClefVisitor.html">ClefVisitor</a></li><li><a href="Key_Key.html">Key</a></li><li><a href="KeyVisitor.html">KeyVisitor</a></li><li><a href="Measure.html">Measure</a></li><li><a href="MeasureVisitor.html">MeasureVisitor</a></li><li><a href="MusicXmlRenderer.html">MusicXmlRenderer</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteVisitor.html">NoteVisitor</a></li><li><a href="Part.html">Part</a></li><li><a href="TimeSignatureVisitor.html">TimeSignatureVisitor</a></li><li><a href="TimeVisitor.html">TimeVisitor</a></li><li><a href="XmlObject.html">XmlObject</a></li><li><a href="XmlSerializer_XmlSerializer.html">XmlSerializer</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Nov 20 2017 21:30:34 GMT+0100 (CET) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>