1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2002-2011 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#ifndef __INSTRTEMPLATE_H__
#define __INSTRTEMPLATE_H__
#include "mscore.h"
#include "instrument.h"
#include "clef.h"
#include "stringdata.h"
namespace Ms {
class XmlWriter;
class Part;
class Staff;
class StringData;
class StaffType;
//---------------------------------------------------------
// InstrumentGenre
//---------------------------------------------------------
class InstrumentGenre {
public:
QString id;
QString name;
InstrumentGenre() {}
void write(XmlWriter& xml) const;
void write1(XmlWriter& xml) const;
void read(XmlReader&);
};
//---------------------------------------------------------
// InstrumentTemplate
//---------------------------------------------------------
class InstrumentTemplate {
int staves; // 1 <= MAX_STAVES
public:
QString id;
QString trackName;
StaffNameList longNames; ///< shown on first system
StaffNameList shortNames; ///< shown on followup systems
QString musicXMLid; ///< used in MusicXML 3.0
QString description; ///< a longer description of the instrument
char minPitchA; // pitch range playable by an amateur
char maxPitchA;
char minPitchP; // pitch range playable by professional
char maxPitchP;
Interval transpose; // for transposing instruments
StaffGroup staffGroup;
const StaffType* staffTypePreset;
bool useDrumset;
Drumset* drumset;
StringData stringData;
QList<NamedEventList> midiActions;
QList<MidiArticulation> articulation;
QList<Channel> channel;
QList<InstrumentGenre*> genres; //; list of genres this instrument belongs to
ClefTypeList clefTypes[MAX_STAVES];
int staffLines[MAX_STAVES];
BracketType bracket[MAX_STAVES]; // bracket type (NO_BRACKET)
int bracketSpan[MAX_STAVES];
int barlineSpan[MAX_STAVES];
bool smallStaff[MAX_STAVES];
bool extended; // belongs to extended instrument set if true
bool singleNoteDynamics;
InstrumentTemplate();
InstrumentTemplate(const InstrumentTemplate&);
~InstrumentTemplate();
void init(const InstrumentTemplate&);
void linkGenre(const QString &);
void addGenre(QList<InstrumentGenre *>);
bool genreMember(const QString &);
void setPitchRange(const QString& s, char* a, char* b) const;
void write(XmlWriter& xml) const;
void write1(XmlWriter& xml) const;
void read(XmlReader&);
int nstaves() const { return staves; }
void setStaves(int val) { staves = val; }
ClefTypeList clefType(int staffIdx) const;
};
//---------------------------------------------------------
// InstrumentGroup
//---------------------------------------------------------
struct InstrumentGroup {
QString id;
QString name;
bool extended; // belongs to extended instruments set if true
QList<InstrumentTemplate*> instrumentTemplates;
void read(XmlReader&);
void clear();
InstrumentGroup() { extended = false; }
};
extern QList<InstrumentGenre *> instrumentGenres;
extern QList<MidiArticulation> articulation;
extern QList<InstrumentGroup*> instrumentGroups;
extern void clearInstrumentTemplates();
extern bool loadInstrumentTemplates(const QString& instrTemplates);
extern bool saveInstrumentTemplates(const QString& instrTemplates);
extern InstrumentTemplate* searchTemplate(const QString& name);
extern InstrumentTemplate* searchTemplateForMusicXmlId(const QString& mxmlId);
extern ClefType defaultClef(int patch);
} // namespace Ms
#endif
|