mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +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/audio/audiodeviceinfolist.h"
|
||||||
#include "blackmisc/threadutils.h"
|
#include "blackmisc/threadutils.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef Q_OS_WIN
|
||||||
#include "comdef.h"
|
#include "comdef.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -493,11 +493,14 @@ namespace BlackCore
|
|||||||
|
|
||||||
QMutexLocker lock(&m_mutex);
|
QMutexLocker lock(&m_mutex);
|
||||||
bool changed = !qFuzzyCompare(m_inputVolumeDb, valueDb);
|
bool changed = !qFuzzyCompare(m_inputVolumeDb, valueDb);
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
m_inputVolumeDb = valueDb;
|
m_inputVolumeDb = valueDb;
|
||||||
if (m_input)
|
if (m_input)
|
||||||
{
|
{
|
||||||
changed = m_input->setVolume(qPow(10, valueDb / 20.0));
|
changed = m_input->setVolume(qPow(10, valueDb / 20.0));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,7 +693,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAfvClient::initialize()
|
void CAfvClient::initialize()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef Q_OS_WIN
|
||||||
if (!m_winCoInitialized)
|
if (!m_winCoInitialized)
|
||||||
{
|
{
|
||||||
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||||
@@ -712,7 +715,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAfvClient::cleanup()
|
void CAfvClient::cleanup()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef Q_OS_WIN
|
||||||
if (m_winCoInitialized)
|
if (m_winCoInitialized)
|
||||||
{
|
{
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
@@ -882,6 +885,8 @@ namespace BlackCore
|
|||||||
|
|
||||||
QMutexLocker lock(&m_mutex);
|
QMutexLocker lock(&m_mutex);
|
||||||
bool changed = !qFuzzyCompare(m_outputVolumeDb, valueDb);
|
bool changed = !qFuzzyCompare(m_outputVolumeDb, valueDb);
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
m_outputVolumeDb = valueDb;
|
m_outputVolumeDb = valueDb;
|
||||||
m_outputVolume = qPow(10, m_outputVolumeDb / 20.0);
|
m_outputVolume = qPow(10, m_outputVolumeDb / 20.0);
|
||||||
|
|
||||||
@@ -889,6 +894,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
changed = m_outputSampleProvider->setVolume(m_outputVolume);
|
changed = m_outputSampleProvider->setVolume(m_outputVolume);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
static constexpr int PositionUpdatesMs = 5000; //!< position timer
|
static constexpr int PositionUpdatesMs = 5000; //!< position timer
|
||||||
static constexpr int SampleRate = 48000;
|
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 MinDbIn = -18.0;
|
||||||
static constexpr double MaxDbIn = 18.0;
|
static constexpr double MaxDbIn = 18.0;
|
||||||
static constexpr double MinDbOut = -60.0;
|
static constexpr double MinDbOut = -60.0;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace BlackSound
|
|||||||
bool CVolumeSampleProvider::setVolume(double volume)
|
bool CVolumeSampleProvider::setVolume(double volume)
|
||||||
{
|
{
|
||||||
const bool changed = !qFuzzyCompare(m_volume, volume);
|
const bool changed = !qFuzzyCompare(m_volume, volume);
|
||||||
m_volume = volume;
|
if (changed) { m_volume = volume; }
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include "test.h"
|
#include "test.h"
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef Q_OS_WIN
|
||||||
#include "comdef.h"
|
#include "comdef.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user