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
Definition: musicxmlfactory.h:26
A generic xml attribute representation.
Definition: xml.h:47
A generic xml element representation.
Definition: xml.h:86
EXP xmlErr musicxmlfd2guido(FILE *fd, bool generateBars, std::ostream &out)
Converts a MusicXML representation to the Guido format.
EXP float musicxml2lilypondVersion()
Gives the LilyPond converter version number.
EXP const char * musicxml2brailleVersionStr()
Gives the LilyPond converter version as a string.
EXP const char * musicxml2guidoVersionStr()
Gives the guido converter version as a string.
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.
EXP float musicxml2brailleVersion()
Gives the Braille converter version number.
EXP float musicxml2guidoVersion()
Gives the guido converter version number.
EXP const char * musicxml2lilypondVersionStr()
Gives the LilyPond converter version as a string.
EXP xmlErr musicxmlfile2guido(const char *file, bool generateBars, std::ostream &out)
Converts a MusicXML representation to the Guido format.
EXP xmlErr musicxmlstring2guido(const char *buff, bool generateBars, std::ostream &out)
Converts a MusicXML representation to the Guido format.
EXP void factoryAddElements(TFactory f, TElement elt, TElement *subelts)
Adds a set of elements to another element.
EXP TElement factoryBarline(TFactory f, const char *location, const char *barstyle, const char *repeat)
Creates a barline element with the corresponding sub-elements.
EXP void factoryFreeElement(TFactory f, TElement elt)
Frees a previously allocated element.
EXP void factoryNotation(TFactory f, TElement elt, TElement notation)
Add an element to a note notations element.
EXP TElement factoryDynamic(TFactory f, int type, const char *placement)
Creates a dynamics element containing a dynamic type.
EXP void factoryArticulation(TFactory f, TElement elt, TElement articulation)
Add an articulation to a note.
EXP TElement factoryNote(TFactory f, const char *step, float alter, int octave, int duration, const char *type)
Creates a note.
EXP void factoryFreeAttribute(TFactory f, TAttribute attr)
Frees a previously allocated attribute.
EXP void factoryHeader(TFactory f, const char *worknumber, const char *worktitle, const char *movementnumber, const char *movementtitle)
Creates header information.
EXP TElement factoryPart(TFactory f, const char *id)
Creates a 'part' element.
EXP TAttribute factoryIntAttribute(TFactory f, const char *name, int value)
Creates an arbitrary attribute with an integer value.
EXP void factoryPrint(TFactory f, std::ostream &out)
Print the MusicXML representation to stream.
EXP void factoryTie(TFactory f, TElement from, TElement to)
Tie two notes.
EXP TElement factoryRest(TFactory f, int duration, const char *type)
Creates a rest.
EXP void factoryClose(TFactory f)
Close a MusicXML factory.
EXP void factoryAddPart(TFactory f, TElement part)
Adds a part.
EXP TAttribute factoryStrAttribute(TFactory f, const char *name, const char *value)
Creates an arbitrary attribute with a string value.
EXP void factoryAddElement(TFactory f, TElement elt, TElement subelt)
Adds an element to another element.
EXP void factoryChord(TFactory f, TElement *notes)
Makes a chord from the gievn notes.
EXP void factoryEncoding(TFactory f, const char *software)
Creates encoding information.
EXP TElement factoryScorepart(TFactory f, const char *id, const char *name, const char *abbrev)
Creates a 'score-part' element.
EXP void factoryCreator(TFactory f, const char *c, const char *type)
Creates creator information.
EXP TElement factoryMeasure(TFactory f, int number)
Creates a 'measure' element.
EXP void factoryAddGroup(TFactory f, int number, const char *name, const char *abbrev, bool groupbarline, TElement *parts)
Adds parts grouped in a 'part-group'.
EXP void factoryTuplet(TFactory f, int actual, int normal, TElement *notes)
Makes a tuplet with notes.
EXP TFactory factoryOpen()
Creates a new MusicXML factory.
EXP TElement factoryStrElement(TFactory f, int type, const char *value)
Creates an arbitrary MusicXML element with a string value.
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.
EXP TElement factoryFloatElement(TFactory f, int type, float value)
Creates an arbitrary MusicXML element with a float value.
EXP void factoryRights(TFactory f, const char *r, const char *type)
Creates rights information.
EXP TElement factoryElement(TFactory f, int type)
Creates an arbitrary MusicXML element.
EXP TAttribute factoryFloatAttribute(TFactory f, const char *name, float value)
Creates an arbitrary attribute with a float value.
EXP void factoryAddAttribute(TFactory f, TElement elt, TAttribute attr)
Adds an attribute to an element.
EXP TElement factoryIntElement(TFactory f, int type, int value)
Creates an arbitrary MusicXML element with an integer value.