LibMusicXML 3.22
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
63
73EXP const char* musicxml2guidoVersionStr();
74
85EXP xmlErr musicxmlfile2guido (const char *file, bool generateBars, int beginMeasure, int endMeasure, int partFilter, std::ostream& out);
86
97EXP xmlErr musicxmlfd2guido (FILE* fd, bool generateBars, int beginMeasure, int endMeasure, int partFilter, std::ostream& out);
98
106EXP xmlErr musicxmlstring2guido(const char *buff, bool generateBars, std::ostream& out);
107
119EXP xmlErr musicxmlstring2guidoOnPart(const char * buffer, bool generateBars, int partFilter, std::ostream& out);
120
134EXP xmlErr musicxmlstring2guidoPartial(const char * buffer,
135 bool generateBars,
136 int partFilter,
137 int beginMeasure,
138 int endMeasure,
139 std::ostream& out);
140
141
143
144
145/*
146\addtogroup Converting MusicXML to Antescofo Music Notation format
147
148The library includes a high level API to convert from the MusicXML format to the
149Antescofo Score Notation format. For more information about this format,
150see http://repmus.ircam.fr/antescofo
151@{
152*/
153
154/*
155 \brief Gives the Antescofo converter version number.
156 \return a version number as an integer (e.g. version 1.0.0 is returned as 100)
157
158EXP int musicxml2antescofoVersion();
159 \brief Gives the Antescofo converter version as a string.
160 \return a string
161EXP const char* musicxml2antescofoVersionStr();
162*/
163
172
180EXP xmlErr musicxmlfd2antescofo (FILE* fd, bool generateBars, std::ostream& out);
181
189EXP xmlErr musicxmlstring2antescofo(const char *buff, bool generateBars, std::ostream& out);
191
192
262
267EXP TFactory factoryOpen ();
268
273EXP void factoryClose (TFactory f);
274
280EXP void factoryPrint (TFactory f, std::ostream& out);
281
282
293EXP void factoryHeader (TFactory f, const char* worknumber, const char* worktitle, const char* movementnumber, const char* movementtitle);
294
295
302EXP void factoryCreator (TFactory f, const char* c, const char* type);
303
304
311EXP void factoryRights (TFactory f, const char* r, const char* type);
312
319EXP void factoryEncoding (TFactory f, const char* software);
320
326EXP void factoryAddPart (TFactory f, TElement part);
327
338EXP void factoryAddGroup (TFactory f, int number, const char* name, const char* abbrev, bool groupbarline, TElement* parts);
339
347EXP void factoryAddElement (TFactory f, TElement elt, TElement subelt);
348
356EXP void factoryAddElements (TFactory f, TElement elt, TElement* subelts);
357
365EXP void factoryAddAttribute (TFactory f, TElement elt, TAttribute attr);
366
374EXP TElement factoryScorepart(TFactory f, const char* id, const char* name, const char* abbrev);
375
381EXP TElement factoryPart (TFactory f, const char* id);
382
388EXP TElement factoryMeasure (TFactory f, int number);
389
400EXP TElement factoryMeasureWithAttributes (TFactory f, int number, const char* time, const char* clef, int line, int key, int division);
401
411EXP TElement factoryNote (TFactory f, const char* step, float alter, int octave, int duration, const char* type);
412
420EXP TElement factoryDynamic (TFactory f, int type, const char* placement);
421
432EXP TElement factoryBarline (TFactory f, const char* location, const char* barstyle, const char *repeat);
433
443EXP void factoryTuplet (TFactory f, int actual, int normal, TElement * notes);
444
452EXP void factoryTie (TFactory f, TElement from, TElement to);
453
460EXP void factoryNotation (TFactory f, TElement elt, TElement notation);
461
468EXP void factoryArticulation (TFactory f, TElement elt, TElement articulation);
469
476EXP TElement factoryRest (TFactory f, int duration, const char* type);
477
486EXP void factoryChord (TFactory f, TElement * notes);
487
488
494EXP TElement factoryElement (TFactory f, int type);
495
502EXP TElement factoryStrElement (TFactory f, int type, const char * value);
509EXP TElement factoryIntElement (TFactory f, int type, int value);
516EXP TElement factoryFloatElement (TFactory f, int type, float value);
517
518
525EXP TAttribute factoryStrAttribute (TFactory f, const char * name, const char* value);
532EXP TAttribute factoryIntAttribute (TFactory f, const char * name, int value);
539EXP TAttribute factoryFloatAttribute (TFactory f, const char * name, float value);
540
548EXP void factoryFreeElement (TFactory f, TElement elt);
549
557EXP void factoryFreeAttribute (TFactory f, TAttribute attr);
558
560
561
562#ifdef __cplusplus
563}
564#endif
565
566}
567
568#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 musicxmlstring2guidoPartial(const char *buffer, bool generateBars, int partFilter, int beginMeasure, int endMeasure, std::ostream &out)
Partial Conversion of MusicXML representation to the Guido format ONLY on asked Part number ID and as...
EXP float musicxml2guidoVersion()
Gives the guido converter version number.
EXP xmlErr musicxmlfile2guido(const char *file, bool generateBars, int beginMeasure, int endMeasure, int partFilter, std::ostream &out)
Converts a MusicXML representation to the Guido format.
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 xmlErr musicxmlfd2guido(FILE *fd, bool generateBars, int beginMeasure, int endMeasure, int partFilter, 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 factoryTuplet(TFactory f, int actual, int normal, TElement *notes)
Makes a tuplet with notes.
EXP TElement factoryScorepart(TFactory f, const char *id, const char *name, const char *abbrev)
Creates a 'score-part' element.
EXP void factoryAddElement(TFactory f, TElement elt, TElement subelt)
Adds an element to another element.
EXP TElement factoryElement(TFactory f, int type)
Creates an arbitrary MusicXML element.
EXP TElement factoryRest(TFactory f, int duration, const char *type)
Creates a rest.
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 factoryHeader(TFactory f, const char *worknumber, const char *worktitle, const char *movementnumber, const char *movementtitle)
Creates header information.
EXP void factoryAddElements(TFactory f, TElement elt, TElement *subelts)
Adds a set of elements to another element.
EXP TAttribute factoryStrAttribute(TFactory f, const char *name, const char *value)
Creates an arbitrary attribute with a string value.
EXP void factoryChord(TFactory f, TElement *notes)
Makes a chord from the gievn notes.
EXP void factoryAddAttribute(TFactory f, TElement elt, TAttribute attr)
Adds an attribute to an element.
EXP TElement factoryPart(TFactory f, const char *id)
Creates a 'part' element.
EXP void factoryNotation(TFactory f, TElement elt, TElement notation)
Add an element to a note notations element.
EXP void factoryClose(TFactory f)
Close a MusicXML factory.
EXP TElement factoryDynamic(TFactory f, int type, const char *placement)
Creates a dynamics element containing a dynamic type.
EXP TElement factoryFloatElement(TFactory f, int type, float value)
Creates an arbitrary MusicXML element with a float value.
EXP void factoryFreeAttribute(TFactory f, TAttribute attr)
Frees a previously allocated attribute.
EXP TElement factoryIntElement(TFactory f, int type, int value)
Creates an arbitrary MusicXML element with an integer value.
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 TElement factoryStrElement(TFactory f, int type, const char *value)
Creates an arbitrary MusicXML element with a string value.
EXP void factoryFreeElement(TFactory f, TElement elt)
Frees a previously allocated element.
EXP TAttribute factoryFloatAttribute(TFactory f, const char *name, float value)
Creates an arbitrary attribute with a float value.
EXP TElement factoryNote(TFactory f, const char *step, float alter, int octave, int duration, const char *type)
Creates a note.
EXP void factoryAddPart(TFactory f, TElement part)
Adds a part.
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 factoryArticulation(TFactory f, TElement elt, TElement articulation)
Add an articulation to a note.
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 TFactory factoryOpen()
Creates a new MusicXML factory.
EXP void factoryTie(TFactory f, TElement from, TElement to)
Tie two notes.
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 factoryRights(TFactory f, const char *r, const char *type)
Creates rights information.
EXP void factoryEncoding(TFactory f, const char *software)
Creates encoding information.