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);
55  void UpdateCapabilities(StandardSetting */*setting*/);
57  void UpdateCapabilitiesAC3(StandardSetting */*setting*/);
58  void AudioRescan();
59  void UpdateAudioTest();
60 
61  private:
62  void setMPCMEnabled(bool flag);
63 
77  static HostSpinBoxSetting *PCMVolume();
78 
79  //advanced setting
80  static HostCheckBoxSetting *MPCM();
88 
89  bool CheckPassthrough();
90 
95 
96  // digital settings
103  //advanced setting
107 
108  AudioTest *m_audioTest {nullptr};
109 
112  QMutex m_slotLock;
113 
114  int m_maxSpeakers {0};
116  static const std::array<const char *,2> kMixerControlControls;
117 };
118 
120 {
121  Q_OBJECT
122  public:
123  explicit AudioDeviceComboBox(AudioConfigSettings *parent);
124  void AudioRescan();
125 
126  void edit(MythScreenType * screen) override; // MythUIComboBoxSetting
127 
128  private slots:
129  void AudioDescriptionHelp(StandardSetting * setting);
130 
131  private:
133 };
134 
135 class ChannelChangedEvent : public QEvent
136 {
137  public:
138  ChannelChangedEvent(QString channame, bool fulltest);
139  ~ChannelChangedEvent() override = default;
140 
141  QString m_channel;
143 
144  static Type kEventType;
145 };
146 
147 class AudioTestThread : public MThread
148 {
149  Q_DECLARE_TR_FUNCTIONS(AudioTestThread)
150 
151  public:
152 
153  AudioTestThread(QObject *parent, QString main, QString passthrough,
154  int channels, AudioOutputSettings &settings, bool hd);
155  ~AudioTestThread() override;
156 
157  void cancel();
158  QString result();
159  void setChannel(int channel);
160 
161  protected:
162  void run() override; // MThread
163 
164  private:
165  QObject *m_parent {nullptr};
168  QString m_device;
169  QString m_passthrough;
170  bool m_interrupted {false};
171  int m_channel {-1};
172  bool m_hd {false};
173  int m_samplerate {48000};
175 };
176 
177 class AudioTest : public GroupSetting
178 {
179  Q_OBJECT
180  public:
181  AudioTest();
182  ~AudioTest() override;
183  void UpdateCapabilities(const QString &main, const QString &passthrough,
184  int channels, const AudioOutputSettings &settings);
185  bool event(QEvent *event) override; // QObject
186 
187  private:
188  int m_channels {2};
197  AudioTestThread *m_at {nullptr};
200  QString m_main;
201  QString m_passthrough;
203  bool m_quality {false};
204 
205  private slots:
206  void toggle();
207  void togglequality(const QString &/*value*/);
208  void cancelTest();
209  void prepareTest();
210 };
211 #endif
AudioConfigSettings::m_lastAudioDevice
QString m_lastAudioDevice
Definition: audiogeneralsettings.h:115
bbciplayer.main
main
Definition: bbciplayer.py:263
AudioTest::togglequality
void togglequality(const QString &)
Definition: audiogeneralsettings.cpp:933
AudioTest::m_surroundleft
ButtonStandardSetting * m_surroundleft
Definition: audiogeneralsettings.h:192
AudioConfigSettings::Audio48kOverride
static HostCheckBoxSetting * Audio48kOverride()
Definition: audiogeneralsettings.cpp:1202
AudioConfigSettings::TrueHDPassThrough
static HostCheckBoxSetting * TrueHDPassThrough()
Definition: audiogeneralsettings.cpp:521
TransMythUICheckBoxSetting
Definition: standardsettings.h:411
AudioConfigSettings::MixerControl
static HostComboBoxSetting * MixerControl()
Definition: audiogeneralsettings.cpp:1112
AudioConfigSettings::AudioRescan
void AudioRescan()
Definition: audiogeneralsettings.cpp:234
AudioConfigSettings::MaxAudioChannels
static HostComboBoxSetting * MaxAudioChannels()
Definition: audiogeneralsettings.cpp:433
AudioTestThread::AudioTestThread
AudioTestThread(QObject *parent, QString main, QString passthrough, int channels, AudioOutputSettings &settings, bool hd)
Definition: audiogeneralsettings.cpp:606
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:116
ChannelChangedEvent::m_channel
QString m_channel
Definition: audiogeneralsettings.h:141
AudioConfigSettings::AudioConfigSettings
AudioConfigSettings()
Definition: audiogeneralsettings.cpp:109
AudioTestThread::m_samplerate
int m_samplerate
Definition: audiogeneralsettings.h:173
AudioConfigSettings::m_slotLock
QMutex m_slotLock
Definition: audiogeneralsettings.h:112
AudioConfigSettings::m_audioDevs
ADCMap m_audioDevs
Definition: audiogeneralsettings.h:110
AudioConfigSettings::SRCQualityOverride
static HostCheckBoxSetting * SRCQualityOverride()
Definition: audiogeneralsettings.cpp:1168
ButtonStandardSetting
Definition: standardsettings.h:450
AudioTestThread::m_device
QString m_device
Definition: audiogeneralsettings.h:168
AudioConfigSettings::UpdateVisibility
void UpdateVisibility(StandardSetting *)
Definition: audiogeneralsettings.cpp:263
AudioConfigSettings::MixerVolume
static HostSpinBoxSetting * MixerVolume()
Definition: audiogeneralsettings.cpp:1126
AudioTest::m_quality
bool m_quality
Definition: audiogeneralsettings.h:203
AudioConfigSettings::m_passThroughDeviceOverride
HostComboBoxSetting * m_passThroughDeviceOverride
Definition: audiogeneralsettings.h:106
AudioTestThread::cancel
void cancel()
Definition: audiogeneralsettings.cpp:639
AudioTestThread::m_hd
bool m_hd
Definition: audiogeneralsettings.h:172
AudioConfigSettings::PassThroughOverride
static HostCheckBoxSetting * PassThroughOverride()
Definition: audiogeneralsettings.cpp:1215
AudioTest
Definition: audiogeneralsettings.h:177
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:16
AudioConfigSettings::m_trueHDPassThrough
HostCheckBoxSetting * m_trueHDPassThrough
Definition: audiogeneralsettings.h:101
AC3
@ AC3
Definition: element.h:84
AudioDeviceComboBox
Definition: audiogeneralsettings.h:119
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:44
mythuistatetype.h
AudioConfigSettings::PCMVolume
static HostSpinBoxSetting * PCMVolume()
Definition: audiogeneralsettings.cpp:1140
AudioTest::m_frontleft
ButtonStandardSetting * m_frontleft
Definition: audiogeneralsettings.h:189
AudioTest::prepareTest
void prepareTest()
Definition: audiogeneralsettings.cpp:948
AudioConfigSettings::UpdateAudioTest
void UpdateAudioTest()
Definition: audiogeneralsettings.cpp:587
AudioTest::m_passthrough
QString m_passthrough
Definition: audiogeneralsettings.h:201
HostCheckBoxSetting
Definition: standardsettings.h:417
AudioConfigSettings::PassThroughOutputDevice
static HostComboBoxSetting * PassThroughOutputDevice()
Definition: audiogeneralsettings.cpp:1228
AudioTest::m_surroundright
ButtonStandardSetting * m_surroundright
Definition: audiogeneralsettings.h:193
AudioConfigScreen
Definition: audiogeneralsettings.h:24
AudioTest::m_hd
TransMythUICheckBoxSetting * m_hd
Definition: audiogeneralsettings.h:199
AudioConfigSettings::m_ac3PassThrough
HostCheckBoxSetting * m_ac3PassThrough
Definition: audiogeneralsettings.h:98
AudioDeviceComboBox::AudioDeviceComboBox
AudioDeviceComboBox(AudioConfigSettings *parent)
Definition: audiogeneralsettings.cpp:31
ChannelChangedEvent::m_fulltest
bool m_fulltest
Definition: audiogeneralsettings.h:142
AudioDeviceComboBox::edit
void edit(MythScreenType *screen) override
Definition: audiogeneralsettings.cpp:56
AudioConfigSettings::EAC3PassThrough
static HostCheckBoxSetting * EAC3PassThrough()
Definition: audiogeneralsettings.cpp:508
ChannelChangedEvent::ChannelChangedEvent
ChannelChangedEvent(QString channame, bool fulltest)
Definition: audiogeneralsettings.cpp:599
AudioConfigSettings::MPCM
static HostCheckBoxSetting * MPCM()
Definition: audiogeneralsettings.cpp:1153
AudioConfigSettings::HBRPassthrough
static HostCheckBoxSetting * HBRPassthrough()
Definition: audiogeneralsettings.cpp:1268
StandardSettingDialog
Definition: standardsettings.h:468
AudioTest::event
bool event(QEvent *event) override
Definition: audiogeneralsettings.cpp:975
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:659
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:97
AudioTestThread::setChannel
void setChannel(int channel)
Definition: audiogeneralsettings.cpp:654
AudioTestThread::m_channels
int m_channels
Definition: audiogeneralsettings.h:167
AudioConfigSettings::m_audioTest
AudioTest * m_audioTest
Definition: audiogeneralsettings.h:108
AudioTest::m_frontright
ButtonStandardSetting * m_frontright
Definition: audiogeneralsettings.h:190
AudioConfigSettings::MythControlsVolume
static HostCheckBoxSetting * MythControlsVolume()
Definition: audiogeneralsettings.cpp:1050
AudioTestThread::m_passthrough
QString m_passthrough
Definition: audiogeneralsettings.h:169
AudioConfigSettings::m_maxAudioChannels
HostComboBoxSetting * m_maxAudioChannels
Definition: audiogeneralsettings.h:92
AudioConfigSettings::m_mpcm
HostCheckBoxSetting * m_mpcm
Definition: audiogeneralsettings.h:104
AudioTestThread
Definition: audiogeneralsettings.h:147
AudioConfigSettings::CheckConfiguration
void CheckConfiguration(void)
Definition: audiogeneralsettings.cpp:191
AudioTestThread::m_format
AudioFormat m_format
Definition: audiogeneralsettings.h:174
AudioConfigSettings::m_devices
AudioOutput::ADCVect m_devices
Definition: audiogeneralsettings.h:111
AudioTest::~AudioTest
~AudioTest() override
Definition: audiogeneralsettings.cpp:857
AudioConfigSettings::MixerDevice
static HostComboBoxSetting * MixerDevice()
Definition: audiogeneralsettings.cpp:1071
AudioConfigSettings::m_outputDevice
AudioDeviceComboBox * m_outputDevice
Definition: audiogeneralsettings.h:91
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:132
AudioConfigSettings::setMPCMEnabled
void setMPCMEnabled(bool flag)
Definition: audiogeneralsettings.cpp:1285
AudioTestThread::m_interrupted
bool m_interrupted
Definition: audiogeneralsettings.h:170
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:1181
AudioConfigSettings::DTSPassThrough
static HostCheckBoxSetting * DTSPassThrough()
Definition: audiogeneralsettings.cpp:494
AudioConfigSettings::m_dtsPassThrough
HostCheckBoxSetting * m_dtsPassThrough
Definition: audiogeneralsettings.h:99
AudioTestThread::m_audioOutput
AudioOutput * m_audioOutput
Definition: audiogeneralsettings.h:166
AudioTestThread::~AudioTestThread
~AudioTestThread() override
Definition: audiogeneralsettings.cpp:632
standardsettings.h
AudioConfigSettings::DTSHDPassThrough
static HostCheckBoxSetting * DTSHDPassThrough()
Definition: audiogeneralsettings.cpp:534
AudioConfigScreen::AudioConfigScreen
AudioConfigScreen(MythScreenStack *parent, const char *name, GroupSetting *groupSetting)
Definition: audiogeneralsettings.cpp:87
AudioTest::toggle
void toggle()
Definition: audiogeneralsettings.cpp:885
HostSpinBoxSetting
Definition: standardsettings.h:364
AudioTest::cancelTest
void cancelTest()
Definition: audiogeneralsettings.cpp:939
AudioTest::m_center
ButtonStandardSetting * m_center
Definition: audiogeneralsettings.h:191
AudioTest::UpdateCapabilities
void UpdateCapabilities(const QString &main, const QString &passthrough, int channels, const AudioOutputSettings &settings)
Definition: audiogeneralsettings.cpp:868
AudioConfigSettings::m_audioUpmixType
HostComboBoxSetting * m_audioUpmixType
Definition: audiogeneralsettings.h:94
AudioConfigSettings::UpdateCapabilitiesAC3
AudioOutputSettings UpdateCapabilitiesAC3(void)
Definition: audiogeneralsettings.cpp:423
AudioConfigSettings::AC3PassThrough
static HostCheckBoxSetting * AC3PassThrough()
Definition: audiogeneralsettings.cpp:480
ChannelChangedEvent
Definition: audiogeneralsettings.h:135
ChannelChangedEvent::kEventType
static Type kEventType
Definition: audiogeneralsettings.h:144
AudioTestThread::m_parent
QObject * m_parent
Definition: audiogeneralsettings.h:165
AudioTest::m_startButton
ButtonStandardSetting * m_startButton
Definition: audiogeneralsettings.h:198
AudioConfigSettings::AudioUpmix
static HostCheckBoxSetting * AudioUpmix()
Definition: audiogeneralsettings.cpp:450
AudioConfigSettings::m_passThroughOverride
HostCheckBoxSetting * m_passThroughOverride
Definition: audiogeneralsettings.h:105
AudioConfigSettings::m_eac3PassThrough
HostCheckBoxSetting * m_eac3PassThrough
Definition: audiogeneralsettings.h:100
AudioTest::m_at
AudioTestThread * m_at
Definition: audiogeneralsettings.h:197
AudioOutputSettings
Definition: audiooutputsettings.h:49
audiooutput.h
ChannelChangedEvent::~ChannelChangedEvent
~ChannelChangedEvent() override=default
AudioConfigSettings::m_maxSpeakers
int m_maxSpeakers
Definition: audiogeneralsettings.h:114
AudioConfigSettings
Definition: audiogeneralsettings.h:36
AudioTest::m_settings
AudioOutputSettings m_settings
Definition: audiogeneralsettings.h:202
HostComboBoxSetting
Definition: standardsettings.h:257
mythcontext.h
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:48
AudioTestThread::result
QString result()
Definition: audiogeneralsettings.cpp:644
mthread.h
AudioDeviceComboBox::AudioDescriptionHelp
void AudioDescriptionHelp(StandardSetting *setting)
Definition: audiogeneralsettings.cpp:81
AudioTest::m_main
QString m_main
Definition: audiogeneralsettings.h:200
mythuibutton.h
AudioTest::m_rearleft
ButtonStandardSetting * m_rearleft
Definition: audiogeneralsettings.h:194
StandardSetting
Definition: standardsettings.h:29
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:464
AudioTest::m_lfe
ButtonStandardSetting * m_lfe
Definition: audiogeneralsettings.h:196
AudioTest::m_rearright
ButtonStandardSetting * m_rearright
Definition: audiogeneralsettings.h:195
AudioTest::m_channels
int m_channels
Definition: audiogeneralsettings.h:188
AudioTest::AudioTest
AudioTest()
Definition: audiogeneralsettings.cpp:773
AudioFormat
AudioFormat
Definition: audiooutputsettings.h:25
AudioConfigSettings::m_dtsHDPassThrough
HostCheckBoxSetting * m_dtsHDPassThrough
Definition: audiogeneralsettings.h:102
AudioOutput::ADCVect
QVector< AudioDeviceConfig > ADCVect
Definition: audiooutput.h:49
AudioTestThread::m_channel
int m_channel
Definition: audiogeneralsettings.h:171
AudioConfigSettings::Load
void Load() override
Definition: audiogeneralsettings.cpp:224
AudioConfigSettings::CheckPassthrough
bool CheckPassthrough()
Definition: audiogeneralsettings.cpp:547
AudioConfigSettings::SPDIFRateOverride
static HostCheckBoxSetting * SPDIFRateOverride()
Definition: audiogeneralsettings.cpp:1253
AudioConfigSettings::m_audioUpmix
HostCheckBoxSetting * m_audioUpmix
Definition: audiogeneralsettings.h:93
mythscreentype.h
GroupSetting
Definition: standardsettings.h:435
AudioDeviceComboBox::AudioRescan
void AudioRescan()
Definition: audiogeneralsettings.cpp:62