MuseScore  3.4
Music composition and notation
synthesizerstate.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2012 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __SYNTHESIZERSTATE_H__
14 #define __SYNTHESIZERSTATE_H__
15 
16 #include <list>
17 
18 namespace Ms {
19 
20 class XmlWriter;
21 class XmlReader;
22 class SynthesizerState;
23 
24 //---------------------------------------------------------
25 // IdValue
26 //---------------------------------------------------------
27 
28 struct IdValue {
29  int id;
30  QString data;
31 
32  IdValue() {}
33  IdValue(int _id, const QString& _data) : id(_id), data(_data) {}
34  };
35 
36 //---------------------------------------------------------
37 // SynthesizerGroup
38 //---------------------------------------------------------
39 
40 class SynthesizerGroup : public std::list<IdValue> {
41  QString _name;
42 
43  public:
44  const QString& name() const { return _name; }
45  void setName(const QString& s) { _name = s; }
46 
47  SynthesizerGroup() : std::list<IdValue>() {}
48  SynthesizerGroup(const char* n, std::list<IdValue> l) : std::list<IdValue>(l), _name(n) {}
49  };
50 
51 //---------------------------------------------------------
52 // SynthesizerState
53 //---------------------------------------------------------
54 
55 class SynthesizerState : public std::list<SynthesizerGroup> {
56  bool _isDefault { true };
57 
58  public:
59  SynthesizerState(std::initializer_list<SynthesizerGroup> l) {
60  insert(end(), l.begin(), l.end());
61  }
62  SynthesizerState() : std::list<SynthesizerGroup>() {}
63 
64  void write(XmlWriter&, bool force = false) const;
65  void read(XmlReader&);
66  SynthesizerGroup group(const QString& name) const;
67  bool isDefaultSynthSoundfont();
68  int ccToUse() const;
69  int method() const;
70  bool isDefault() const { return _isDefault; }
71  void setIsDefault(bool val) { _isDefault = val; }
72  };
73 
74 //---------------------------------------------------------
75 // default buildin SynthesizerState
76 // used if synthesizer.xml does not exist or is not
77 // readable
78 //---------------------------------------------------------
79 
80 static SynthesizerState defaultState = {
81  { "master", {
82  { 0, "Zita1" },
83  { 2, "0.1" },
84  { 3, "440" },
85  { 4, "1" },
86  { 5, "1" }
87  },
88  },
89  { "Fluid", {
90  { 0, "MuseScore_General.sf3" },
91  },
92  },
93 // { "Zerberus", {
94 // { 0, "SalamanderGrandPiano.sfz" },
95 // },
96 // },
97  };
98 
99 } // namespace Ms
100 #endif
101 
int id
Definition: synthesizerstate.h:29
Definition: xml.h:67
SynthesizerGroup()
Definition: synthesizerstate.h:47
SynthesizerState(std::initializer_list< SynthesizerGroup > l)
Definition: synthesizerstate.h:59
const QString & name() const
Definition: synthesizerstate.h:44
void setName(const QString &s)
Definition: synthesizerstate.h:45
SynthesizerState()
Definition: synthesizerstate.h:62
IdValue(int _id, const QString &_data)
Definition: synthesizerstate.h:33
Definition: synthesizerstate.h:55
QString _name
Definition: synthesizerstate.h:41
bool isDefault() const
Definition: synthesizerstate.h:70
Definition: synthesizerstate.h:28
Definition: aeolus.cpp:26
Definition: xml.h:218
Definition: synthesizerstate.h:40
Definition: xmlwriter.h:26
Definition: xmlreader.h:28
QString data
Definition: synthesizerstate.h:30
SynthesizerGroup(const char *n, std::list< IdValue > l)
Definition: synthesizerstate.h:48
void setIsDefault(bool val)
Definition: synthesizerstate.h:71
IdValue()
Definition: synthesizerstate.h:32