···
void UpdateStaticVolume(float signalStrength);
+
void UpdateStreamVolume();
···
if (g_radio.signalStrength > 100) g_radio.signalStrength = 100;
UpdateStaticVolume(g_radio.signalStrength);
InvalidateRect(hwnd, NULL, TRUE);
···
if (g_radio.signalStrength > 100) g_radio.signalStrength = 100;
UpdateStaticVolume(g_radio.signalStrength);
InvalidateRect(hwnd, NULL, TRUE);
···
if (g_radio.signalStrength > 100) g_radio.signalStrength = 100;
UpdateStaticVolume(g_radio.signalStrength);
InvalidateRect(hwnd, NULL, TRUE);
···
if (g_radio.signalStrength > 100) g_radio.signalStrength = 100;
UpdateStaticVolume(g_radio.signalStrength);
InvalidateRect(hwnd, NULL, TRUE);
···
if (g_radio.signalStrength > 100) g_radio.signalStrength = 100;
UpdateStaticVolume(g_radio.signalStrength);
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;
+
// Update volumes when main volume changes
UpdateStaticVolume(g_radio.signalStrength);
···
+
void UpdateStreamVolume() {
+
if (g_audio.currentStream) {
+
// Stream volume based on signal strength and radio volume
+
float volume = g_radio.volume * (g_radio.signalStrength / 100.0f);
+
BASS_ChannelSetAttribute(g_audio.currentStream, BASS_ATTRIB_VOL, volume);
+
if (g_consoleVisible) {
+
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);
+
// Extract left and right channel levels and apply volume scaling
+
float rawLeft = (float)LOWORD(level) / 32768.0f;
+
float rawRight = (float)HIWORD(level) / 32768.0f;
+
// Apply the same volume scaling as the actual audio output
+
float streamVolume = g_radio.volume * (g_radio.signalStrength / 100.0f);
+
g_audio.vuLevelLeft = rawLeft * streamVolume;
+
g_audio.vuLevelRight = rawRight * streamVolume;
···
float staticLeft = (float)LOWORD(staticLevel) / 32768.0f;
float staticRight = (float)HIWORD(staticLevel) / 32768.0f;
+
// Apply static volume scaling
+
float staticVolume = (100.0f - g_radio.signalStrength) / 100.0f;
+
float scaledStaticVolume = g_radio.volume * staticVolume * g_audio.staticVolume;
+
// Ensure minimum static when radio is on but no strong signal
+
if (g_radio.power && g_radio.signalStrength < 50.0f) {
+
scaledStaticVolume = fmax(scaledStaticVolume, g_radio.volume * 0.1f);
// Combine with existing levels (simulate mixing)
+
g_audio.vuLevelLeft = fmin(1.0f, g_audio.vuLevelLeft + staticLeft * scaledStaticVolume * 0.3f);
+
g_audio.vuLevelRight = fmin(1.0f, g_audio.vuLevelRight + staticRight * scaledStaticVolume * 0.3f);