mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
[AFV] Ref T730, improved volume handling
* for the asymmetric output volume -60/18dB, make sure that normalized 50 means 0dB * slider is centered * return value if value for volume was changed
This commit is contained in:
@@ -94,6 +94,13 @@ namespace BlackCore
|
||||
m_encoder.setBitRate(16 * 1024);
|
||||
}
|
||||
|
||||
bool CInput::setVolume(double volume)
|
||||
{
|
||||
if (qFuzzyCompare(m_volume, volume)) { return false; }
|
||||
m_volume = volume;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CInput::start(const CAudioDeviceInfo &inputDevice)
|
||||
{
|
||||
if (m_started) { return; }
|
||||
|
||||
@@ -95,11 +95,15 @@ namespace BlackCore
|
||||
this->stop();
|
||||
}
|
||||
|
||||
//! Number of encoded bytes @{
|
||||
int opusBytesEncoded() const { return m_opusBytesEncoded; }
|
||||
void setOpusBytesEncoded(int opusBytesEncoded) { m_opusBytesEncoded = opusBytesEncoded; }
|
||||
//! @}
|
||||
|
||||
//! Volume @{
|
||||
double volume() const { return m_volume; }
|
||||
void setVolume(double volume) { m_volume = volume; }
|
||||
bool setVolume(double volume);
|
||||
//! @}
|
||||
|
||||
//! Started?
|
||||
bool started() const { return m_started; }
|
||||
@@ -132,9 +136,9 @@ namespace BlackCore
|
||||
QAudioFormat m_inputFormat;
|
||||
|
||||
bool m_started = false;
|
||||
int m_opusBytesEncoded = 0;
|
||||
int m_sampleCount = 0;
|
||||
double m_volume = 1.0;
|
||||
int m_opusBytesEncoded = 0;
|
||||
int m_sampleCount = 0;
|
||||
double m_volume = 1.0;
|
||||
qint16 m_maxSampleInput = 0.0;
|
||||
|
||||
const int SampleCountPerEvent = 4800;
|
||||
@@ -142,7 +146,6 @@ namespace BlackCore
|
||||
const double minDb = -40;
|
||||
|
||||
uint m_audioSequenceCounter = 0;
|
||||
|
||||
CAudioInputBuffer m_audioInputBuffer;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
||||
Reference in New Issue
Block a user