mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
[AFV] Ref T730 incorporated MS fixes
see https://discordapp.com/channels/539048679160676382/623947987822837779/633025547999510530
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#include "blackmisc/audio/audiodeviceinfolist.h"
|
||||
#include "blackmisc/threadutils.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef Q_OS_WIN
|
||||
#include "comdef.h"
|
||||
#endif
|
||||
|
||||
@@ -493,10 +493,13 @@ namespace BlackCore
|
||||
|
||||
QMutexLocker lock(&m_mutex);
|
||||
bool changed = !qFuzzyCompare(m_inputVolumeDb, valueDb);
|
||||
m_inputVolumeDb = valueDb;
|
||||
if (m_input)
|
||||
if (changed)
|
||||
{
|
||||
changed = m_input->setVolume(qPow(10, valueDb / 20.0));
|
||||
m_inputVolumeDb = valueDb;
|
||||
if (m_input)
|
||||
{
|
||||
changed = m_input->setVolume(qPow(10, valueDb / 20.0));
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
@@ -690,7 +693,7 @@ namespace BlackCore
|
||||
|
||||
void CAfvClient::initialize()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifdef Q_OS_WIN
|
||||
if (!m_winCoInitialized)
|
||||
{
|
||||
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
@@ -712,7 +715,7 @@ namespace BlackCore
|
||||
|
||||
void CAfvClient::cleanup()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifdef Q_OS_WIN
|
||||
if (m_winCoInitialized)
|
||||
{
|
||||
CoUninitialize();
|
||||
@@ -882,12 +885,15 @@ namespace BlackCore
|
||||
|
||||
QMutexLocker lock(&m_mutex);
|
||||
bool changed = !qFuzzyCompare(m_outputVolumeDb, valueDb);
|
||||
m_outputVolumeDb = valueDb;
|
||||
m_outputVolume = qPow(10, m_outputVolumeDb / 20.0);
|
||||
|
||||
if (m_outputSampleProvider)
|
||||
if (changed)
|
||||
{
|
||||
changed = m_outputSampleProvider->setVolume(m_outputVolume);
|
||||
m_outputVolumeDb = valueDb;
|
||||
m_outputVolume = qPow(10, m_outputVolumeDb / 20.0);
|
||||
|
||||
if (m_outputSampleProvider)
|
||||
{
|
||||
changed = m_outputSampleProvider->setVolume(m_outputVolume);
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace BlackCore
|
||||
|
||||
static constexpr int PositionUpdatesMs = 5000; //!< position timer
|
||||
static constexpr int SampleRate = 48000;
|
||||
static constexpr int FrameSize = 960; //!< 20ms
|
||||
static constexpr int FrameSize = static_cast<int>(SampleRate * 0.02); //!< 20ms
|
||||
static constexpr double MinDbIn = -18.0;
|
||||
static constexpr double MaxDbIn = 18.0;
|
||||
static constexpr double MinDbOut = -60.0;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace BlackSound
|
||||
bool CVolumeSampleProvider::setVolume(double volume)
|
||||
{
|
||||
const bool changed = !qFuzzyCompare(m_volume, volume);
|
||||
m_volume = volume;
|
||||
if (changed) { m_volume = volume; }
|
||||
return changed;
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "test.h"
|
||||
#include <QTest>
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef Q_OS_WIN
|
||||
#include "comdef.h"
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user