Skip to content

Commit

Permalink
Fixed: Spatial sound is either too loud or to quiet due to not needed…
Browse files Browse the repository at this point in the history
… conversion from exponential scale to linear
  • Loading branch information
b-kurczynski committed Jul 21, 2024
1 parent f19fec2 commit f16ea30
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/harness/audio/miniaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,12 @@ tAudioBackend_error_code AudioBackend_SetVolume(void* type_struct_sample, int vo
miniaudio = (tMiniaudio_sample*)type_struct_sample;
assert(miniaudio != NULL);

// convert from directsound -10000 - 0 decibel volume scale
linear_volume = ma_volume_db_to_linear(volume_db / 100.0f);
// convert from Carmageddon "decibel" scale to linear <0.0f..1.0f>
linear_volume = (volume_db + 350.0f) / -5.0f;
if (linear_volume == 0.0f) {
linear_volume = 1.0f;
}
linear_volume = 1.0f / linear_volume;
ma_sound_set_volume(&miniaudio->sound, linear_volume);
return eAB_success;
}
Expand Down

0 comments on commit f16ea30

Please sign in to comment.