MythTV  master
audiogeneralsettings.h
Go to the documentation of this file.
1 #ifndef MYTHAUDIOSETTINGS_H
2 #define MYTHAUDIOSETTINGS_H
3 
4 #include <utility>
5 
6 // Qt headers
7 #include <QMutex>
8 #include <QObject>
9 #include <QStringList>
10 
11 // MythTV headers
12 #include "mythuistatetype.h"
13 #include "mythscreentype.h"
14 #include "mythdialogbox.h"
15 #include "mythuibutton.h"
16 #include "audiooutput.h"
17 #include "mythcontext.h"
18 #include "standardsettings.h"
19 #include "mthread.h"
20 
22 class AudioTest;
23 
25 {
26  Q_OBJECT
27 
28  public:
29  AudioConfigScreen(MythScreenStack *parent, const char *name,
30  GroupSetting *groupSetting);
31  protected:
32  void Load(void) override; // StandardSettingDialog
33  void Init(void) override; // StandardSettingDialog
34 };
35 
37 {
38  Q_OBJECT
39 
40  public:
42  void Load() override; // StandardSetting
43 
44  using ADCMap = QMap<QString,AudioOutput::AudioDeviceConfig>;
45 
46  ADCMap &AudioDeviceMap(void) { return m_audioDevs; };
48 
49  void CheckConfiguration(void);
50 
51  private slots:
52  void UpdateVisibility(StandardSetting */*setting*/);
53  AudioOutputSettings UpdateCapabilities(bool restore = true,
54  bool AC3 = false);
56  void AudioRescan();
57  void UpdateAudioTest();
58 
59  private:
60  void setMPCMEnabled(bool flag);
61 
75  static HostSpinBoxSetting *PCMVolume();
76 
77  //advanced setting
78  static HostCheckBoxSetting *MPCM();
86 
87  bool CheckPassthrough();
88 
93 
94  // digital settings
101  //advanced setting
105 
106  AudioTest *m_audioTest {nullptr};
107 
110  QMutex m_slotLock;
111 
112  int m_maxSpeakers {0};
114  static const char *kMixerControlControls[];
115 };
116 
118 {
119  Q_OBJECT
120  public:
121  explicit AudioDeviceComboBox(AudioConfigSettings *parent);
122  void AudioRescan();
123 
124  void edit(MythScreenType * screen) override; // MythUIComboBoxSetting
125 
126  private slots:
127  void AudioDescriptionHelp(StandardSetting * setting);
128 
129  private:
131 };
132 
133 class ChannelChangedEvent : public QEvent
134 {
135  public:
136  ChannelChangedEvent(QString channame, bool fulltest) :
137  QEvent(kEventType), m_channel(std::move(channame)), m_fulltest(fulltest) {}
138  ~ChannelChangedEvent() override = default;
139 
140  QString m_channel;
142 
143  static Type kEventType;
144 };
145 
146 class AudioTestThread : public MThread
147 {
149 
150  public:
151 
152  AudioTestThread(QObject *parent, QString main, QString passthrough,
153  int channels, AudioOutputSettings &settings, bool hd);
154  ~AudioTestThread() override;
155 
156  void cancel();
157  QString result();
158  void setChannel(int channel);
159 
160  protected:
161  void run() override; // MThread
162 
163  private:
164  QObject *m_parent {nullptr};
167  QString m_device;
168  QString m_passthrough;
169  bool m_interrupted {false};
170  int m_channel {-1};
171  bool m_hd {false};
172  int m_samplerate {48000};
174 };
175 
176 class AudioTest : public GroupSetting
177 {
178  Q_OBJECT
179  public:
180  AudioTest();
181  ~AudioTest() override;
182  void UpdateCapabilities(const QString &main, const QString &passthrough,
183  int channels, const AudioOutputSettings &settings);
184  bool event(QEvent *event) override; // QObject
185 
186  private:
187  int m_channels {2};
196  AudioTestThread *m_at {nullptr};
199  QString m_main;
200  QString m_passthrough;
202  bool m_quality {false};
203 
204  private slots:
205  void toggle();
206  void togglequality(void);
207  void cancelTest();
208  void prepareTest();
209 };
210 #endif
HostCheckBoxSetting * m_ac3PassThrough
static const char * kMixerControlControls[]
~AudioTest() override
ButtonStandardSetting * m_rearright
static HostCheckBoxSetting * HBRPassthrough()
ChannelChangedEvent(QString channame, bool fulltest)
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:46
unsigned int slots[4]
Definition: element.c:38
QVector< AudioDeviceConfig > ADCVect
Definition: audiooutput.h:47
bool event(QEvent *event) override
static HostComboBoxSetting * PassThroughOutputDevice()
AudioOutput * m_audioOutput
HostComboBoxSetting * m_audioUpmixType
void UpdateVisibility(StandardSetting *)
Definition: element.h:83
AudioDeviceComboBox(AudioConfigSettings *parent)
TransMythUICheckBoxSetting * m_hd
AudioConfigSettings * m_parent
static HostCheckBoxSetting * SRCQualityOverride()
AudioDeviceComboBox * OutputDevice()
HostCheckBoxSetting * m_dtsPassThrough
static HostCheckBoxSetting * TrueHDPassThrough()
AudioTestThread(QObject *parent, QString main, QString passthrough, int channels, AudioOutputSettings &settings, bool hd)
static HostCheckBoxSetting * MPCM()
ButtonStandardSetting * m_lfe
AudioOutputSettings UpdateCapabilitiesAC3(void)
void run() override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
static HostCheckBoxSetting * PassThroughOverride()
QMap< QString, AudioOutput::AudioDeviceConfig > ADCMap
ButtonStandardSetting * m_startButton
static HostComboBoxSetting * MaxAudioChannels()
static HostSpinBoxSetting * PCMVolume()
void setChannel(int channel)
static HostComboBoxSetting * MixerDevice()
ButtonStandardSetting * m_frontright
HostCheckBoxSetting * m_mpcm
HostCheckBoxSetting * m_eac3PassThrough
static HostComboBoxSetting * MixerControl()
static HostComboBoxSetting * SRCQuality()
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
static HostSpinBoxSetting * MixerVolume()
AudioDeviceComboBox * m_outputDevice
AudioTestThread * m_at
static HostComboBoxSetting * AudioUpmixType()
HostComboBoxSetting * m_passThroughDeviceOverride
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
void AudioDescriptionHelp(StandardSetting *setting)
AudioOutputSettings UpdateCapabilities(bool restore=true, bool AC3=false)
AudioOutputSettings m_settings
Q_DECLARE_TR_FUNCTIONS(AudioTestThread)
static HostCheckBoxSetting * SPDIFRateOverride()
HostCheckBoxSetting * m_audioUpmix
static HostCheckBoxSetting * DTSPassThrough()
static HostCheckBoxSetting * EAC3PassThrough()
void edit(MythScreenType *screen) override
HostCheckBoxSetting * m_passThroughOverride
ButtonStandardSetting * m_surroundleft
static HostCheckBoxSetting * AudioUpmix()
AudioConfigScreen(MythScreenStack *parent, const char *name, GroupSetting *groupSetting)
static HostCheckBoxSetting * Audio48kOverride()
AudioOutput::ADCVect & AudioDeviceVect(void)
HostCheckBoxSetting * m_dtsHDPassThrough
static HostCheckBoxSetting * DTSHDPassThrough()
Screen in which all other widgets are contained and rendered.
~ChannelChangedEvent() override=default
HostCheckBoxSetting * m_trueHDPassThrough
ButtonStandardSetting * m_frontleft
ButtonStandardSetting * m_rearleft
void togglequality(void)
static HostCheckBoxSetting * AC3PassThrough()
ButtonStandardSetting * m_surroundright
AudioOutput::ADCVect m_devices
static HostCheckBoxSetting * MythControlsVolume()
void UpdateCapabilities(const QString &main, const QString &passthrough, int channels, const AudioOutputSettings &settings)
HostComboBoxSetting * m_maxAudioChannels
ADCMap & AudioDeviceMap(void)
GroupSetting * m_triggerDigital
ButtonStandardSetting * m_center