mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 19:52:26 +02:00
add peakValueListChanged scaffolding
This commit is contained in:
parent
209a4f33b5
commit
b46219241c
3 changed files with 34 additions and 4 deletions
|
@ -224,13 +224,18 @@ AudioClient::AudioClient() :
|
||||||
// start a thread to detect any device changes
|
// start a thread to detect any device changes
|
||||||
_checkDevicesTimer = new QTimer(this);
|
_checkDevicesTimer = new QTimer(this);
|
||||||
connect(_checkDevicesTimer, &QTimer::timeout, [this] {
|
connect(_checkDevicesTimer, &QTimer::timeout, [this] {
|
||||||
QtConcurrent::run(QThreadPool::globalInstance(), [this] {
|
QtConcurrent::run(QThreadPool::globalInstance(), [this] { checkDevices(); });
|
||||||
checkDevices();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
const unsigned long DEVICE_CHECK_INTERVAL_MSECS = 2 * 1000;
|
const unsigned long DEVICE_CHECK_INTERVAL_MSECS = 2 * 1000;
|
||||||
_checkDevicesTimer->start(DEVICE_CHECK_INTERVAL_MSECS);
|
_checkDevicesTimer->start(DEVICE_CHECK_INTERVAL_MSECS);
|
||||||
|
|
||||||
|
// start a thread to detect peak value changes
|
||||||
|
_checkPeakValuesTimer = new QTimer(this);
|
||||||
|
connect(_checkPeakValuesTimer, &QTimer::timeout, [this] {
|
||||||
|
QtConcurrent::run(QThreadPool::globalInstance(), [this] { checkPeakValues(); });
|
||||||
|
});
|
||||||
|
const unsigned long PEAK_VALUES_CHECK_INTERVAL_SECS = 50;
|
||||||
|
|
||||||
|
|
||||||
configureReverb();
|
configureReverb();
|
||||||
|
|
||||||
|
@ -262,6 +267,7 @@ void AudioClient::cleanupBeforeQuit() {
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
_checkDevicesTimer->stop();
|
_checkDevicesTimer->stop();
|
||||||
|
_checkPeakValuesTimer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioClient::handleMismatchAudioFormat(SharedNodePointer node, const QString& currentCodec, const QString& recievedCodec) {
|
void AudioClient::handleMismatchAudioFormat(SharedNodePointer node, const QString& currentCodec, const QString& recievedCodec) {
|
||||||
|
|
|
@ -148,6 +148,8 @@ public:
|
||||||
QAudioDeviceInfo getActiveAudioDevice(QAudio::Mode mode) const;
|
QAudioDeviceInfo getActiveAudioDevice(QAudio::Mode mode) const;
|
||||||
QList<QAudioDeviceInfo> getAudioDevices(QAudio::Mode mode) const;
|
QList<QAudioDeviceInfo> getAudioDevices(QAudio::Mode mode) const;
|
||||||
|
|
||||||
|
void enablePeakValues(bool enable) { _enablePeakValues = enable; }
|
||||||
|
|
||||||
static const float CALLBACK_ACCELERATOR_RATIO;
|
static const float CALLBACK_ACCELERATOR_RATIO;
|
||||||
|
|
||||||
bool getNamedAudioDeviceForModeExists(QAudio::Mode mode, const QString& deviceName);
|
bool getNamedAudioDeviceForModeExists(QAudio::Mode mode, const QString& deviceName);
|
||||||
|
@ -220,6 +222,7 @@ signals:
|
||||||
|
|
||||||
void deviceChanged(QAudio::Mode mode, const QAudioDeviceInfo& device);
|
void deviceChanged(QAudio::Mode mode, const QAudioDeviceInfo& device);
|
||||||
void devicesChanged(QAudio::Mode mode, const QList<QAudioDeviceInfo>& devices);
|
void devicesChanged(QAudio::Mode mode, const QList<QAudioDeviceInfo>& devices);
|
||||||
|
void peakValueListChanged(const QList<float> peakValueList);
|
||||||
|
|
||||||
void receivedFirstPacket();
|
void receivedFirstPacket();
|
||||||
void disconnected();
|
void disconnected();
|
||||||
|
@ -238,9 +241,12 @@ private:
|
||||||
friend class CheckDevicesThread;
|
friend class CheckDevicesThread;
|
||||||
friend class LocalInjectorsThread;
|
friend class LocalInjectorsThread;
|
||||||
|
|
||||||
|
// background tasks
|
||||||
|
void checkDevices();
|
||||||
|
void checkPeakValues();
|
||||||
|
|
||||||
void outputFormatChanged();
|
void outputFormatChanged();
|
||||||
void handleAudioInput(QByteArray& audioBuffer);
|
void handleAudioInput(QByteArray& audioBuffer);
|
||||||
void checkDevices();
|
|
||||||
void prepareLocalAudioInjectors(std::unique_ptr<Lock> localAudioLock = nullptr);
|
void prepareLocalAudioInjectors(std::unique_ptr<Lock> localAudioLock = nullptr);
|
||||||
bool mixLocalAudioInjectors(float* mixBuffer);
|
bool mixLocalAudioInjectors(float* mixBuffer);
|
||||||
float azimuthForSource(const glm::vec3& relativePosition);
|
float azimuthForSource(const glm::vec3& relativePosition);
|
||||||
|
@ -293,6 +299,7 @@ private:
|
||||||
std::atomic<bool> _localInjectorsAvailable { false };
|
std::atomic<bool> _localInjectorsAvailable { false };
|
||||||
MixedProcessedAudioStream _receivedAudioStream;
|
MixedProcessedAudioStream _receivedAudioStream;
|
||||||
bool _isStereoInput;
|
bool _isStereoInput;
|
||||||
|
std::atomic<bool> _enablePeakValues { false };
|
||||||
|
|
||||||
quint64 _outputStarveDetectionStartTimeMsec;
|
quint64 _outputStarveDetectionStartTimeMsec;
|
||||||
int _outputStarveDetectionCount;
|
int _outputStarveDetectionCount;
|
||||||
|
@ -391,6 +398,7 @@ private:
|
||||||
RateCounter<> _audioInbound;
|
RateCounter<> _audioInbound;
|
||||||
|
|
||||||
QTimer* _checkDevicesTimer { nullptr };
|
QTimer* _checkDevicesTimer { nullptr };
|
||||||
|
QTimer* _checkPeakValuesTimer { nullptr };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
16
libraries/audio-client/src/AudioPeakValues.cpp
Normal file
16
libraries/audio-client/src/AudioPeakValues.cpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
//
|
||||||
|
// AudioPeakValues.cpp
|
||||||
|
// interface/src
|
||||||
|
//
|
||||||
|
// Created by Zach Pomerantz on 6/26/2017
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "AudioClient.h"
|
||||||
|
|
||||||
|
void AudioClient::checkPeakValues() {
|
||||||
|
// TODO
|
||||||
|
}
|
Loading…
Reference in a new issue