MythTV  master
audiogeneralsettings.h
Go to the documentation of this file.
1 #ifndef MYTHAUDIOSETTINGS_H
2 #define MYTHAUDIOSETTINGS_H
3 
4 #include <QStringList>
5 #include <QObject>
6 #include <QMutex>
7 
8 #include "mythuistatetype.h"
9 #include "mythscreentype.h"
10 #include "mythdialogbox.h"
11 #include "mythuibutton.h"
12 #include "audiooutput.h"
13 #include "mythcontext.h"
14 #include "standardsettings.h"
15 #include "mthread.h"
16 
18 class AudioTest;
19 
21 {
22  public:
23  AudioConfigScreen(MythScreenStack *parent, const char *name,
24  GroupSetting *groupSetting);
25  protected:
26  void Load(void) override; // StandardSettingDialog
27  void Init(void) override; // StandardSettingDialog
28 };
29 
31 {
32  Q_OBJECT
33 
34  public:
36  void Load() override; // StandardSetting
37 
38  using ADCMap = QMap<QString,AudioOutput::AudioDeviceConfig>;
39 
40  ADCMap &AudioDeviceMap(void) { return audiodevs; };
42 
43  void CheckConfiguration(void);
44 
45  private slots:
47  AudioOutputSettings UpdateCapabilities(bool restore = true,
48  bool AC3 = false);
50  void AudioRescan();
51  void UpdateAudioTest();
52 
53  private:
54  void setMPCMEnabled(bool flag);
55 
69  static HostSpinBoxSetting *PCMVolume();
70 
71  //advanced setting
72  static HostCheckBoxSetting *MPCM();
80 
81  bool CheckPassthrough();
82 
87 
88  // digital settings
95  //advanced setting
99 
100  AudioTest *m_audioTest {nullptr};
101 
104  QMutex slotlock;
105 
106  int m_maxspeakers {0};
108  static const char *MixerControlControls[];
109 };
110 
112 {
113  Q_OBJECT
114  public:
116  void AudioRescan();
117 
118  void edit(MythScreenType * screen) override; // MythUIComboBoxSetting
119 
120  private slots:
121  void AudioDescriptionHelp(StandardSetting * setting);
122 
123  private:
125 };
126 
127 class ChannelChangedEvent : public QEvent
128 {
129  public:
130  ChannelChangedEvent(const QString& channame, bool fulltest) :
131  QEvent(kEventType), m_channel(channame), m_fulltest(fulltest) {}
132  ~ChannelChangedEvent() = default;
133 
134  QString m_channel;
136 
137  static Type kEventType;
138 };
139 
140 class AudioTestThread : public MThread
141 {
143 
144  public:
145 
146  AudioTestThread(QObject *parent, QString main, QString passthrough,
147  int channels, AudioOutputSettings &settings, bool hd);
149 
150  void cancel();
151  QString result();
152  void setChannel(int channel);
153 
154  protected:
155  void run() override; // MThread
156 
157  private:
158  QObject *m_parent {nullptr};
161  QString m_device;
162  QString m_passthrough;
163  bool m_interrupted {false};
164  int m_channel {-1};
165  bool m_hd {false};
166  int m_samplerate {48000};
168 };
169 
170 class AudioTest : public GroupSetting
171 {
172  Q_OBJECT
173  public:
174  AudioTest();
175  ~AudioTest();
176  void UpdateCapabilities(const QString &main, const QString &passthrough,
177  int channels, const AudioOutputSettings &settings);
178  bool event(QEvent *event) override; // QObject
179 
180  private:
181  int m_channels {2};
190  AudioTestThread *m_at {nullptr};
193  QString m_main;
194  QString m_passthrough;
196  bool m_quality {false};
197 
198  private slots:
199  void toggle();
200  void togglequality(void);
201  void cancelTest();
202  void prepareTest();
203 };
204 #endif
HostComboBoxSetting * m_PassThroughDeviceOverride
ButtonStandardSetting * m_rearright
static HostCheckBoxSetting * HBRPassthrough()
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:45
bool event(QEvent *event) override
static HostComboBoxSetting * PassThroughOutputDevice()
AudioOutput * m_audioOutput
void UpdateVisibility(StandardSetting *)
AudioOutput::ADCVect devices
HostCheckBoxSetting * m_TrueHDPassThrough
Definition: element.h:83
TransMythUICheckBoxSetting * m_hd
AudioConfigSettings * m_parent
static HostCheckBoxSetting * SRCQualityOverride()
AudioDeviceComboBox * OutputDevice()
HostCheckBoxSetting * m_AudioUpmix
HostComboBoxSetting * m_AudioUpmixType
static HostCheckBoxSetting * TrueHDPassThrough()
AudioTestThread(QObject *parent, QString main, QString passthrough, int channels, AudioOutputSettings &settings, bool hd)
static HostCheckBoxSetting * MPCM()
HostCheckBoxSetting * m_DTSHDPassThrough
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.
AudioDeviceComboBox(AudioConfigSettings *)
AudioDeviceComboBox * m_OutputDevice
static HostCheckBoxSetting * PassThroughOverride()
QMap< QString, AudioOutput::AudioDeviceConfig > ADCMap
ButtonStandardSetting * m_startButton
static HostComboBoxSetting * MaxAudioChannels()
static HostSpinBoxSetting * PCMVolume()
HostCheckBoxSetting * m_DTSPassThrough
void setChannel(int channel)
static HostComboBoxSetting * MixerDevice()
ButtonStandardSetting * m_frontright
static HostComboBoxSetting * MixerControl()
static HostComboBoxSetting * SRCQuality()
~ChannelChangedEvent()=default
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()
AudioTestThread * m_at
static HostComboBoxSetting * AudioUpmixType()
HostCheckBoxSetting * m_AC3PassThrough
HostComboBoxSetting * m_MaxAudioChannels
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)
HostCheckBoxSetting * m_EAC3PassThrough
ChannelChangedEvent(const QString &channame, bool fulltest)
AudioOutputSettings UpdateCapabilities(bool restore=true, bool AC3=false)
AudioOutputSettings m_settings
Q_DECLARE_TR_FUNCTIONS(AudioTestThread)
static HostCheckBoxSetting * SPDIFRateOverride()
static HostCheckBoxSetting * DTSPassThrough()
static HostCheckBoxSetting * EAC3PassThrough()
void edit(MythScreenType *screen) override
ButtonStandardSetting * m_surroundleft
static HostCheckBoxSetting * AudioUpmix()
AudioConfigScreen(MythScreenStack *parent, const char *name, GroupSetting *groupSetting)
static HostCheckBoxSetting * Audio48kOverride()
AudioOutput::ADCVect & AudioDeviceVect(void)
HostCheckBoxSetting * m_MPCM
static HostCheckBoxSetting * DTSHDPassThrough()
Screen in which all other widgets are contained and rendered.
HostCheckBoxSetting * m_PassThroughOverride
ButtonStandardSetting * m_frontleft
ButtonStandardSetting * m_rearleft
void togglequality(void)
static HostCheckBoxSetting * AC3PassThrough()
ButtonStandardSetting * m_surroundright
static HostCheckBoxSetting * MythControlsVolume()
void UpdateCapabilities(const QString &main, const QString &passthrough, int channels, const AudioOutputSettings &settings)
static const char * MixerControlControls[]
ADCMap & AudioDeviceMap(void)
GroupSetting * m_triggerDigital
ButtonStandardSetting * m_center