aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UAudioPlayback_SDL.pas
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-05-10 12:28:56 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-05-10 12:28:56 +0000
commitc6da424a1508eae4538244b4d00ddf1f0436b1b7 (patch)
tree18a125cc8a590c0916811e47c912134278e92bb7 /Game/Code/Classes/UAudioPlayback_SDL.pas
parent8af89b5940bd15b013e3f48536888e352eb1c43b (diff)
downloadusdx-c6da424a1508eae4538244b4d00ddf1f0436b1b7.tar.gz
usdx-c6da424a1508eae4538244b4d00ddf1f0436b1b7.tar.xz
usdx-c6da424a1508eae4538244b4d00ddf1f0436b1b7.zip
Volumes are floating point values (single) now. The range changed from [0 .. 100] to [0.0 .. 1.0]
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1081 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/UAudioPlayback_SDL.pas')
-rw-r--r--Game/Code/Classes/UAudioPlayback_SDL.pas8
1 files changed, 3 insertions, 5 deletions
diff --git a/Game/Code/Classes/UAudioPlayback_SDL.pas b/Game/Code/Classes/UAudioPlayback_SDL.pas
index ed5a208b..39ecc72f 100644
--- a/Game/Code/Classes/UAudioPlayback_SDL.pas
+++ b/Game/Code/Classes/UAudioPlayback_SDL.pas
@@ -34,7 +34,7 @@ type
function FinalizeAudioPlaybackEngine(): boolean; override;
public
function GetName: String; override;
- procedure MixBuffers(dst, src: PChar; size: Cardinal; volume: Integer); override;
+ procedure MixBuffers(dst, src: PChar; size: Cardinal; volume: Single); override;
end;
var
@@ -134,11 +134,9 @@ begin
Result := true;
end;
-procedure TAudioPlayback_SDL.MixBuffers(dst, src: PChar; size: Cardinal; volume: Integer);
+procedure TAudioPlayback_SDL.MixBuffers(dst, src: PChar; size: Cardinal; volume: Single);
begin
- // Note: (volume * SDL_MIX_MAXVOLUME) may exceed High(Integer)
- // if SDL_MIX_MAXVOLUME (=128 at the moment) changes
- SDL_MixAudio(PUInt8(dst), PUInt8(src), size, volume * SDL_MIX_MAXVOLUME div 100);
+ SDL_MixAudio(PUInt8(dst), PUInt8(src), size, Round(volume * SDL_MIX_MAXVOLUME));
end;