udpate uac_vol

This commit is contained in:
Steven Dan
2026-01-13 14:01:56 +08:00
parent e07a05b748
commit 6252431771
3 changed files with 48 additions and 11 deletions

View File

@@ -15,6 +15,8 @@
#include "dbcalc.h"
#include "xua_commands.h"
#include "xc_ptr.h"
#define CS_XU_MIXSEL (0x06)
/* From decouple.xc */
@@ -48,6 +50,8 @@ extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS];
/* Global var for current frequency, set to default freq */
unsigned int g_curSamFreq = DEFAULT_FREQ;
int g_uac_vol = 0;
#if 0
unsigned int g_curSamFreq48000Family = DEFAULT_FREQ % 48000 == 0;
@@ -126,7 +130,7 @@ static void updateMasterVol(int unitID, chanend ?c_mix_ctl)
case FU_USBOUT:
{
unsigned master_vol = volsOut[0] == 0x8000 ? 0 : db_to_mult(volsOut[0], 8, 29);
SET_SHARED_GLOBAL(g_uac_vol, volsOut[0]);
for (int i = 1; i < (NUM_USB_CHAN_OUT + 1); i++)
{
/* Calc multipliers with 29 fractional bits from a db value with 8 fractional bits */
@@ -213,7 +217,8 @@ static void updateVol(int unitID, int channel, chanend ?c_mix_ctl)
unsigned vol = volsOut[channel] == 0x8000 ? 0 : db_to_mult(volsOut[channel], 8, 29);
x = longMul(master_vol, vol, 29) * !mutesOut[0] * !mutesOut[channel];
if (channel == 1)
SET_SHARED_GLOBAL(g_uac_vol, volsOut[channel]); // only update the front left channel
#if (OUT_VOLUME_IN_MIXER)
if (!isnull(c_mix_ctl))
{