drumstick  2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.
fluidsettingsdialog.h
Go to the documentation of this file.
1 /*
2  Virtual Piano test using the MIDI Sequencer C++ library
3  Copyright (C) 2006-2023, Pedro Lopez-Cabanillas <plcl@users.sf.net>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 3 of the License, or
8  (at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef FLUIDSETTINGSDIALOG_H
20 #define FLUIDSETTINGSDIALOG_H
21 
22 #include <QDialog>
23 #include <QShowEvent>
24 #include <QSettings>
25 
31 namespace drumstick {
32 
33 namespace rt {
34  class MIDIOutput;
35 }
36 
37 namespace widgets {
38 
39 namespace Ui {
40  class FluidSettingsDialog;
41 }
42 
43 class FluidSettingsDialog : public QDialog
44 {
45  Q_OBJECT
46 
47 public:
48  explicit FluidSettingsDialog(QWidget *parent = nullptr);
49  ~FluidSettingsDialog();
50  void readSettings();
51  void writeSettings();
52  void changeSoundFont(const QString& fileName);
53  void chkDriverProperties(QSettings* settings);
54 
55 public Q_SLOTS:
56  void accept() override;
57  void showEvent(QShowEvent *event) override;
58  void restoreDefaults();
59  void showFileDialog();
60  void audioDriverChanged(const QString &text);
61  void bufferTimeChanged(int value);
62  void bufferSizeChanged();
63 
64 public:
65  static const QString QSTR_PREFERENCES;
66  static const QString QSTR_INSTRUMENTSDEFINITION;
67  static const QString QSTR_DATADIR;
68  static const QString QSTR_DATADIR2;
69  static const QString QSTR_AUDIODRIVER;
70  static const QString QSTR_PERIODSIZE;
71  static const QString QSTR_PERIODS;
72  static const QString QSTR_SAMPLERATE;
73  static const QString QSTR_CHORUS;
74  static const QString QSTR_REVERB;
75  static const QString QSTR_GAIN;
76  static const QString QSTR_POLYPHONY;
77  static const QString QSTR_BUFFERTIME;
78 
79  static const int DEFAULT_BUFFERTIME = 50;
80  static const int DEFAULT_PERIODSIZE = 512;
81  static const int DEFAULT_PERIODS = 8;
82  static constexpr double DEFAULT_SAMPLERATE = 44100.0;
83  static const int DEFAULT_CHORUS = 0;
84  static const int DEFAULT_REVERB = 1;
85  static constexpr double DEFAULT_GAIN = 1.0;
86  static const int DEFAULT_POLYPHONY = 256;
87  static const QString QSTR_PULSEAUDIO;
88 
89 private:
90  QString defaultAudioDriver() const;
91  bool checkRanges() const;
92  void initBuffer();
93  QString driverVersion() const;
94  bool driverVersionLessThan_2_2_8();
95 
96  Ui::FluidSettingsDialog *ui;
97  drumstick::rt::MIDIOutput *m_driver;
98  QString m_defSoundFont;
99 };
100 
101 }} // namespace drumstick::widgets
102 
103 #endif // FLUIDSETTINGSDIALOG_H
The QSettings class provides persistent platform-independent application settings.
MIDI OUT interface.
Definition: rtmidioutput.h:122
void DRUMSTICK_WIDGETS_EXPORT changeSoundFont(const QString driver, const QString fileName, QWidget *parent=nullptr)
Changes the sound font configuration Some RT output drivers accept soundfonts.
Drumstick common.
Definition: alsaclient.cpp:68