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
26namespace MusicXML2
27{
28enum xmlErr { kNoErr, kInvalidFile, kUnsupported };
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34class musicxmlfactory;
35class xmlelement;
36class xmlattribute;
37
38typedef xmlelement* TElement;
39typedef xmlattribute* TAttribute;
40typedef musicxmlfactory* TFactory;
41
42
47EXP float musicxmllibVersion();
52EXP const char* musicxmllibVersionStr();
53
54
73EXP const char* musicxml2guidoVersionStr();
74
85
96
104EXP xmlErr musicxmlfile2guido (const char *file, bool generateBars, std::ostream& out);
105
113EXP xmlErr musicxmlfd2guido (FILE* fd, bool generateBars, std::ostream& out);
114
122EXP xmlErr musicxmlstring2guido(const char *buff, bool generateBars, std::ostream& out);
123
134EXP xmlErr musicxmlstring2guidoOnPart(const char * buffer, bool generateBars, int partFilter, std::ostream& out);
135
139/*
140\addtogroup Converting MusicXML to Antescofo Music Notation format
141
142The library includes a high level API to convert from the MusicXML format to the
143Antescofo Score Notation format. For more information about this format,
144see 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
152EXP int musicxml2antescofoVersion();
153 \brief Gives the Antescofo converter version as a string.
154 \return a string
155EXP const char* musicxml2antescofoVersionStr();
156*/
157
174EXP xmlErr musicxmlfd2antescofo (FILE* fd, bool generateBars, std::ostream& out);
175
183EXP xmlErr musicxmlstring2antescofo(const char *buff, bool generateBars, std::ostream& out);
262
268
274EXP void factoryPrint (TFactory f, std::ostream& out);
275
276
287EXP void factoryHeader (TFactory f, const char* worknumber, const char* worktitle, const char* movementnumber, const char* movementtitle);
288
289
296EXP void factoryCreator (TFactory f, const char* c, const char* type);
297
298
305EXP void factoryRights (TFactory f, const char* r, const char* type);
306
313EXP void factoryEncoding (TFactory f, const char* software);
314
321
332EXP void factoryAddGroup (TFactory f, int number, const char* name, const char* abbrev, bool groupbarline, TElement* parts);
333
341EXP void factoryAddElement (TFactory f, TElement elt, TElement subelt);
342
350EXP void factoryAddElements (TFactory f, TElement elt, TElement* subelts);
351
360
368EXP TElement factoryScorepart(TFactory f, const char* id, const char* name, const char* abbrev);
369
375EXP TElement factoryPart (TFactory f, const char* id);
376
382EXP TElement factoryMeasure (TFactory f, int number);
383
394EXP TElement factoryMeasureWithAttributes (TFactory f, int number, const char* time, const char* clef, int line, int key, int division);
395
405EXP TElement factoryNote (TFactory f, const char* step, float alter, int octave, int duration, const char* type);
406
414EXP TElement factoryDynamic (TFactory f, int type, const char* placement);
415
426EXP TElement factoryBarline (TFactory f, const char* location, const char* barstyle, const char *repeat);
427
437EXP void factoryTuplet (TFactory f, int actual, int normal, TElement * notes);
438
446EXP void factoryTie (TFactory f, TElement from, TElement to);
447
454EXP void factoryNotation (TFactory f, TElement elt, TElement notation);
455
462EXP void factoryArticulation (TFactory f, TElement elt, TElement articulation);
463
470EXP TElement factoryRest (TFactory f, int duration, const char* type);
471
480EXP void factoryChord (TFactory f, TElement * notes);
481
482
489
496EXP TElement factoryStrElement (TFactory f, int type, const char * value);
503EXP TElement factoryIntElement (TFactory f, int type, int value);
510EXP TElement factoryFloatElement (TFactory f, int type, float value);
511
512
519EXP TAttribute factoryStrAttribute (TFactory f, const char * name, const char* value);
526EXP TAttribute factoryIntAttribute (TFactory f, const char * name, int value);
533EXP 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 const char * musicxml2guidoVersionStr()
Gives the guido converter version as a string.
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 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 const char * musicxml2brailleVersionStr()
Gives the LilyPond converter version as a string.
EXP float musicxml2brailleVersion()
Gives the Braille converter version number.
EXP const char * musicxml2lilypondVersionStr()
Gives the LilyPond converter version as a string.
EXP float musicxml2guidoVersion()
Gives the guido converter version number.
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.