mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 04:20:14 +02:00
Instantiate new gate with the correct number of channels
This commit is contained in:
parent
746b41e509
commit
71de3d5ca1
2 changed files with 10 additions and 0 deletions
|
@ -1415,6 +1415,10 @@ bool AudioClient::switchInputToAudioDevice(const QAudioDeviceInfo& inputDeviceIn
|
||||||
delete _inputToNetworkResampler;
|
delete _inputToNetworkResampler;
|
||||||
_inputToNetworkResampler = NULL;
|
_inputToNetworkResampler = NULL;
|
||||||
}
|
}
|
||||||
|
if (_audioGate) {
|
||||||
|
delete _audioGate;
|
||||||
|
_audioGate = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (!inputDeviceInfo.isNull()) {
|
if (!inputDeviceInfo.isNull()) {
|
||||||
qCDebug(audioclient) << "The audio input device " << inputDeviceInfo.deviceName() << "is available.";
|
qCDebug(audioclient) << "The audio input device " << inputDeviceInfo.deviceName() << "is available.";
|
||||||
|
@ -1440,6 +1444,10 @@ bool AudioClient::switchInputToAudioDevice(const QAudioDeviceInfo& inputDeviceIn
|
||||||
qCDebug(audioclient) << "No resampling required for audio input to match desired network format.";
|
qCDebug(audioclient) << "No resampling required for audio input to match desired network format.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the audio gate runs after the resampler
|
||||||
|
_audioGate = new AudioGate(_desiredInputFormat.sampleRate(), _desiredInputFormat.channelCount());
|
||||||
|
qCDebug(audioclient) << "Noise gate created with" << _desiredInputFormat.channelCount() << "channels.";
|
||||||
|
|
||||||
// if the user wants stereo but this device can't provide then bail
|
// if the user wants stereo but this device can't provide then bail
|
||||||
if (!_isStereoInput || _inputFormat.channelCount() == 2) {
|
if (!_isStereoInput || _inputFormat.channelCount() == 2) {
|
||||||
_audioInput = new QAudioInput(inputDeviceInfo, _inputFormat, this);
|
_audioInput = new QAudioInput(inputDeviceInfo, _inputFormat, this);
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include <AudioLimiter.h>
|
#include <AudioLimiter.h>
|
||||||
#include <AudioConstants.h>
|
#include <AudioConstants.h>
|
||||||
#include <AudioNoiseGate.h>
|
#include <AudioNoiseGate.h>
|
||||||
|
#include <AudioGate.h>
|
||||||
|
|
||||||
#include <shared/RateCounter.h>
|
#include <shared/RateCounter.h>
|
||||||
|
|
||||||
|
@ -361,6 +362,7 @@ private:
|
||||||
AudioIOStats _stats;
|
AudioIOStats _stats;
|
||||||
|
|
||||||
AudioNoiseGate _noiseGate;
|
AudioNoiseGate _noiseGate;
|
||||||
|
AudioGate* _audioGate { nullptr };
|
||||||
|
|
||||||
AudioPositionGetter _positionGetter;
|
AudioPositionGetter _positionGetter;
|
||||||
AudioOrientationGetter _orientationGetter;
|
AudioOrientationGetter _orientationGetter;
|
||||||
|
|
Loading…
Reference in a new issue