···
void UpdateStaticVolume(float signalStrength);
107
+
void UpdateStreamVolume();
···
if (g_radio.signalStrength > 100) g_radio.signalStrength = 100;
UpdateStaticVolume(g_radio.signalStrength);
308
+
UpdateStreamVolume();
InvalidateRect(hwnd, NULL, TRUE);
···
if (g_radio.signalStrength > 100) g_radio.signalStrength = 100;
UpdateStaticVolume(g_radio.signalStrength);
335
+
UpdateStreamVolume();
InvalidateRect(hwnd, NULL, TRUE);
···
if (g_radio.signalStrength > 100) g_radio.signalStrength = 100;
UpdateStaticVolume(g_radio.signalStrength);
362
+
UpdateStreamVolume();
InvalidateRect(hwnd, NULL, TRUE);
···
if (g_radio.signalStrength > 100) g_radio.signalStrength = 100;
UpdateStaticVolume(g_radio.signalStrength);
389
+
UpdateStreamVolume();
InvalidateRect(hwnd, NULL, TRUE);
···
if (g_radio.signalStrength > 100) g_radio.signalStrength = 100;
UpdateStaticVolume(g_radio.signalStrength);
1060
+
UpdateStreamVolume();
void UpdateVolumeFromMouse(int mouseX, int mouseY) {
···
if (g_radio.volume < 0.0f) g_radio.volume = 0.0f;
if (g_radio.volume > 1.0f) g_radio.volume = 1.0f;
1070
-
// Update static volume when main volume changes
1076
+
// Update volumes when main volume changes
UpdateStaticVolume(g_radio.signalStrength);
1078
+
UpdateStreamVolume();
···
1332
+
void UpdateStreamVolume() {
1333
+
if (g_audio.currentStream) {
1334
+
// Stream volume based on signal strength and radio volume
1335
+
float volume = g_radio.volume * (g_radio.signalStrength / 100.0f);
1336
+
BASS_ChannelSetAttribute(g_audio.currentStream, BASS_ATTRIB_VOL, volume);
1337
+
if (g_consoleVisible) {
1338
+
printf("Updated stream volume to: %.2f\n", volume);
// Initialize levels to zero
g_audio.vuLevelLeft = 0.0f;
···
if (g_audio.currentStream && BASS_ChannelIsActive(g_audio.currentStream) == BASS_ACTIVE_PLAYING) {
DWORD level = BASS_ChannelGetLevel(g_audio.currentStream);
1334
-
// Extract left and right channel levels
1335
-
g_audio.vuLevelLeft = (float)LOWORD(level) / 32768.0f;
1336
-
g_audio.vuLevelRight = (float)HIWORD(level) / 32768.0f;
1352
+
// Extract left and right channel levels and apply volume scaling
1353
+
float rawLeft = (float)LOWORD(level) / 32768.0f;
1354
+
float rawRight = (float)HIWORD(level) / 32768.0f;
1356
+
// Apply the same volume scaling as the actual audio output
1357
+
float streamVolume = g_radio.volume * (g_radio.signalStrength / 100.0f);
1358
+
g_audio.vuLevelLeft = rawLeft * streamVolume;
1359
+
g_audio.vuLevelRight = rawRight * streamVolume;
···
float staticLeft = (float)LOWORD(staticLevel) / 32768.0f;
float staticRight = (float)HIWORD(staticLevel) / 32768.0f;
1370
+
// Apply static volume scaling
1371
+
float staticVolume = (100.0f - g_radio.signalStrength) / 100.0f;
1372
+
float scaledStaticVolume = g_radio.volume * staticVolume * g_audio.staticVolume;
1374
+
// Ensure minimum static when radio is on but no strong signal
1375
+
if (g_radio.power && g_radio.signalStrength < 50.0f) {
1376
+
scaledStaticVolume = fmax(scaledStaticVolume, g_radio.volume * 0.1f);
// Combine with existing levels (simulate mixing)
1348
-
g_audio.vuLevelLeft = fmin(1.0f, g_audio.vuLevelLeft + staticLeft * 0.3f);
1349
-
g_audio.vuLevelRight = fmin(1.0f, g_audio.vuLevelRight + staticRight * 0.3f);
1380
+
g_audio.vuLevelLeft = fmin(1.0f, g_audio.vuLevelLeft + staticLeft * scaledStaticVolume * 0.3f);
1381
+
g_audio.vuLevelRight = fmin(1.0f, g_audio.vuLevelRight + staticRight * scaledStaticVolume * 0.3f);