forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdlgprefsounditem.h
More file actions
68 lines (60 loc) · 2.32 KB
/
Copy pathdlgprefsounditem.h
File metadata and controls
68 lines (60 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#include "preferences/dialog/ui_dlgprefsounditem.h"
#include "soundio/soundmanagerutil.h"
#include "soundio/sounddevice.h"
class SoundManagerConfig;
/**
* Class representing an input or output selection widget in DlgPrefSound.
* The widget includes a label describing the input or output, a combo box
* with a list of available devices and a combo box with a list of available
* channels.
*/
class DlgPrefSoundItem : public QWidget, public Ui::DlgPrefSoundItem {
Q_OBJECT
public:
DlgPrefSoundItem(QWidget* parent, AudioPathType type,
const QList<SoundDevicePointer>& devices,
bool isInput, unsigned int index = 0);
virtual ~DlgPrefSoundItem();
AudioPathType type() const { return m_type; };
unsigned int index() const { return m_index; };
bool isInput() {
return m_isInput;
}
const SoundDeviceId getDeviceId() {
return deviceComboBox->itemData(deviceComboBox->currentIndex()).value<SoundDeviceId>();
}
int getChannelIndex() {
return channelComboBox->currentIndex();
}
void selectFirstUnusedChannelIndex(const QList<int>& selectedChannels);
void setDevice(const SoundDeviceId& device);
signals:
void selectedDeviceChanged();
void selectedChannelsChanged();
void configuredDeviceNotFound();
public slots:
void refreshDevices(const QList<SoundDevicePointer>& devices);
void deviceChanged(int index);
void channelChanged();
void loadPath(const SoundManagerConfig& config);
void writePath(SoundManagerConfig *config) const;
void save();
void reload();
void addDevice(SoundDevicePointer pDevice);
void removeDevice(SoundDevicePointer pDevice);
void updateDeviceChannels(SoundDevicePointer pDevice);
private:
SoundDevicePointer getDevice() const; // if this returns NULL, we don't have a valid AudioPath
void setChannel(unsigned int channelBase, unsigned int channels);
int hasSufficientChannels(const SoundDevice& device) const;
AudioPathType m_type;
unsigned int m_index;
QList<SoundDevicePointer> m_devices;
bool m_isInput;
SoundDeviceId m_savedDevice;
// Because QVariant supports QPoint natively we use a QPoint to store the
// channel info. x is the channel base and y is the channel count.
QPoint m_savedChannel;
bool m_emitSettingChanged;
};