aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Screens
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/Screens
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/Screens')
-rw-r--r--Game/Code/Screens/UScreenCredits.pas2
-rw-r--r--Game/Code/Screens/UScreenEditSub.pas4
-rw-r--r--Game/Code/Screens/UScreenOptionsRecord.pas20
-rw-r--r--Game/Code/Screens/UScreenSong.pas25
4 files changed, 30 insertions, 21 deletions
diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas
index ce3b6046..f7f1fca7 100644
--- a/Game/Code/Screens/UScreenCredits.pas
+++ b/Game/Code/Screens/UScreenCredits.pas
@@ -1309,7 +1309,7 @@ Log.LogStatus('',' JB-4');
CTime_hold:=0;
AudioPlayback.Stop;
AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3');
- AudioPlayback.SetVolume(20);
+ AudioPlayback.SetVolume(0.2);
AudioPlayback.SetLoop(True);
AudioPlayback.Play;
end;
diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas
index 0a80af8b..3bf57692 100644
--- a/Game/Code/Screens/UScreenEditSub.pas
+++ b/Game/Code/Screens/UScreenEditSub.pas
@@ -1174,7 +1174,7 @@ begin
Lines[0].Line[0].Note[0].Color := 1;
AudioPlayback.Open(CurrentSong.Path + CurrentSong.Mp3);
//Set Down Music Volume for Better hearability of Midi Sounds
- //Music.SetVolume(40);
+ //Music.SetVolume(0.4);
Lyric.Clear;
Lyric.X := 400;
@@ -1315,7 +1315,7 @@ begin
MidiOut.Close;
MidiOut.Free;
{$ENDIF}
- //Music.SetVolume(100);
+ //Music.SetVolume(1.0);
end;
function TScreenEditSub.GetNoteName(Note: Integer): String;
diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas
index 8e3d0f67..8db5ede9 100644
--- a/Game/Code/Screens/UScreenOptionsRecord.pas
+++ b/Game/Code/Screens/UScreenOptionsRecord.pas
@@ -64,7 +64,7 @@ type
procedure StartPreview;
procedure StopPreview;
procedure UpdateInputDevice;
- procedure ChangeVolume(VolumeChange: integer);
+ procedure ChangeVolume(VolumeChange: single);
procedure DrawVolume(x, y, Width, Height: single);
procedure DrawVUMeter(const State: TDrawState; x, y, Width, Height: single);
procedure DrawPitch(const State: TDrawState; x, y, Width, Height: single);
@@ -119,13 +119,13 @@ begin
begin
// FIXME: add a nice volume-slider instead
// or at least provide visualization and acceleration if the user holds the key pressed.
- ChangeVolume(2);
+ ChangeVolume(0.02);
end;
'-':
begin
// FIXME: add a nice volume-slider instead
// or at least provide visualization and acceleration if the user holds the key pressed.
- ChangeVolume(-2);
+ ChangeVolume(-0.02);
end;
'T':
begin
@@ -203,6 +203,8 @@ begin
PreviewDeviceIndex := -1;
+ WidgetYPos := 0;
+
// init sliders if at least one device was detected
if (Length(AudioInputProcessor.DeviceList) > 0) then
begin
@@ -292,7 +294,9 @@ begin
// add Exit-button
ButtonTheme := Theme.OptionsRecord.ButtonExit;
- ButtonTheme.Y := WidgetYPos;
+ // adjust button position
+ if (WidgetYPos <> 0) then
+ ButtonTheme.Y := WidgetYPos;
AddButton(ButtonTheme);
if (Length(Button[0].Text) = 0) then
AddButtonText(14, 20, Theme.Options.Description[7]);
@@ -372,10 +376,10 @@ begin
StartPreview();
end;
-procedure TScreenOptionsRecord.ChangeVolume(VolumeChange: integer);
+procedure TScreenOptionsRecord.ChangeVolume(VolumeChange: single);
var
InputDevice: TAudioInputDevice;
- Volume: integer;
+ Volume: single;
begin
// validate CurrentDeviceIndex
if ((CurrentDeviceIndex < 0) or
@@ -391,7 +395,7 @@ begin
// set new volume
Volume := InputDevice.GetVolume() + VolumeChange;
InputDevice.SetVolume(Volume);
- //DebugWriteln('Volume: ' + inttostr(InputDevice.GetVolume));
+ //DebugWriteln('Volume: ' + floattostr(InputDevice.GetVolume));
// volume must be polled again
NextVolumePollTime := 0;
@@ -700,7 +704,7 @@ begin
if (SDL_GetTicks() >= NextVolumePollTime) then
begin
NextVolumePollTime := SDL_GetTicks() + 500; // next poll in 500ms
- SourceVolume := Device.GetVolume()/100;
+ SourceVolume := Device.GetVolume();
end;
// get source select slide
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index 82d5100a..06314bcd 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -1497,17 +1497,21 @@ end;
procedure TScreenSong.onHide;
begin
- //When Music Fading is activated, Turn Music to 100 %
- If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then
- AudioPlayback.SetVolume(100);
+ // if music fading is activated, turn music to 100%
+ If (IPreviewVolumeVals[Ini.PreviewVolume] <> 1.0) or (Ini.PreviewFading <> 0) then
+ AudioPlayback.SetVolume(1.0);
- //If Preview is deactivated: Load MUsicfile now
- If (Ini.PreviewVolume = 0) then
+ // if preview is deactivated: load musicfile now
+ If (IPreviewVolumeVals[Ini.PreviewVolume] = 0) then
AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3);
- //When hide then Stop Music (For Party Mode Popup on Exit)
- if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (AudioPlayback <> nil) then
- AudioPlayback.Stop;
+ // if hide then stop music (for party mode popup on exit)
+ if (Display.NextScreen <> @ScreenSing) and
+ (Display.NextScreen <> @ScreenSingModi) then
+ begin
+ if (AudioPlayback <> nil) then
+ AudioPlayback.Stop;
+ end;
end;
procedure TScreenSong.DrawExtensions;
@@ -1613,6 +1617,7 @@ begin
DrawExtensions;
+ Result := true;
end;
procedure TScreenSong.SelectNext;
@@ -1701,14 +1706,14 @@ begin
if (Ini.PreviewFading = 0) then
begin
// music fade disabled: start with full volume
- AudioPlayback.SetVolume(Ini.PreviewVolume * 10);
+ AudioPlayback.SetVolume(IPreviewVolumeVals[Ini.PreviewVolume]);
AudioPlayback.Play()
end
else
begin
// music fade enabled: start muted and fade-in
AudioPlayback.SetVolume(0);
- AudioPlayback.FadeIn(Ini.PreviewFading, Ini.PreviewVolume * 10);
+ AudioPlayback.FadeIn(Ini.PreviewFading, IPreviewVolumeVals[Ini.PreviewVolume]);
end;
end;
end;