MuseScore  3.4
Music composition and notation
instrument.h
Go to the documentation of this file.
1 //=============================================================================
2 // Zerberus
3 // Zample player
4 //
5 // Copyright (C) 2013 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 __MINSTRUMENT_H__
14 #define __MINSTRUMENT_H__
15 
16 #include <list>
17 #include <QString>
18 
19 class Zerberus;
20 class XmlReader;
21 class MQZipReader;
22 struct Zone;
23 struct SfzRegion;
24 class Sample;
25 
26 //---------------------------------------------------------
27 // ZInstrument
28 //---------------------------------------------------------
29 
30 class ZInstrument {
32  int _refCount;
33  QString _name;
34  int _program;
35  QString instrumentPath;
36  std::list<Zone*> _zones;
37  int _setcc[128];
38 
39  bool loadFromFile(const QString&);
40  bool loadSfz(const QString&);
41  bool loadFromDir(const QString&);
42  bool read(const QByteArray&, MQZipReader*, const QString& path);
43 
44  public:
46  ~ZInstrument();
47 
48  int refCount() const { return _refCount; }
49  void setRefCount(int val) { _refCount = val; }
50  bool load(const QString&);
51  int program() const { return _program; }
52  QString name() const { return _name; }
53  QString path() const { return instrumentPath; }
54  const std::list<Zone*>& zones() const { return _zones; }
55  std::list<Zone*>& zones() { return _zones; }
56  Sample* readSample(const QString& s, MQZipReader* uz);
57  void addZone(Zone* z) { _zones.push_back(z); }
58  void addRegion(SfzRegion&);
59  int getSetCC(int v) { return _setcc[v]; }
60 
61  static QByteArray buf; // used during read of Sample
62  static int idx;
63  };
64 
65 #endif
66 
Definition: instrument.h:30
bool read(const QByteArray &, MQZipReader *, const QString &path)
Definition: instrument.cpp:182
~ZInstrument()
Definition: instrument.cpp:109
void setRefCount(int val)
Definition: instrument.h:49
QString name() const
Definition: instrument.h:52
int _refCount
Definition: instrument.h:32
int program() const
Definition: instrument.h:51
bool loadSfz(const QString &)
Definition: sfz.cpp:592
Sample * readSample(const QString &s, MQZipReader *uz)
Definition: instrument.cpp:43
Definition: zerberus.h:75
const std::list< Zone * > & zones() const
Definition: instrument.h:54
std::list< Zone * > _zones
Definition: instrument.h:36
QString path() const
Definition: instrument.h:53
int refCount() const
Definition: instrument.h:48
void addZone(Zone *z)
Definition: instrument.h:57
QString _name
Definition: instrument.h:33
Definition: zone.h:56
static QByteArray buf
Definition: instrument.h:61
bool load(const QString &)
Definition: instrument.cpp:120
QString instrumentPath
Definition: instrument.h:35
static int idx
Definition: instrument.h:62
std::list< Zone * > & zones()
Definition: instrument.h:55
Definition: sfz.cpp:51
ZInstrument(Zerberus *)
Definition: instrument.cpp:96
bool loadFromDir(const QString &)
Definition: instrument.cpp:137
bool loadFromFile(const QString &)
Definition: instrument.cpp:156
void addRegion(SfzRegion &)
Definition: sfz.cpp:294
Definition: xmlreader.h:28
Definition: sample.h:20
int getSetCC(int v)
Definition: instrument.h:59
int _setcc[128]
Definition: instrument.h:37
int _program
Definition: instrument.h:34
Zerberus * zerberus
Definition: instrument.h:31