mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-10 10:33:29 -05:00
Audio output device: added volume control
This commit is contained in:
parent
8a335aa277
commit
b3476e4757
@ -33,6 +33,7 @@ AudioOutputDevice::AudioOutputDevice() :
|
||||
m_udpChannelCodec(UDPCodecL16),
|
||||
m_audioUsageCount(0),
|
||||
m_onExit(false),
|
||||
m_volume(1.0),
|
||||
m_audioFifos()
|
||||
{
|
||||
}
|
||||
@ -114,6 +115,7 @@ bool AudioOutputDevice::start(int device, int rate)
|
||||
|
||||
m_audioOutput = new QAudioOutput(devInfo, m_audioFormat);
|
||||
m_audioNetSink = new AudioNetSink(0, m_audioFormat.sampleRate(), false);
|
||||
m_audioOutput->setVolume(m_volume);
|
||||
|
||||
QIODevice::open(QIODevice::ReadOnly);
|
||||
|
||||
@ -341,3 +343,12 @@ qint64 AudioOutputDevice::writeData(const char* data, qint64 len)
|
||||
Q_UNUSED(len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AudioOutputDevice::setVolume(float volume)
|
||||
{
|
||||
m_volume = volume;
|
||||
|
||||
if (m_audioOutput) {
|
||||
m_audioOutput->setVolume(m_volume);
|
||||
}
|
||||
}
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
void setUdpChannelMode(UDPChannelMode udpChannelMode);
|
||||
void setUdpChannelFormat(UDPChannelCodec udpChannelCodec, bool stereo, int sampleRate);
|
||||
void setUdpDecimation(uint32_t decimation);
|
||||
void setVolume(float volume);
|
||||
|
||||
private:
|
||||
QMutex m_mutex;
|
||||
@ -81,6 +82,7 @@ private:
|
||||
UDPChannelCodec m_udpChannelCodec;
|
||||
uint m_audioUsageCount;
|
||||
bool m_onExit;
|
||||
float m_volume;
|
||||
|
||||
std::list<AudioFifo*> m_audioFifos;
|
||||
std::vector<qint32> m_mixBuffer;
|
||||
|
Loading…
Reference in New Issue
Block a user