File: part.h

package info (click to toggle)
musescore 2.0.3%2Bdfsg1-2~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 202,532 kB
  • sloc: cpp: 257,595; xml: 172,226; ansic: 139,931; python: 6,565; sh: 6,383; perl: 423; makefile: 290; awk: 142; pascal: 67; sed: 3
file content (158 lines) | stat: -rw-r--r-- 5,955 bytes parent folder | download | duplicates (7)
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//=============================================================================
//  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 __PART_H__
#define __PART_H__

#include "mscore.h"
#include "instrument.h"
#include "text.h"

namespace Ms {

class Xml;
class Staff;
class Score;
class InstrumentTemplate;

//---------------------------------------------------------
//   @@ Part
//   @P endTrack        int         (read only)
//   @P harmonyCount    int         (read only)
//   @P hasDrumStaff    bool        (read only)
//   @P hasPitchedStaff bool        (read only)
//   @P hasTabStaff     bool        (read only)
//   @P instrumentId    string      (read only)
//   @P longName        string
//   @P lyricCount      int         (read only)
//   @P midiChannel     int         (read only)
//   @P midiProgram     int         (read only)
//   @P mute            bool
//   @P partName        string      name of the part, used in the mixer
//   @P shortName       string
//   @P show            bool        check/set whether or not a part is shown
//   @P startTrack      int         (read only)
//   @P volume          int
//---------------------------------------------------------

class Part : public QObject, public ScoreElement {
      Q_OBJECT

      Q_PROPERTY(int          endTrack          READ endTrack)
      Q_PROPERTY(int          harmonyCount      READ harmonyCount)
      Q_PROPERTY(bool         hasDrumStaff      READ hasDrumStaff)
      Q_PROPERTY(bool         hasPitchedStaff   READ hasPitchedStaff)
      Q_PROPERTY(bool         hasTabStaff       READ hasTabStaff)
      Q_PROPERTY(QString      instrumentId      READ instrumentId)
      Q_PROPERTY(QString      longName          READ longName     WRITE setLongName)
      Q_PROPERTY(int          lyricCount        READ lyricCount)
      Q_PROPERTY(int          midiChannel       READ midiChannel)
      Q_PROPERTY(int          midiProgram       READ midiProgram)
      Q_PROPERTY(bool         mute              READ mute         WRITE setMute)
      Q_PROPERTY(QString      partName          READ partName     WRITE setPartName)
      Q_PROPERTY(QString      shortName         READ shortName    WRITE setShortName)
      Q_PROPERTY(bool         show              READ show         WRITE setShow)
      Q_PROPERTY(int          startTrack        READ startTrack)
      Q_PROPERTY(int          volume            READ volume       WRITE setVolume)

      QString _partName;           ///< used in tracklist (mixer)
      InstrumentList _instruments;
      QList<Staff*> _staves;
      QString _id;                  ///< used for MusicXml import
      bool _show;                   ///< show part in partitur if true

   public:
      Part(Score* = 0);
      void initFromInstrTemplate(const InstrumentTemplate*);

      void read(XmlReader&);
      void read114(XmlReader&);
      void write(Xml& xml) const;

      int nstaves() const                       { return _staves.size(); }
      QList<Staff*>* staves()                   { return &_staves; }
      const QList<Staff*>* staves() const       { return &_staves; }
      Staff* staff(int idx) const;
      void setId(const QString& s)              { _id = s; }
      QString id() const                        { return _id; }

      int startTrack() const;
      int endTrack() const;

      QString longName(int tick = -1) const;
      QString shortName(int tick = -1) const;
      QString instrumentName(int tick = -1) const;
      QString instrumentId(int tick = -1) const;

      const QList<StaffName>& longNames(int tick = -1) const  { return instrument(tick)->longNames();  }
      const QList<StaffName>& shortNames(int tick = -1) const { return instrument(tick)->shortNames(); }

      void setLongNames(QList<StaffName>& s, int tick = -1);
      void setShortNames(QList<StaffName>& s, int tick = -1);

      void setLongName(const QString& s);
      void setShortName(const QString& s);

      void setPlainLongName(const QString& s);
      void setPlainShortName(const QString& s);

      void setStaves(int);

      int volume() const;
      void setVolume(int volume);
      bool mute() const;
      void setMute(bool mute);

      int reverb() const;
      void setReverb(int);
      int chorus() const;
      void setChorus(int);
      int pan() const;
      void setPan(int pan);
      int midiProgram() const;
      void setMidiProgram(int, int bank = 0);

      int midiChannel() const;
      int midiPort() const;
      void setMidiChannel(int) const;

      void insertStaff(Staff*, int idx);
      void removeStaff(Staff*);
      bool show() const                        { return _show;  }
      void setShow(bool val)                   { _show = val;   }

      Instrument* instrument(int tick = -1);
      const Instrument* instrument(int tick = -1) const;
      void setInstrument(Instrument*, int tick = -1);       // transfer ownership
      void setInstrument(const Instrument&&, int tick = -1);
      void setInstrument(const Instrument&, int tick = -1);
      void removeInstrument(int tick);
      const InstrumentList* instruments() const   { return &_instruments;       }

      void insertTime(int tick, int len);

      QString partName() const                 { return _partName; }
      void setPartName(const QString& s)       { _partName = s; }

      QVariant getProperty(P_ID) const override;
      bool setProperty(P_ID, const QVariant&) override;

      int lyricCount();
      int harmonyCount();
      bool hasPitchedStaff();
      bool hasTabStaff();
      bool hasDrumStaff();
      };

}     // namespace Ms
#endif