Skip to content

Commit

Permalink
PlatformPlayer: Improve Wav media volume steps
Browse files Browse the repository at this point in the history
Based on Asphalt 2: Urban GT. There, wav media played at a much
lower volume than midi streams unless the volume was maxed out.
So instead of going from -80dB to 0dB, go from -20dB to 0dB instead,
as this makes their volumes match much better across all volume
levels.
  • Loading branch information
AShiningRay committed Nov 18, 2024
1 parent 4aa4e70 commit e5dc2ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/org/recompile/mobile/PlatformPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -943,8 +943,8 @@ else if(player instanceof wavPlayer) /* Haven't found a jar that actually makes
{
wavPlayer wav = (wavPlayer) player;

/* We have to map 0 <= value <= 100 to a clip's range of -80dB to 0dB */
float dB = isMuted() ? 0 : -80.0f + ((this.level / 100.0f) * (80.0f));
/* We have to map 0 <= value <= 100 to a clip's range of -20dB to 0dB */
float dB = isMuted() ? -80.0f : -20.0f + ((this.level / 100.0f) * (20.0f));

FloatControl volumeControl = (FloatControl) wav.wavClip.getControl(FloatControl.Type.MASTER_GAIN);
volumeControl.setValue(dB);
Expand Down

0 comments on commit e5dc2ef

Please sign in to comment.