mirror of
https://github.com/badaix/snapcast.git
synced 2025-07-31 07:09:44 +02:00
logarithmic volume scaling
This commit is contained in:
parent
80ea2a37a3
commit
0f90f05e9d
1 changed files with 6 additions and 1 deletions
|
@ -17,8 +17,11 @@
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
#include "common/log.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -61,7 +64,9 @@ void Player::stop()
|
||||||
|
|
||||||
void Player::setVolume(double volume)
|
void Player::setVolume(double volume)
|
||||||
{
|
{
|
||||||
volume_ = volume;
|
double base = 10.;
|
||||||
|
volume_ = (pow(base, volume)-1) / (base-1);
|
||||||
|
logD << "setVolume: " << volume << " => " << volume_ << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue