aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-02-21 17:02:16 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-02-21 17:02:16 +0000
commit69b1910acc77c177dba95d7375a668c07648093a (patch)
treedf9c33e3fd671a4ceb5b0c62d377d1b368a9dabc
parent41e73f40aafbe9bf873f8fbdf46e092e58065341 (diff)
downloadusdx-69b1910acc77c177dba95d7375a668c07648093a.tar.gz
usdx-69b1910acc77c177dba95d7375a668c07648093a.tar.xz
usdx-69b1910acc77c177dba95d7375a668c07648093a.zip
added mp3 volume adjustment in songscreen and singscreen
fixed bug in singscreen (tab and pause) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2136 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--Game/Code/Screens/UScreenEditSub.pas4
-rw-r--r--Game/Code/Screens/UScreenScore.pas4
-rw-r--r--Game/Code/Screens/UScreenSing.pas93
-rw-r--r--Game/Code/Screens/UScreenSingModi.pas8
-rw-r--r--Game/Code/Screens/UScreenSong.pas109
-rw-r--r--Game/Code/Screens/UScreenSongMenu.pas24
-rw-r--r--Game/Output/Languages/German.ini4
7 files changed, 235 insertions, 11 deletions
diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas
index 3b132810..d3e46045 100644
--- a/Game/Code/Screens/UScreenEditSub.pas
+++ b/Game/Code/Screens/UScreenEditSub.pas
@@ -890,7 +890,7 @@ begin
begin
if (MP3Volume<100) then
MP3Volume := MP3Volume+5;
- Music.SetVolume(MP3Volume);
+ Music.SetMusicVolume(MP3Volume);
Text[TextDebug].Text := 'MP3 Volume: ' + IntToStr(MP3Volume) + '%';
end;
@@ -899,7 +899,7 @@ begin
begin
if (MP3Volume>0) then
MP3Volume := MP3Volume-5;
- Music.SetVolume(MP3Volume);
+ Music.SetMusicVolume(MP3Volume);
Text[TextDebug].Text := 'MP3 Volume: ' + IntToStr(MP3Volume) + '%';
end;
diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas
index fca4a84a..ce26b448 100644
--- a/Game/Code/Screens/UScreenScore.pas
+++ b/Game/Code/Screens/UScreenScore.pas
@@ -529,11 +529,11 @@ begin
//If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal
if (Ini.PreviewFading = 0) then
begin
- Music.SetMusicVolume (Ini.PreviewVolume * 10);
+ Music.SetMusicVolume (ScreenSong.MP3Volume);
Music.Play;
end else
begin
- Music.Fade(0, Ini.PreviewVolume*10, Ini.PreviewFading);
+ Music.Fade(0, ScreenSong.MP3Volume, Ini.PreviewFading);
Music.Play;
end;
end;
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
index d2f1a1a4..e7d2fec9 100644
--- a/Game/Code/Screens/UScreenSing.pas
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -21,6 +21,8 @@ type
NumEmptySentences: integer;
public
//TextTime: integer;
+ MP3Volume: integer;
+ MP3VolumeHandler: THandler;
//TimeBar mod
StaticTimeProgress: integer;
@@ -106,6 +108,7 @@ type
procedure LoadNextSong;
procedure UpdateMedleyStats(medley_end: boolean);
procedure DrawMedleyCountdown();
+ procedure DrawVolume;
end;
implementation
@@ -120,6 +123,30 @@ begin
If (PressedDown) Then
begin // Key Down
case PressedKey of
+ //MP3-Volume Up
+ SDLK_PAGEUP:
+ begin
+ if (MP3Volume<100) then
+ begin
+ MP3Volume := MP3Volume+5;
+ Music.SetMusicVolume(MP3Volume);
+ end;
+ MP3VolumeHandler.changed := true;
+ MP3VolumeHandler.change_time := 0;
+ end;
+
+ //MP3-Volume Down
+ SDLK_PAGEDOWN:
+ begin
+ if (MP3Volume>0) then
+ begin
+ MP3Volume := MP3Volume-5;
+ Music.SetMusicVolume(MP3Volume);
+ end;
+ MP3VolumeHandler.changed := true;
+ MP3VolumeHandler.change_time := 0;
+ end;
+
SDLK_K:
begin
if Music.VocalRemoverActivated() then
@@ -130,7 +157,8 @@ begin
SDLK_TAB:
begin
- Pause;
+ if not paused then
+ Pause;
ScreenPopupHelp.ShowPopup();
end;
@@ -289,6 +317,8 @@ begin
LyricMain := TLyric.Create;
LyricSub := TLyric.Create;
UVideo.Init;
+
+ MP3Volume := 100;
end;
procedure TScreenSing.onShow;
@@ -312,6 +342,8 @@ begin
Text[VideoAspectText].Visible := false;
Static[VideoAspectStatic].Visible := false;
+ MP3VolumeHandler.changed := false;
+
//Reset Player Medley stats
if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
begin
@@ -941,9 +973,9 @@ begin
// play music (II)
if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
- Music.Fade(10, 100, AktSong.Medley.FadeIn_time)
+ Music.Fade(10, MP3Volume, AktSong.Medley.FadeIn_time)
else
- Music.SetVolume(100);
+ Music.SetMusicVolume(MP3Volume);
Music.Play;
@@ -1321,6 +1353,61 @@ begin
Static[SongNameStatic].Visible := false;
Text[SongNameText].Visible := false;
end;
+
+ if MP3VolumeHandler.changed and (MP3VolumeHandler.change_time+TimeSkip<3) then
+ begin
+ MP3VolumeHandler.change_time := MP3VolumeHandler.change_time + TimeSkip;
+ DrawVolume;
+ end else
+ MP3VolumeHandler.changed := false;
+end;
+
+procedure TScreenSing.DrawVolume();
+const
+ step = 5;
+
+var
+ txt: PChar;
+ w, h: real;
+ str: string;
+ x, y: real;
+ I: integer;
+ num: integer;
+
+begin
+ x := 10;
+ y := 475;
+ w := 782;
+ h := 12;
+
+ num := round(100/step);
+
+ for I := 1 to num do
+ begin
+ if (I<=round(MP3Volume/step)) then
+ begin
+ glColor4f(0.0, 0.8, 0.0, 0.8);
+ glEnable(GL_BLEND);
+ glbegin(gl_quads);
+ glVertex2f(x+(I-1)*(w/num), y);
+ glVertex2f(x+(I-1)*(w/num), y+h);
+ glVertex2f(x+(I)*(w/num)-2, y+h);
+ glVertex2f(x+(I)*(w/num)-2, y);
+ glEnd;
+ glDisable(GL_BLEND);
+ end else
+ begin
+ glColor4f(0.7, 0.7, 0.7, 0.6);
+ glEnable(GL_BLEND);
+ glbegin(gl_quads);
+ glVertex2f(x+(I-1)*(w/num), y);
+ glVertex2f(x+(I-1)*(w/num), y+h);
+ glVertex2f(x+(I)*(w/num)-2, y+h);
+ glVertex2f(x+(I)*(w/num)-2, y);
+ glEnd;
+ glDisable(GL_BLEND);
+ end;
+ end;
end;
procedure TScreenSing.UpdateMedleyStats(medley_end: boolean);
diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas
index 1f766ebe..708d81ca 100644
--- a/Game/Code/Screens/UScreenSingModi.pas
+++ b/Game/Code/Screens/UScreenSingModi.pas
@@ -708,9 +708,15 @@ end;
((ScreenSong.Mode=smChallenge) and
(DLLMan.Plugins[PartySessionM2.Rounds[PartySessionM2.CurRound].Plugin].Name='PLUGIN_HAUDENLUKAS_NAME')) then
begin
-
+ //TODO!
end;
+ if MP3VolumeHandler.changed and (MP3VolumeHandler.change_time+TimeSkip<3) then
+ begin
+ MP3VolumeHandler.change_time := MP3VolumeHandler.change_time + TimeSkip;
+ DrawVolume;
+ end else
+ MP3VolumeHandler.changed := false;
end;
procedure TScreenSingModi.Finish;
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index 238db5e8..8e8bf2ca 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -19,9 +19,11 @@ type
TScreenSong = class(TMenu)
private
SkippedSongs: array of integer;
- ChooseableSongs: integer;
+ ChooseableSongs: integer;
public
+ MP3Volume: integer;
+ MP3VolumeHandler: THandler;
TextArtist: integer;
TextTitle: integer;
TextNumber: integer;
@@ -162,9 +164,12 @@ type
function getVisibleMedleyArr(MinS: TMedleySource): TVisArr;
procedure StartMedley(num: integer; MinS: TMedleySource);
procedure DrawAspect;
+ procedure DrawVolume;
function PartyPlayedSong(SongNr: integer): boolean;
function PartyPlayedMedley(SongNr: integer): boolean;
+
+
end;
implementation
@@ -395,6 +400,30 @@ begin
end;
case PressedKey of
+ //MP3-Volume Up
+ SDLK_PAGEUP:
+ begin
+ if (MP3Volume<100) then
+ begin
+ MP3Volume := MP3Volume+5;
+ Music.SetMusicVolume(MP3Volume);
+ end;
+ MP3VolumeHandler.changed := true;
+ MP3VolumeHandler.change_time := 0;
+ end;
+
+ //MP3-Volume Down
+ SDLK_PAGEDOWN:
+ begin
+ if (MP3Volume>0) then
+ begin
+ MP3Volume := MP3Volume-5;
+ Music.SetMusicVolume(MP3Volume);
+ end;
+ MP3VolumeHandler.changed := true;
+ MP3VolumeHandler.change_time := 0;
+ end;
+
SDLK_K:
begin
if Music.VocalRemoverActivated() then
@@ -1198,6 +1227,8 @@ begin
if (Length(CatSongs.Song) > 0) then
Interaction := 0;
+
+ MP3Volume := Ini.PreviewVolume * 10;
end;
procedure TScreenSong.SetScroll;
@@ -1742,6 +1773,7 @@ begin
StartTry := false;
AspectHandler.changed := false;
+ MP3VolumeHandler.changed := false;
SetLength(PlaylistMedley.Song, 0);
SetLength(SkippedSongs, 0);
@@ -2168,6 +2200,13 @@ begin
(AspectHandler.change_time+3<Czas.Teraz) then
AspectHandler.changed := false;
+ if MP3VolumeHandler.changed and (MP3VolumeHandler.change_time+TimeSkip<3) then
+ begin
+ MP3VolumeHandler.change_time := MP3VolumeHandler.change_time + TimeSkip;
+ DrawVolume;
+ end else
+ MP3VolumeHandler.changed := false;
+
DrawExtensions;
end;
@@ -2211,6 +2250,70 @@ begin
glPrint(txt);
end;
+procedure TScreenSong.DrawVolume();
+const
+ step = 5;
+
+var
+ txt: PChar;
+ w, h: real;
+ str: string;
+ x, y: real;
+ I: integer;
+ num: integer;
+
+begin
+ x := 10;
+ y := 530;
+ w := 780;
+ h := 12;
+
+ num := round(100/step);
+
+ for I := 1 to num do
+ begin
+ if (I<=round(MP3Volume/step)) then
+ begin
+ glColor4f(0.0, 0.8, 0.0, 0.8);
+ glEnable(GL_BLEND);
+ glbegin(gl_quads);
+ glVertex2f(x+(I-1)*(w/num), y);
+ glVertex2f(x+(I-1)*(w/num), y+h);
+ glVertex2f(x+(I)*(w/num)-2, y+h);
+ glVertex2f(x+(I)*(w/num)-2, y);
+ glEnd;
+ glDisable(GL_BLEND);
+ end else
+ begin
+ glColor4f(0.7, 0.7, 0.7, 0.6);
+ glEnable(GL_BLEND);
+ glbegin(gl_quads);
+ glVertex2f(x+(I-1)*(w/num), y);
+ glVertex2f(x+(I-1)*(w/num), y+h);
+ glVertex2f(x+(I)*(w/num)-2, y+h);
+ glVertex2f(x+(I)*(w/num)-2, y);
+ glEnd;
+ glDisable(GL_BLEND);
+ end;
+ end;
+
+ {
+ //print Text
+ str := IntToStr(MP3Volume)+ '%';
+
+ glColor4f(1, 1, 1, 1);
+
+ h := 8;
+ SetFontStyle(1);
+ SetFontItalic(false);
+ SetFontSize(h);
+ w := glTextWidth(PChar(str));
+
+ SetFontPos (x+2, y+2);
+ txt := Addr(str[1]);
+ glPrint(txt); }
+end;
+
procedure TScreenSong.SelectNext;
var
Skip, Skip2: integer;
@@ -2345,11 +2448,11 @@ begin
//If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal
if (Ini.PreviewFading = 0) then
begin
- Music.SetMusicVolume (Ini.PreviewVolume * 10);
+ Music.SetMusicVolume (MP3Volume);
Music.Play;
end else
begin
- Music.Fade(0, Ini.PreviewVolume*10, Ini.PreviewFading);
+ Music.Fade(0, MP3Volume, Ini.PreviewFading);
Music.Play;
end;
end;
diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas
index 0efdb57e..d2bce394 100644
--- a/Game/Code/Screens/UScreenSongMenu.pas
+++ b/Game/Code/Screens/UScreenSongMenu.pas
@@ -82,6 +82,30 @@ begin
ScreenPopupHelp.ShowPopup();
end;
+ //MP3-Volume Up
+ SDLK_PAGEUP:
+ begin
+ if (ScreenSong.MP3Volume<100) then
+ begin
+ ScreenSong.MP3Volume := ScreenSong.MP3Volume+5;
+ Music.SetMusicVolume(ScreenSong.MP3Volume);
+ end;
+ ScreenSong.MP3VolumeHandler.changed := true;
+ ScreenSong.MP3VolumeHandler.change_time := 0;
+ end;
+
+ //MP3-Volume Down
+ SDLK_PAGEDOWN:
+ begin
+ if (ScreenSong.MP3Volume>0) then
+ begin
+ ScreenSong.MP3Volume := ScreenSong.MP3Volume-5;
+ Music.SetMusicVolume(ScreenSong.MP3Volume);
+ end;
+ ScreenSong.MP3VolumeHandler.changed := true;
+ ScreenSong.MP3VolumeHandler.change_time := 0;
+ end;
+
SDLK_V:
begin
if UVideo.VideoOpened then
diff --git a/Game/Output/Languages/German.ini b/Game/Output/Languages/German.ini
index 1f5a19f6..f65e5ba3 100644
--- a/Game/Output/Languages/German.ini
+++ b/Game/Output/Languages/German.ini
@@ -1191,6 +1191,8 @@ BACKSPACE = zurück
P = Pause / Weiter
PRINT = Screenshot erstellen
Q = UltraStar Deluxe beenden
+PAGEUP = Lautstärke erhöhen
+PAGEDOWN = Lautstärke reduzieren
#-------------------------------------------------------#
# ID_024: UScreenSong #
#-------------------------------------------------------#
@@ -1205,6 +1207,8 @@ PRINT = Screenshot erstellen
Q = UltraStar Deluxe beenden
V = Videovorschau vergrößern/verkleinern (falls vorhanden)
A = Bildseitenverhältnis umschalten (nur im Vollbildmodus, wird gespeichert)
+PAGEUP = Lautstärke erhöhen
+PAGEDOWN = Lautstärke reduzieren
#-------------------------------------------------------#
SEC_010 = Songauswahl
LEFT = Linksherum durch die Liedauswahl blättern