19 #ifndef INCLUDE_AUDIODEVICEMANGER_H 20 #define INCLUDE_AUDIODEVICEMANGER_H 22 #include <QStringList> 25 #include <QAudioDeviceInfo> 41 sampleRate(m_defaultAudioSampleRate),
42 volume(m_defaultAudioInputVolume)
45 sampleRate = m_defaultAudioSampleRate;
46 volume = m_defaultAudioInputVolume;
58 sampleRate(m_defaultAudioSampleRate),
59 udpAddress(m_defaultUDPAddress),
60 udpPort(m_defaultUDPPort),
65 udpDecimationFactor(1)
68 sampleRate = m_defaultAudioSampleRate;
69 udpAddress = m_defaultUDPAddress;
70 udpPort = m_defaultUDPPort;
75 udpDecimationFactor = 1;
92 const QList<QAudioDeviceInfo>&
getInputDevices()
const {
return m_inputDevicesInfo; }
93 const QList<QAudioDeviceInfo>&
getOutputDevices()
const {
return m_outputDevicesInfo; }
95 bool getOutputDeviceName(
int outputDeviceIndex, QString &deviceName)
const;
96 bool getInputDeviceName(
int inputDeviceIndex, QString &deviceName)
const;
97 int getOutputDeviceIndex(
const QString &deviceName)
const;
98 int getInputDeviceIndex(
const QString &deviceName)
const;
100 void addAudioSink(
AudioFifo* audioFifo,
MessageQueue *sampleSinkMessageQueue,
int outputDeviceIndex = -1);
101 void removeAudioSink(
AudioFifo* audioFifo);
103 void addAudioSource(
AudioFifo* audioFifo,
MessageQueue *sampleSourceMessageQueue,
int inputDeviceIndex = -1);
104 void removeAudioSource(
AudioFifo* audioFifo);
106 bool getInputDeviceInfo(
const QString& deviceName,
InputDeviceInfo& deviceInfo)
const;
107 bool getOutputDeviceInfo(
const QString& deviceName,
OutputDeviceInfo& deviceInfo)
const;
108 int getInputSampleRate(
int inputDeviceIndex = -1);
109 int getOutputSampleRate(
int outputDeviceIndex = -1);
110 void setInputDeviceInfo(
int inputDeviceIndex,
const InputDeviceInfo& deviceInfo);
111 void setOutputDeviceInfo(
int outputDeviceIndex,
const OutputDeviceInfo& deviceInfo);
112 void unsetInputDeviceInfo(
int inputDeviceIndex);
113 void unsetOutputDeviceInfo(
int outputDeviceIndex);
114 void inputInfosCleanup();
115 void outputInfosCleanup();
117 static const unsigned int m_defaultAudioSampleRate = 48000;
120 static const quint16 m_defaultUDPPort = 9998;
139 void resetToDefaults();
140 QByteArray serialize()
const;
141 bool deserialize(
const QByteArray& data);
143 void startAudioOutput(
int outputDeviceIndex);
144 void stopAudioOutput(
int outputDeviceIndex);
145 void startAudioInput(
int inputDeviceIndex);
146 void stopAudioInput(
int inputDeviceIndex);
148 void serializeInputMap(QByteArray& data)
const;
149 void deserializeInputMap(QByteArray& data);
150 void debugAudioInputInfos()
const;
152 void serializeOutputMap(QByteArray& data)
const;
153 void deserializeOutputMap(QByteArray& data);
154 void debugAudioOutputInfos()
const;
165 #endif // INCLUDE_AUDIODEVICEMANGER_H static const QString m_defaultDeviceName
QList< QAudioDeviceInfo > m_inputDevicesInfo
const QList< QAudioDeviceInfo > & getInputDevices() const
uint32_t udpDecimationFactor
QMap< QString, InputDeviceInfo > m_audioInputInfos
audio device name to audio input device info
static const QString m_defaultUDPAddress
QMap< int, QList< MessageQueue * > > m_inputDeviceSourceMessageQueues
sink message queues attached to device
AudioOutput::UDPChannelCodec udpChannelCodec
QMap< int, AudioInput * > m_audioInputs
audio device index to audio input map (index -1 is default device)
QMap< int, QList< MessageQueue * > > m_outputDeviceSinkMessageQueues
sink message queues attached to device
QDataStream & operator>>(QDataStream &ds, AudioDeviceManager::InputDeviceInfo &info)
QMap< AudioFifo *, MessageQueue * > m_audioFifoToSinkMessageQueues
audio sink FIFO to attached sink message queue
QDataStream & operator<<(QDataStream &ds, const AudioDeviceManager::InputDeviceInfo &info)
const QList< QAudioDeviceInfo > & getOutputDevices() const
QMap< AudioFifo *, MessageQueue * > m_audioFifoToSourceMessageQueues
audio source FIFO to attached source message queue
QMap< AudioFifo *, int > m_audioSinkFifos
AudioOutput::UDPChannelMode udpChannelMode
QMap< AudioFifo *, int > m_audioSourceFifos
QMap< int, AudioOutput * > m_audioOutputs
audio device index to audio output map (index -1 is default device)
static const float m_defaultAudioInputVolume
QMap< QString, OutputDeviceInfo > m_audioOutputInfos
audio device name to audio output info
QList< QAudioDeviceInfo > m_outputDevicesInfo