LibMusicXML  3.18
libmusicxml.h
1 /*
2  MusicXML Library
3  Copyright (C) Grame 2006-2013
4 
5  This Source Code Form is subject to the terms of the Mozilla Public
6  License, v. 2.0. If a copy of the MPL was not distributed with this
7  file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9  Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
10  research@grame.fr
11 */
12 
13 #ifndef __libmusicxml__
14 #define __libmusicxml__
15 
16 #ifdef MSVC
17 # pragma warning (disable : 4786)
18 #endif
19 
20 #include <iostream>
21 #include <string>
22 #include <stdio.h>
23 
24 #include "exports.h"
25 
26 namespace MusicXML2
27 {
28 enum xmlErr { kNoErr, kInvalidFile, kUnsupported };
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 class musicxmlfactory;
35 class xmlelement;
36 class xmlattribute;
37 
38 typedef xmlelement* TElement;
39 typedef xmlattribute* TAttribute;
40 typedef musicxmlfactory* TFactory;
41 
42 
47 EXP float musicxmllibVersion();
52 EXP const char* musicxmllibVersionStr();
53 
54 
73 EXP const char* musicxml2guidoVersionStr();
74 
84 EXP const char* musicxml2lilypondVersionStr();
85 
95 EXP const char* musicxml2brailleVersionStr();
96 
104 EXP xmlErr musicxmlfile2guido (const char *file, bool generateBars, std::ostream& out);
105 
113 EXP xmlErr musicxmlfd2guido (FILE* fd, bool generateBars, std::ostream& out);
114 
122 EXP xmlErr musicxmlstring2guido(const char *buff, bool generateBars, std::ostream& out);
123 
134 EXP xmlErr musicxmlstring2guidoOnPart(const char * buffer, bool generateBars, int partFilter, std::ostream& out);
135 
139 /*
140 \addtogroup Converting MusicXML to Antescofo Music Notation format
141 
142 The library includes a high level API to convert from the MusicXML format to the
143 Antescofo Score Notation format. For more information about this format,
144 see http://repmus.ircam.fr/antescofo
145 @{
146 */
147 
148 /*
149  \brief Gives the Antescofo converter version number.
150  \return a version number as an integer (e.g. version 1.0.0 is returned as 100)
151 
152 EXP int musicxml2antescofoVersion();
153  \brief Gives the Antescofo converter version as a string.
154  \return a string
155 EXP const char* musicxml2antescofoVersionStr();
156 */
157 
174 EXP xmlErr musicxmlfd2antescofo (FILE* fd, bool generateBars, std::ostream& out);
175 
183 EXP xmlErr musicxmlstring2antescofo(const char *buff, bool generateBars, std::ostream& out);
262 
267 EXP void factoryClose (TFactory f);
268 
274 EXP void factoryPrint (TFactory f, std::ostream& out);
275 
276 
287 EXP void factoryHeader (TFactory f, const char* worknumber, const char* worktitle, const char* movementnumber, const char* movementtitle);
288 
289 
296 EXP void factoryCreator (TFactory f, const char* c, const char* type);
297 
298 
305 EXP void factoryRights (TFactory f, const char* r, const char* type);
306 
313 EXP void factoryEncoding (TFactory f, const char* software);
314 
320 EXP void factoryAddPart (TFactory f, TElement part);
321 
332 EXP void factoryAddGroup (TFactory f, int number, const char* name, const char* abbrev, bool groupbarline, TElement* parts);
333 
341 EXP void factoryAddElement (TFactory f, TElement elt, TElement subelt);
342 
350 EXP void factoryAddElements (TFactory f, TElement elt, TElement* subelts);
351 
360 
368 EXP TElement factoryScorepart(TFactory f, const char* id, const char* name, const char* abbrev);
369 
375 EXP TElement factoryPart (TFactory f, const char* id);
376 
382 EXP TElement factoryMeasure (TFactory f, int number);
383 
394 EXP TElement factoryMeasureWithAttributes (TFactory f, int number, const char* time, const char* clef, int line, int key, int division);
395 
405 EXP TElement factoryNote (TFactory f, const char* step, float alter, int octave, int duration, const char* type);
406 
414 EXP TElement factoryDynamic (TFactory f, int type, const char* placement);
415 
426 EXP TElement factoryBarline (TFactory f, const char* location, const char* barstyle, const char *repeat);
427 
437 EXP void factoryTuplet (TFactory f, int actual, int normal, TElement * notes);
438 
446 EXP void factoryTie (TFactory f, TElement from, TElement to);
447 
454 EXP void factoryNotation (TFactory f, TElement elt, TElement notation);
455 
462 EXP void factoryArticulation (TFactory f, TElement elt, TElement articulation);
463 
470 EXP TElement factoryRest (TFactory f, int duration, const char* type);
471 
480 EXP void factoryChord (TFactory f, TElement * notes);
481 
482 
488 EXP TElement factoryElement (TFactory f, int type);
489 
496 EXP TElement factoryStrElement (TFactory f, int type, const char * value);
503 EXP TElement factoryIntElement (TFactory f, int type, int value);
510 EXP TElement factoryFloatElement (TFactory f, int type, float value);
511 
512 
519 EXP TAttribute factoryStrAttribute (TFactory f, const char * name, const char* value);
526 EXP TAttribute factoryIntAttribute (TFactory f, const char * name, int value);
533 EXP TAttribute factoryFloatAttribute (TFactory f, const char * name, float value);
534 
543 
552 
556 #ifdef __cplusplus
557 }
558 #endif
559 
560 }
561 
562 #endif
MusicXML2::xmlattribute
A generic xml attribute representation.
Definition: xml.h:47
MusicXML2::factoryBarline
EXP TElement factoryBarline(TFactory f, const char *location, const char *barstyle, const char *repeat)
Creates a barline element with the corresponding sub-elements.
MusicXML2::factoryFloatAttribute
EXP TAttribute factoryFloatAttribute(TFactory f, const char *name, float value)
Creates an arbitrary attribute with a float value.
MusicXML2::factoryTie
EXP void factoryTie(TFactory f, TElement from, TElement to)
Tie two notes.
MusicXML2::factoryAddElements
EXP void factoryAddElements(TFactory f, TElement elt, TElement *subelts)
Adds a set of elements to another element.
MusicXML2::factoryChord
EXP void factoryChord(TFactory f, TElement *notes)
Makes a chord from the gievn notes.
MusicXML2::musicxmlstring2guido
EXP xmlErr musicxmlstring2guido(const char *buff, bool generateBars, std::ostream &out)
Converts a MusicXML representation to the Guido format.
MusicXML2::musicxml2brailleVersionStr
EXP const char * musicxml2brailleVersionStr()
Gives the LilyPond converter version as a string.
MusicXML2::factoryOpen
EXP TFactory factoryOpen()
Creates a new MusicXML factory.
MusicXML2::factoryRest
EXP TElement factoryRest(TFactory f, int duration, const char *type)
Creates a rest.
MusicXML2::factoryStrAttribute
EXP TAttribute factoryStrAttribute(TFactory f, const char *name, const char *value)
Creates an arbitrary attribute with a string value.
MusicXML2::factoryStrElement
EXP TElement factoryStrElement(TFactory f, int type, const char *value)
Creates an arbitrary MusicXML element with a string value.
MusicXML2::factoryMeasure
EXP TElement factoryMeasure(TFactory f, int number)
Creates a 'measure' element.
MusicXML2::factoryMeasureWithAttributes
EXP TElement factoryMeasureWithAttributes(TFactory f, int number, const char *time, const char *clef, int line, int key, int division)
Creates a 'measure' element with a set of attributes.
MusicXML2::factoryDynamic
EXP TElement factoryDynamic(TFactory f, int type, const char *placement)
Creates a dynamics element containing a dynamic type.
MusicXML2::factoryPart
EXP TElement factoryPart(TFactory f, const char *id)
Creates a 'part' element.
MusicXML2::factoryNote
EXP TElement factoryNote(TFactory f, const char *step, float alter, int octave, int duration, const char *type)
Creates a note.
MusicXML2::musicxmlstring2guidoOnPart
EXP xmlErr musicxmlstring2guidoOnPart(const char *buffer, bool generateBars, int partFilter, std::ostream &out)
Converts a MusicXML representation to the Guido format ONLY on asked Part number ID.
MusicXML2::xmlelement
A generic xml element representation.
Definition: xml.h:86
MusicXML2::factoryRights
EXP void factoryRights(TFactory f, const char *r, const char *type)
Creates rights information.
MusicXML2::factoryHeader
EXP void factoryHeader(TFactory f, const char *worknumber, const char *worktitle, const char *movementnumber, const char *movementtitle)
Creates header information.
MusicXML2::musicxml2lilypondVersion
EXP float musicxml2lilypondVersion()
Gives the LilyPond converter version number.
MusicXML2::factoryAddAttribute
EXP void factoryAddAttribute(TFactory f, TElement elt, TAttribute attr)
Adds an attribute to an element.
MusicXML2::factoryTuplet
EXP void factoryTuplet(TFactory f, int actual, int normal, TElement *notes)
Makes a tuplet with notes.
MusicXML2::musicxml2guidoVersionStr
EXP const char * musicxml2guidoVersionStr()
Gives the guido converter version as a string.
MusicXML2::factoryArticulation
EXP void factoryArticulation(TFactory f, TElement elt, TElement articulation)
Add an articulation to a note.
MusicXML2::factoryElement
EXP TElement factoryElement(TFactory f, int type)
Creates an arbitrary MusicXML element.
MusicXML2::factoryScorepart
EXP TElement factoryScorepart(TFactory f, const char *id, const char *name, const char *abbrev)
Creates a 'score-part' element.
MusicXML2::factoryFloatElement
EXP TElement factoryFloatElement(TFactory f, int type, float value)
Creates an arbitrary MusicXML element with a float value.
MusicXML2::factoryClose
EXP void factoryClose(TFactory f)
Close a MusicXML factory.
MusicXML2::factoryFreeAttribute
EXP void factoryFreeAttribute(TFactory f, TAttribute attr)
Frees a previously allocated attribute.
MusicXML2::factoryFreeElement
EXP void factoryFreeElement(TFactory f, TElement elt)
Frees a previously allocated element.
MusicXML2::musicxmlfile2guido
EXP xmlErr musicxmlfile2guido(const char *file, bool generateBars, std::ostream &out)
Converts a MusicXML representation to the Guido format.
MusicXML2::factoryAddPart
EXP void factoryAddPart(TFactory f, TElement part)
Adds a part.
MusicXML2::factoryEncoding
EXP void factoryEncoding(TFactory f, const char *software)
Creates encoding information.
MusicXML2::musicxml2guidoVersion
EXP float musicxml2guidoVersion()
Gives the guido converter version number.
MusicXML2::musicxmlfactory
Definition: musicxmlfactory.h:26
MusicXML2::musicxmlfd2guido
EXP xmlErr musicxmlfd2guido(FILE *fd, bool generateBars, std::ostream &out)
Converts a MusicXML representation to the Guido format.
MusicXML2::factoryCreator
EXP void factoryCreator(TFactory f, const char *c, const char *type)
Creates creator information.
MusicXML2::factoryNotation
EXP void factoryNotation(TFactory f, TElement elt, TElement notation)
Add an element to a note notations element.
MusicXML2::factoryPrint
EXP void factoryPrint(TFactory f, std::ostream &out)
Print the MusicXML representation to stream.
MusicXML2::factoryAddElement
EXP void factoryAddElement(TFactory f, TElement elt, TElement subelt)
Adds an element to another element.
MusicXML2::factoryIntAttribute
EXP TAttribute factoryIntAttribute(TFactory f, const char *name, int value)
Creates an arbitrary attribute with an integer value.
MusicXML2::factoryAddGroup
EXP void factoryAddGroup(TFactory f, int number, const char *name, const char *abbrev, bool groupbarline, TElement *parts)
Adds parts grouped in a 'part-group'.
MusicXML2::musicxml2brailleVersion
EXP float musicxml2brailleVersion()
Gives the Braille converter version number.
MusicXML2::musicxml2lilypondVersionStr
EXP const char * musicxml2lilypondVersionStr()
Gives the LilyPond converter version as a string.
MusicXML2::factoryIntElement
EXP TElement factoryIntElement(TFactory f, int type, int value)
Creates an arbitrary MusicXML element with an integer value.