Skip to content

Commit f16ea30

Browse files
committed
Fixed: Spatial sound is either too loud or to quiet due to not needed conversion from exponential scale to linear
1 parent f19fec2 commit f16ea30

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/harness/audio/miniaudio.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,12 @@ tAudioBackend_error_code AudioBackend_SetVolume(void* type_struct_sample, int vo
182182
miniaudio = (tMiniaudio_sample*)type_struct_sample;
183183
assert(miniaudio != NULL);
184184

185-
// convert from directsound -10000 - 0 decibel volume scale
186-
linear_volume = ma_volume_db_to_linear(volume_db / 100.0f);
185+
// convert from Carmageddon "decibel" scale to linear <0.0f..1.0f>
186+
linear_volume = (volume_db + 350.0f) / -5.0f;
187+
if (linear_volume == 0.0f) {
188+
linear_volume = 1.0f;
189+
}
190+
linear_volume = 1.0f / linear_volume;
187191
ma_sound_set_volume(&miniaudio->sound, linear_volume);
188192
return eAB_success;
189193
}

0 commit comments

Comments
 (0)