MuseScore  3.4
Music composition and notation
mixer.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Linux Music Score Editor
4 //
5 // Copyright (C) 2002-2016 Werner Schweer and others
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 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __ILEDIT_H__
21 #define __ILEDIT_H__
22 
23 #include "ui_parteditbase.h"
24 #include "ui_mixer.h"
25 #include "libmscore/instrument.h"
26 #include "enableplayforwidget.h"
27 #include "mixertrackgroup.h"
28 #include <QWidget>
29 #include <QDockWidget>
30 #include <QScrollArea>
31 #include <QList>
32 
33 namespace Ms {
34 
35 class Score;
36 class Channel;
37 class Part;
38 class PartEdit;
39 class MixerDetails;
40 class MixerTrack;
41 class MidiMapping;
42 
43 double volumeToUserRange(char v);
44 double panToUserRange(char v);
45 double chorusToUserRange(char v);
46 double reverbToUserRange(char v);
47 
48 //0 to 100
49 char userRangeToVolume(double v);
50 //-180 to 180
51 char userRangeToPan(double v);
52 //0 to 100
53 char userRangeToChorus(double v);
54 //0 to 100
55 char userRangeToReverb(double v);
56 
57 
58 //---------------------------------------------------------
59 // Mixer
60 //---------------------------------------------------------
61 
62 class Mixer : public QDockWidget, public Ui::Mixer, public MixerTrackGroup
63  {
64  Q_OBJECT
65 
66  Score* _score = nullptr; // playback score
67  Score* _activeScore = nullptr; // may be a _score itself or its excerpt;
68  QHBoxLayout* trackAreaLayout;
70 
72  QGridLayout* detailsLayout;
73 
75  QSet<Part*> expandedParts;
76  QWidget* trackHolder;
77  QList<MixerTrack*> trackList;
78 
79  int _scrollPosition = 0;
81 
82  virtual void closeEvent(QCloseEvent*) override;
83  virtual void showEvent(QShowEvent*) override;
84  virtual void hideEvent(QHideEvent*) override;
85  virtual bool eventFilter(QObject*, QEvent*) override;
86  virtual void keyPressEvent(QKeyEvent*) override;
87  void keepScrollPosition();
88  void setPlaybackScore(Score*);
89 
90  private slots:
91  void on_partOnlyCheckBox_toggled(bool checked);
92 
93  public slots:
94  void updateTracks();
95  void midiPrefsChanged(bool showMidiControls);
96  void masterVolumeChanged(double val);
97  void synthGainChanged(float val);
98  void adjustScrollPosition(int, int);
99  void checkKeptScrollValue(int);
100 
101  signals:
102  void closed(bool);
103 
104  protected:
105  virtual void changeEvent(QEvent *event) override;
106  void retranslate(bool firstTime = false);
107 
108  public:
109  Mixer(QWidget* parent);
110  void setScore(Score*);
111  PartEdit* getPartAtIndex(int index);
112  void expandToggled(Part* part, bool expanded) override;
113  void notifyTrackSelected(MixerTrack* track) override;
114  void showDetailsToggled(bool shown);
115  };
116 
117 
118 } // namespace Ms
119 #endif
120 
void retranslate(bool firstTime=false)
Definition: mixer.cpp:222
QSet< Part * > expandedParts
Definition: mixer.h:75
Mixer(QWidget *parent)
Definition: mixer.cpp:72
void setScore(Score *)
Definition: mixer.cpp:328
QGridLayout * detailsLayout
Definition: mixer.h:72
void on_partOnlyCheckBox_toggled(bool checked)
Definition: mixer.cpp:201
void keepScrollPosition()
Definition: mixer.cpp:174
char userRangeToPan(double v)
Definition: mixer.cpp:62
void setPlaybackScore(Score *)
Definition: mixer.cpp:315
void closed(bool)
Definition: mixer.h:62
MixerDetails * mixerDetails
Definition: mixer.h:71
Definition: mixerdetails.h:40
void notifyTrackSelected(MixerTrack *track) override
Definition: mixer.cpp:466
Definition: parteditbase.h:39
void updateTracks()
Definition: mixer.cpp:343
void synthGainChanged(float val)
Definition: mixer.cpp:146
Definition: score.h:391
double volumeToUserRange(char v)
Definition: mixer.cpp:54
char userRangeToReverb(double v)
Definition: mixer.cpp:66
void masterVolumeChanged(double val)
Definition: mixer.cpp:184
void midiPrefsChanged(bool showMidiControls)
Definition: mixer.cpp:443
int _scrollPosition
Definition: mixer.h:79
bool showDetails
Definition: mixer.h:74
void checkKeptScrollValue(int)
Definition: mixer.cpp:165
EnablePlayForWidget * enablePlay
Definition: mixer.h:69
char userRangeToChorus(double v)
Definition: mixer.cpp:64
virtual void closeEvent(QCloseEvent *) override
Definition: mixer.cpp:237
char userRangeToVolume(double v)
Definition: mixer.cpp:60
double reverbToUserRange(char v)
Definition: mixer.cpp:57
virtual void hideEvent(QHideEvent *) override
Definition: mixer.cpp:261
Definition: mixertrackgroup.h:32
virtual bool eventFilter(QObject *, QEvent *) override
Definition: mixer.cpp:272
Definition: enableplayforwidget.h:17
bool _needToKeepScrollPosition
Definition: mixer.h:80
Definition: aeolus.cpp:26
Score * _score
Definition: mixer.h:66
virtual void keyPressEvent(QKeyEvent *) override
Definition: mixer.cpp:283
double chorusToUserRange(char v)
Definition: mixer.cpp:56
void expandToggled(Part *part, bool expanded) override
Definition: mixer.cpp:452
QHBoxLayout * trackAreaLayout
Definition: mixer.h:68
PartEdit * getPartAtIndex(int index)
Definition: mixer.cpp:306
Definition: mixertrack.h:30
QWidget * trackHolder
Definition: mixer.h:76
virtual void showEvent(QShowEvent *) override
Definition: mixer.cpp:247
Score * _activeScore
Definition: mixer.h:67
void showDetailsToggled(bool shown)
Definition: mixer.cpp:133
QList< MixerTrack * > trackList
Definition: mixer.h:77
Definition: part.h:47
void adjustScrollPosition(int, int)
Definition: mixer.cpp:159
virtual void changeEvent(QEvent *event) override
Definition: mixer.cpp:295
double panToUserRange(char v)
Definition: mixer.cpp:55
Definition: channel.h:23