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 std::array<const char *,2> 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  ~ChannelChangedEvent() override = default;
138 
139  QString m_channel;
141 
142  static Type kEventType;
143 };
144 
145 class AudioTestThread : public MThread
146 {
147  Q_DECLARE_TR_FUNCTIONS(AudioTestThread)
148 
149  public:
150 
151  AudioTestThread(QObject *parent, QString main, QString passthrough,
152  int channels, AudioOutputSettings &settings, bool hd);
153  ~AudioTestThread() override;
154 
155  void cancel();
156  QString result();
157  void setChannel(int channel);
158 
159  protected:
160  void run() override; // MThread
161 
162  private:
163  QObject *m_parent {nullptr};
166  QString m_device;
167  QString m_passthrough;
168  bool m_interrupted {false};
169  int m_channel {-1};
170  bool m_hd {false};
171  int m_samplerate {48000};
173 };
174 
175 class AudioTest : public GroupSetting
176 {
177  Q_OBJECT
178  public:
179  AudioTest();
180  ~AudioTest() override;
181  void UpdateCapabilities(const QString &main, const QString &passthrough,
182  int channels, const AudioOutputSettings &settings);
183  bool event(QEvent *event) override; // QObject
184 
185  private:
186  int m_channels {2};
195  AudioTestThread *m_at {nullptr};
198  QString m_main;
199  QString m_passthrough;
201  bool m_quality {false};
202 
203  private slots:
204  void toggle();
205  void togglequality(void);
206  void cancelTest();
207  void prepareTest();
208 };
209 #endif
AudioConfigSettings::m_lastAudioDevice
QString m_lastAudioDevice
Definition: audiogeneralsettings.h:113
channel
QDomElement channel
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:504
bbciplayer.main
main
Definition: bbciplayer.py:263
AudioTest::m_surroundleft
ButtonStandardSetting * m_surroundleft
Definition: audiogeneralsettings.h:190
AudioConfigSettings::Audio48kOverride
static HostCheckBoxSetting * Audio48kOverride()
Definition: audiogeneralsettings.cpp:1192
AudioConfigSettings::TrueHDPassThrough
static HostCheckBoxSetting * TrueHDPassThrough()
Definition: audiogeneralsettings.cpp:512
TransMythUICheckBoxSetting
Definition: standardsettings.h:409
AudioConfigSettings::MixerControl
static HostComboBoxSetting * MixerControl()
Definition: audiogeneralsettings.cpp:1102
AudioConfigSettings::AudioRescan
void AudioRescan()
Definition: audiogeneralsettings.cpp:234
slots
std::array< unsigned int, 4 > slots
Definition: element.cpp:38
AudioConfigSettings::MaxAudioChannels
static HostComboBoxSetting * MaxAudioChannels()
Definition: audiogeneralsettings.cpp:424
AudioTestThread::AudioTestThread
AudioTestThread(QObject *parent, QString main, QString passthrough, int channels, AudioOutputSettings &settings, bool hd)
Definition: audiogeneralsettings.cpp:597
FORMAT_S16
@ FORMAT_S16
Definition: audiooutputsettings.h:28
AudioConfigSettings::ADCMap
QMap< QString, AudioOutput::AudioDeviceConfig > ADCMap
Definition: audiogeneralsettings.h:44
AudioConfigSettings::kMixerControlControls
static const std::array< const char *, 2 > kMixerControlControls
Definition: audiogeneralsettings.h:114
ChannelChangedEvent::m_channel
QString m_channel
Definition: audiogeneralsettings.h:139
AudioConfigSettings::AudioConfigSettings
AudioConfigSettings()
Definition: audiogeneralsettings.cpp:109
AudioTestThread::m_samplerate
int m_samplerate
Definition: audiogeneralsettings.h:171
AudioConfigSettings::m_slotLock
QMutex m_slotLock
Definition: audiogeneralsettings.h:110
AudioConfigSettings::m_audioDevs
ADCMap m_audioDevs
Definition: audiogeneralsettings.h:108
AudioConfigSettings::SRCQualityOverride
static HostCheckBoxSetting * SRCQualityOverride()
Definition: audiogeneralsettings.cpp:1158
ButtonStandardSetting
Definition: standardsettings.h:448
AudioTestThread::m_device
QString m_device
Definition: audiogeneralsettings.h:166
AudioConfigSettings::UpdateVisibility
void UpdateVisibility(StandardSetting *)
Definition: audiogeneralsettings.cpp:263
AudioConfigSettings::MixerVolume
static HostSpinBoxSetting * MixerVolume()
Definition: audiogeneralsettings.cpp:1116
AudioTest::m_quality
bool m_quality
Definition: audiogeneralsettings.h:201
AudioConfigSettings::m_passThroughDeviceOverride
HostComboBoxSetting * m_passThroughDeviceOverride
Definition: audiogeneralsettings.h:104
AudioTestThread::cancel
void cancel()
Definition: audiogeneralsettings.cpp:630
AudioTestThread::m_hd
bool m_hd
Definition: audiogeneralsettings.h:170
AudioConfigSettings::PassThroughOverride
static HostCheckBoxSetting * PassThroughOverride()
Definition: audiogeneralsettings.cpp:1205
AudioTest
Definition: audiogeneralsettings.h:176
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:16
AudioConfigSettings::m_trueHDPassThrough
HostCheckBoxSetting * m_trueHDPassThrough
Definition: audiogeneralsettings.h:99
AudioDeviceComboBox
Definition: audiogeneralsettings.h:118
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
mythuistatetype.h
AudioConfigSettings::PCMVolume
static HostSpinBoxSetting * PCMVolume()
Definition: audiogeneralsettings.cpp:1130
AudioTest::m_frontleft
ButtonStandardSetting * m_frontleft
Definition: audiogeneralsettings.h:187
AudioTest::prepareTest
void prepareTest()
Definition: audiogeneralsettings.cpp:938
AudioConfigSettings::UpdateAudioTest
void UpdateAudioTest()
Definition: audiogeneralsettings.cpp:578
AudioTest::m_passthrough
QString m_passthrough
Definition: audiogeneralsettings.h:199
HostCheckBoxSetting
Definition: standardsettings.h:415
AudioConfigSettings::PassThroughOutputDevice
static HostComboBoxSetting * PassThroughOutputDevice()
Definition: audiogeneralsettings.cpp:1218
AudioTest::m_surroundright
ButtonStandardSetting * m_surroundright
Definition: audiogeneralsettings.h:191
AudioConfigScreen
Definition: audiogeneralsettings.h:25
AudioTest::m_hd
TransMythUICheckBoxSetting * m_hd
Definition: audiogeneralsettings.h:197
AudioConfigSettings::m_ac3PassThrough
HostCheckBoxSetting * m_ac3PassThrough
Definition: audiogeneralsettings.h:96
AudioDeviceComboBox::AudioDeviceComboBox
AudioDeviceComboBox(AudioConfigSettings *parent)
Definition: audiogeneralsettings.cpp:31
ChannelChangedEvent::m_fulltest
bool m_fulltest
Definition: audiogeneralsettings.h:140
AudioDeviceComboBox::edit
void edit(MythScreenType *screen) override
Definition: audiogeneralsettings.cpp:56
AudioConfigSettings::EAC3PassThrough
static HostCheckBoxSetting * EAC3PassThrough()
Definition: audiogeneralsettings.cpp:499
ChannelChangedEvent::ChannelChangedEvent
ChannelChangedEvent(QString channame, bool fulltest)
Definition: audiogeneralsettings.cpp:590
AudioConfigSettings::MPCM
static HostCheckBoxSetting * MPCM()
Definition: audiogeneralsettings.cpp:1143
AudioConfigSettings::HBRPassthrough
static HostCheckBoxSetting * HBRPassthrough()
Definition: audiogeneralsettings.cpp:1258
StandardSettingDialog
Definition: standardsettings.h:466
AudioTest::event
bool event(QEvent *event) override
Definition: audiogeneralsettings.cpp:965
AudioOutput
Definition: audiooutput.h:26
AudioTestThread::run
void run() override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: audiogeneralsettings.cpp:650
AudioConfigScreen::Load
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
Definition: audiogeneralsettings.cpp:93
AudioConfigSettings::m_triggerDigital
GroupSetting * m_triggerDigital
Definition: audiogeneralsettings.h:95
AudioTestThread::setChannel
void setChannel(int channel)
Definition: audiogeneralsettings.cpp:645
AudioTestThread::m_channels
int m_channels
Definition: audiogeneralsettings.h:165
AudioConfigSettings::m_audioTest
AudioTest * m_audioTest
Definition: audiogeneralsettings.h:106
AudioTest::m_frontright
ButtonStandardSetting * m_frontright
Definition: audiogeneralsettings.h:188
AudioConfigSettings::MythControlsVolume
static HostCheckBoxSetting * MythControlsVolume()
Definition: audiogeneralsettings.cpp:1040
AudioTestThread::m_passthrough
QString m_passthrough
Definition: audiogeneralsettings.h:167
AudioConfigSettings::m_maxAudioChannels
HostComboBoxSetting * m_maxAudioChannels
Definition: audiogeneralsettings.h:90
AudioConfigSettings::m_mpcm
HostCheckBoxSetting * m_mpcm
Definition: audiogeneralsettings.h:102
AudioTestThread
Definition: audiogeneralsettings.h:146
AudioConfigSettings::CheckConfiguration
void CheckConfiguration(void)
Definition: audiogeneralsettings.cpp:191
AudioTestThread::m_format
AudioFormat m_format
Definition: audiogeneralsettings.h:172
AudioConfigSettings::m_devices
AudioOutput::ADCVect m_devices
Definition: audiogeneralsettings.h:109
AudioTest::~AudioTest
~AudioTest() override
Definition: audiogeneralsettings.cpp:847
AC3
@ AC3
Definition: element.h:84
AudioConfigSettings::MixerDevice
static HostComboBoxSetting * MixerDevice()
Definition: audiogeneralsettings.cpp:1061
AudioConfigSettings::m_outputDevice
AudioDeviceComboBox * m_outputDevice
Definition: audiogeneralsettings.h:89
AudioConfigSettings::OutputDevice
AudioDeviceComboBox * OutputDevice()
AudioConfigSettings::UpdateCapabilities
AudioOutputSettings UpdateCapabilities(bool restore=true, bool AC3=false)
Definition: audiogeneralsettings.cpp:273
AudioDeviceComboBox::m_parent
AudioConfigSettings * m_parent
Definition: audiogeneralsettings.h:130
AudioConfigSettings::setMPCMEnabled
void setMPCMEnabled(bool flag)
Definition: audiogeneralsettings.cpp:1275
AudioTestThread::m_interrupted
bool m_interrupted
Definition: audiogeneralsettings.h:168
AudioConfigSettings::AudioDeviceMap
ADCMap & AudioDeviceMap(void)
Definition: audiogeneralsettings.h:46
AudioConfigSettings::AudioDeviceVect
AudioOutput::ADCVect & AudioDeviceVect(void)
Definition: audiogeneralsettings.h:47
AudioConfigSettings::SRCQuality
static HostComboBoxSetting * SRCQuality()
Definition: audiogeneralsettings.cpp:1171
AudioConfigSettings::DTSPassThrough
static HostCheckBoxSetting * DTSPassThrough()
Definition: audiogeneralsettings.cpp:485
AudioConfigSettings::m_dtsPassThrough
HostCheckBoxSetting * m_dtsPassThrough
Definition: audiogeneralsettings.h:97
AudioTestThread::m_audioOutput
AudioOutput * m_audioOutput
Definition: audiogeneralsettings.h:164
AudioTestThread::~AudioTestThread
~AudioTestThread() override
Definition: audiogeneralsettings.cpp:623
standardsettings.h
AudioConfigSettings::DTSHDPassThrough
static HostCheckBoxSetting * DTSHDPassThrough()
Definition: audiogeneralsettings.cpp:525
AudioConfigScreen::AudioConfigScreen
AudioConfigScreen(MythScreenStack *parent, const char *name, GroupSetting *groupSetting)
Definition: audiogeneralsettings.cpp:87
AudioTest::toggle
void toggle()
Definition: audiogeneralsettings.cpp:875
HostSpinBoxSetting
Definition: standardsettings.h:362
AudioTest::cancelTest
void cancelTest()
Definition: audiogeneralsettings.cpp:929
AudioTest::m_center
ButtonStandardSetting * m_center
Definition: audiogeneralsettings.h:189
AudioTest::UpdateCapabilities
void UpdateCapabilities(const QString &main, const QString &passthrough, int channels, const AudioOutputSettings &settings)
Definition: audiogeneralsettings.cpp:858
AudioConfigSettings::m_audioUpmixType
HostComboBoxSetting * m_audioUpmixType
Definition: audiogeneralsettings.h:92
AudioConfigSettings::UpdateCapabilitiesAC3
AudioOutputSettings UpdateCapabilitiesAC3(void)
Definition: audiogeneralsettings.cpp:418
AudioConfigSettings::AC3PassThrough
static HostCheckBoxSetting * AC3PassThrough()
Definition: audiogeneralsettings.cpp:471
ChannelChangedEvent
Definition: audiogeneralsettings.h:134
ChannelChangedEvent::kEventType
static Type kEventType
Definition: audiogeneralsettings.h:142
AudioTestThread::m_parent
QObject * m_parent
Definition: audiogeneralsettings.h:163
AudioTest::m_startButton
ButtonStandardSetting * m_startButton
Definition: audiogeneralsettings.h:196
AudioConfigSettings::AudioUpmix
static HostCheckBoxSetting * AudioUpmix()
Definition: audiogeneralsettings.cpp:441
AudioConfigSettings::m_passThroughOverride
HostCheckBoxSetting * m_passThroughOverride
Definition: audiogeneralsettings.h:103
AudioConfigSettings::m_eac3PassThrough
HostCheckBoxSetting * m_eac3PassThrough
Definition: audiogeneralsettings.h:98
AudioTest::m_at
AudioTestThread * m_at
Definition: audiogeneralsettings.h:195
AudioOutputSettings
Definition: audiooutputsettings.h:50
audiooutput.h
ChannelChangedEvent::~ChannelChangedEvent
~ChannelChangedEvent() override=default
AudioConfigSettings::m_maxSpeakers
int m_maxSpeakers
Definition: audiogeneralsettings.h:112
AudioConfigSettings
Definition: audiogeneralsettings.h:37
AudioTest::m_settings
AudioOutputSettings m_settings
Definition: audiogeneralsettings.h:200
HostComboBoxSetting
Definition: standardsettings.h:255
mythcontext.h
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
AudioTestThread::result
QString result()
Definition: audiogeneralsettings.cpp:635
mthread.h
AudioDeviceComboBox::AudioDescriptionHelp
void AudioDescriptionHelp(StandardSetting *setting)
Definition: audiogeneralsettings.cpp:81
AudioTest::m_main
QString m_main
Definition: audiogeneralsettings.h:198
mythuibutton.h
AudioTest::m_rearleft
ButtonStandardSetting * m_rearleft
Definition: audiogeneralsettings.h:192
StandardSetting
Definition: standardsettings.h:30
AudioConfigScreen::Init
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Definition: audiogeneralsettings.cpp:99
AudioConfigSettings::AudioUpmixType
static HostComboBoxSetting * AudioUpmixType()
Definition: audiogeneralsettings.cpp:455
AudioTest::m_lfe
ButtonStandardSetting * m_lfe
Definition: audiogeneralsettings.h:194
AudioTest::togglequality
void togglequality(void)
Definition: audiogeneralsettings.cpp:923
AudioTest::m_rearright
ButtonStandardSetting * m_rearright
Definition: audiogeneralsettings.h:193
AudioTest::m_channels
int m_channels
Definition: audiogeneralsettings.h:186
AudioTest::AudioTest
AudioTest()
Definition: audiogeneralsettings.cpp:764
AudioFormat
AudioFormat
Definition: audiooutputsettings.h:25
AudioConfigSettings::m_dtsHDPassThrough
HostCheckBoxSetting * m_dtsHDPassThrough
Definition: audiogeneralsettings.h:100
AudioOutput::ADCVect
QVector< AudioDeviceConfig > ADCVect
Definition: audiooutput.h:48
AudioTestThread::m_channel
int m_channel
Definition: audiogeneralsettings.h:169
AudioConfigSettings::Load
void Load() override
Definition: audiogeneralsettings.cpp:224
AudioConfigSettings::CheckPassthrough
bool CheckPassthrough()
Definition: audiogeneralsettings.cpp:538
AudioConfigSettings::SPDIFRateOverride
static HostCheckBoxSetting * SPDIFRateOverride()
Definition: audiogeneralsettings.cpp:1243
AudioConfigSettings::m_audioUpmix
HostCheckBoxSetting * m_audioUpmix
Definition: audiogeneralsettings.h:91
mythscreentype.h
GroupSetting
Definition: standardsettings.h:433
AudioDeviceComboBox::AudioRescan
void AudioRescan()
Definition: audiogeneralsettings.cpp:62