mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-10 13:37:03 +03:00
Apply volume correction factor for Bluetooth sink.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "squeezelite.h"
|
||||
#include "bt_app_sink.h"
|
||||
#include "raop_sink.h"
|
||||
#include <math.h>
|
||||
|
||||
#define LOCK_O mutex_lock(outputbuf->mutex)
|
||||
#define UNLOCK_O mutex_unlock(outputbuf->mutex)
|
||||
@@ -90,6 +91,8 @@ static void sink_data_handler(const uint8_t *data, uint32_t len)
|
||||
/****************************************************************************************
|
||||
* BT sink command handler
|
||||
*/
|
||||
|
||||
extern u16_t get_adjusted_volume(u16_t volume);
|
||||
static void bt_sink_cmd_handler(bt_sink_cmd_t cmd, ...)
|
||||
{
|
||||
va_list args;
|
||||
@@ -133,7 +136,7 @@ static void bt_sink_cmd_handler(bt_sink_cmd_t cmd, ...)
|
||||
break;
|
||||
case BT_SINK_VOLUME: {
|
||||
u16_t volume = (u16_t) va_arg(args, u32_t);
|
||||
volume *= 65536 / 128;
|
||||
volume = get_adjusted_volume(volume);
|
||||
set_volume(volume, volume);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ $(document).ready(function(){
|
||||
console.log(xhr.status);
|
||||
console.log(thrownError);
|
||||
if (thrownError != '') showMessage(thrownError, 'ERROR');
|
||||
}
|
||||
},
|
||||
complete: function(response) {
|
||||
var returnedResponse = JSON.parse(response.responseText);
|
||||
console.log(response.responseText);
|
||||
@@ -210,7 +210,7 @@ $(document).ready(function(){
|
||||
console.log(xhr.status);
|
||||
console.log(thrownError);
|
||||
if (thrownError != '') showMessage(thrownError, 'ERROR');
|
||||
}
|
||||
},
|
||||
complete: function(response) {
|
||||
console.log('reboot call completed');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user