2012-05-26 14:26:10 +02:00
|
|
|
//=============================================================================
|
|
|
|
// 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"
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
class Xml;
|
|
|
|
class Staff;
|
|
|
|
class Score;
|
2012-08-12 16:08:58 +02:00
|
|
|
class InstrumentTemplate;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-11 21:29:42 +02:00
|
|
|
// @@ Part
|
2014-01-12 13:06:30 +01:00
|
|
|
// @P partName QString name of the part, used in the mixer
|
|
|
|
// @P show bool check/set whether or not a part is shown
|
2014-01-12 13:50:45 +01:00
|
|
|
// @P longName QString
|
|
|
|
// @P shortName QString
|
2014-07-13 15:21:05 +02:00
|
|
|
// @P volume int
|
|
|
|
// @P mute bool
|
2014-08-18 10:12:50 +02:00
|
|
|
// @P endTrack int (read only)
|
|
|
|
// @P startTrack int (read only)
|
2015-04-19 12:39:40 +02:00
|
|
|
// @ midiProgram int (read only)
|
|
|
|
// @ midiChannel int (read only)
|
|
|
|
// @ instrumentId string (read only)
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2015-02-04 22:12:13 +01:00
|
|
|
class Part : public QObject, public ScoreElement {
|
2012-07-06 14:21:05 +02:00
|
|
|
Q_OBJECT
|
2012-09-20 11:35:34 +02:00
|
|
|
|
2014-01-12 13:06:30 +01:00
|
|
|
Q_PROPERTY(QString partName READ partName WRITE setPartName)
|
2013-08-06 14:45:44 +02:00
|
|
|
Q_PROPERTY(bool show READ show WRITE setShow)
|
2014-03-03 17:24:28 +01:00
|
|
|
Q_PROPERTY(QString longName READ longName WRITE setLongName)
|
|
|
|
Q_PROPERTY(QString shortName READ shortName WRITE setShortName)
|
2014-07-13 15:21:05 +02:00
|
|
|
Q_PROPERTY(int volume READ volume WRITE setVolume)
|
|
|
|
Q_PROPERTY(bool mute READ mute WRITE setMute)
|
2014-08-17 19:08:29 +02:00
|
|
|
Q_PROPERTY(int endTrack READ endTrack)
|
|
|
|
Q_PROPERTY(int startTrack READ startTrack)
|
2014-12-28 18:20:12 +01:00
|
|
|
Q_PROPERTY(int midiProgram READ midiProgram)
|
2015-04-19 12:39:40 +02:00
|
|
|
Q_PROPERTY(int midiChannel READ midiChannel)
|
2014-12-28 18:20:12 +01:00
|
|
|
Q_PROPERTY(QString instrumentId READ instrumentId)
|
2015-07-02 18:07:21 +02:00
|
|
|
Q_PROPERTY(int lyricCount READ lyricCount)
|
|
|
|
Q_PROPERTY(int harmonyCount READ harmonyCount)
|
|
|
|
Q_PROPERTY(bool hasTabStaff READ hasTabStaff)
|
|
|
|
Q_PROPERTY(bool hasPitchedStaff READ hasPitchedStaff)
|
|
|
|
Q_PROPERTY(bool hasDrumStaff READ hasDrumStaff)
|
2012-09-20 11:35:34 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
QString _partName; ///< used in tracklist (mixer)
|
2015-03-13 12:54:24 +01:00
|
|
|
InstrumentList _instruments;
|
2012-05-26 14:26:10 +02:00
|
|
|
QList<Staff*> _staves;
|
|
|
|
QString _id; ///< used for MusicXml import
|
|
|
|
bool _show; ///< show part in partitur if true
|
|
|
|
|
|
|
|
public:
|
2012-07-06 14:21:05 +02:00
|
|
|
Part(Score* = 0);
|
2012-05-26 14:26:10 +02:00
|
|
|
void initFromInstrTemplate(const InstrumentTemplate*);
|
|
|
|
|
2013-01-11 18:10:18 +01:00
|
|
|
void read(XmlReader&);
|
2013-01-24 09:46:28 +01:00
|
|
|
void read114(XmlReader&);
|
2012-05-26 14:26:10 +02:00
|
|
|
void write(Xml& xml) const;
|
2014-08-11 15:25:55 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
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; }
|
|
|
|
|
2013-10-13 11:36:08 +02:00
|
|
|
int startTrack() const;
|
|
|
|
int endTrack() const;
|
|
|
|
|
2015-03-04 09:40:08 +01:00
|
|
|
QString longName(int tick = -1) const;
|
|
|
|
QString shortName(int tick = -1) const;
|
|
|
|
QString instrumentName(int tick = -1) const;
|
|
|
|
QString instrumentId(int tick = -1) const;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-03-13 11:16:43 +01:00
|
|
|
const QList<StaffName>& longNames(int tick = -1) const { return instrument(tick)->longNames(); }
|
|
|
|
const QList<StaffName>& shortNames(int tick = -1) const { return instrument(tick)->shortNames(); }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-03-04 09:40:08 +01:00
|
|
|
void setLongNames(QList<StaffName>& s, int tick = -1);
|
|
|
|
void setShortNames(QList<StaffName>& s, int tick = -1);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
void setLongName(const QString& s);
|
|
|
|
void setShortName(const QString& s);
|
|
|
|
|
2015-04-27 12:59:30 +02:00
|
|
|
void setPlainLongName(const QString& s);
|
|
|
|
void setPlainShortName(const QString& s);
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
void setStaves(int);
|
|
|
|
|
2014-07-13 15:21:05 +02:00
|
|
|
int volume() const;
|
|
|
|
void setVolume(int volume);
|
|
|
|
bool mute() const;
|
|
|
|
void setMute(bool mute);
|
2014-08-11 15:25:55 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
int reverb() const;
|
2015-02-11 16:20:20 +01:00
|
|
|
void setReverb(int);
|
2012-05-26 14:26:10 +02:00
|
|
|
int chorus() const;
|
2015-02-11 16:20:20 +01:00
|
|
|
void setChorus(int);
|
2012-05-26 14:26:10 +02:00
|
|
|
int pan() const;
|
|
|
|
void setPan(int pan);
|
|
|
|
int midiProgram() const;
|
|
|
|
void setMidiProgram(int, int bank = 0);
|
|
|
|
|
|
|
|
int midiChannel() const;
|
2014-10-12 12:24:19 +02:00
|
|
|
int midiPort() const;
|
2012-05-26 14:26:10 +02:00
|
|
|
void setMidiChannel(int) const;
|
|
|
|
|
2014-08-11 15:25:55 +02:00
|
|
|
void insertStaff(Staff*, int idx);
|
2012-05-26 14:26:10 +02:00
|
|
|
void removeStaff(Staff*);
|
2012-08-01 22:15:58 +02:00
|
|
|
bool show() const { return _show; }
|
|
|
|
void setShow(bool val) { _show = val; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-03-13 11:16:43 +01:00
|
|
|
Instrument* instrument(int tick = -1);
|
|
|
|
const Instrument* instrument(int tick = -1) const;
|
2015-03-05 16:46:37 +01:00
|
|
|
void setInstrument(Instrument*, int tick = -1); // transfer ownership
|
|
|
|
void setInstrument(const Instrument&&, int tick = -1);
|
2015-03-04 09:40:08 +01:00
|
|
|
void setInstrument(const Instrument&, int tick = -1);
|
2012-05-26 14:26:10 +02:00
|
|
|
void removeInstrument(int tick);
|
2015-03-13 13:11:20 +01:00
|
|
|
const InstrumentList* instruments() const { return &_instruments; }
|
|
|
|
|
2015-03-13 12:39:38 +01:00
|
|
|
void insertTime(int tick, int len);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
QString partName() const { return _partName; }
|
|
|
|
void setPartName(const QString& s) { _partName = s; }
|
2012-08-01 22:15:58 +02:00
|
|
|
|
2015-02-04 22:12:13 +01:00
|
|
|
QVariant getProperty(P_ID) const override;
|
|
|
|
bool setProperty(P_ID, const QVariant&) override;
|
2015-07-02 18:07:21 +02:00
|
|
|
|
|
|
|
int lyricCount();
|
|
|
|
int harmonyCount();
|
|
|
|
bool hasPitchedStaff();
|
|
|
|
bool hasTabStaff();
|
|
|
|
bool hasDrumStaff();
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
} // namespace Ms
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|
|
|
|
|