diff --git a/Output/CreditsRessourcesDB.sqlite b/Output/CreditsRessourcesDB.sqlite new file mode 100644 index 00000000..dbfe78bb Binary files /dev/null and b/Output/CreditsRessourcesDB.sqlite differ diff --git a/Output/Fonts/Fonts.xml b/Output/Fonts/Fonts.xml index f9bd90df..70524adf 100644 --- a/Output/Fonts/Fonts.xml +++ b/Output/Fonts/Fonts.xml @@ -2,10 +2,28 @@ Normal + 0,00 + 0,00 + 0,00 + 0,00 + 1,00 FreeSans FreeSans.ttf FreeSansBold.ttf FreeSansOblique.ttf FreeSansBoldOblique.ttf + + Outline + 0,10 + 0,00 + 0,00 + 0,00 + 1,00 + FreeSans + FreeSans.ttf + FreeSansBold.ttf + FreeSansOblique.ttf + FreeSansBoldOblique.ttf + \ No newline at end of file diff --git a/Output/Graphics/Logo.png b/Output/Graphics/Logo.png index 2ad40d2f..0977ea93 100644 Binary files a/Output/Graphics/Logo.png and b/Output/Graphics/Logo.png differ diff --git a/Output/Languages/Deutsch.xml b/Output/Languages/Deutsch.xml index be0b28c6..3262bf6f 100644 --- a/Output/Languages/Deutsch.xml +++ b/Output/Languages/Deutsch.xml @@ -180,5 +180,6 @@ Video-Hintergründe Video-Vorschau Videos während des Singens + Videos der Hintergrundmusik diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml index 50a87ba8..f0df105b 100644 --- a/Output/Languages/English.xml +++ b/Output/Languages/English.xml @@ -180,5 +180,6 @@ Video Backgrounds Video Preview Videos while singing + Display current backgroundmusic video diff --git a/Output/Languages/French.xml b/Output/Languages/French.xml index 2c2f7944..4c2d3ec9 100644 --- a/Output/Languages/French.xml +++ b/Output/Languages/French.xml @@ -180,5 +180,6 @@ Vidéo en arrière plan Prévisualisation des Vidéos Vidéos pendant que l'on chante + TODO: Display current backgroundmusic video diff --git a/Output/Languages/Spanish.xml b/Output/Languages/Spanish.xml index f9f92cff..cb106774 100644 --- a/Output/Languages/Spanish.xml +++ b/Output/Languages/Spanish.xml @@ -55,7 +55,7 @@ Lista Dreidel - TileBoard + Cuadrícula Libro Según Sean Necesarias @@ -180,5 +180,6 @@ Videos de Fondo Previsualización del Video Videos al Cantar + TODO: Display current backgroundmusic video diff --git a/Output/Readme.txt b/Output/Readme.txt new file mode 100644 index 00000000..93940687 --- /dev/null +++ b/Output/Readme.txt @@ -0,0 +1,127 @@ +Vocaluxe 0.1 README +---------------------------- + +================================= += 1. About = += 2. Release Notes = += 3. Command-Line Parameters = += 4. Controls = += 5. Help & Support = += 6. Source Code = +================================= + + +================================= += 1. About = +================================= + +Vocaluxe is a free and open source singing game. It allows up to three players (currently) to sing +along with music using microphones in order to score points, depending on the pitch of the voice +and the rhythm of singing. + +Vocaluxe is an entirely new development in C#, inspired by the original UltraStar (developed by corvus5) +and the great Ultrastar Deluxe project. + +Supported Operating Systems / Requirements: +- WinXP, Vista, Windows 7 with .NET 2.0 +- 1 GHz CPU, 512 MB RAM, Graphics card with OpenGL 2.1 or DirectX 9.0 support + + +================================= += 2. Release Notes = +================================= + +- The program supports 32bit and 64bit (Vocaluxe_x64.exe) operating systems. + +- The program uses OpenGL as the default renderer. If your graphics card driver does not or not + properly support OpenGL, you can try the Direct3D renderer by editing your Config.xml in the + application's main directory: + + + + TR_CONFIG_DIRECT3D + +- To add your existing song collection to Vocaluxe, put your songs into the 'Songs' subfolder. + + Alternatively, you can add multiple song paths to Vocaluxe by editing your Config.xml: + + + + C:\Vocaluxe\Songs + D:\EvenMore\Songs + +- To use your highscore database from UltraStar deluxe 1.0.1, UltraStar deluxe CMD Mod or + UltraStar deluxe 1.1, simply copy your Ultrastar.db (rename if necessary) into the main + directory. Your highscore database will be imported into the HighscoreDB.sqlite file when + Vocaluxe is started. Upon successful import, the old database is deleted. + +- To add your own player avatars, simply add some picture files to the 'Profiles' subfolder. + Supported file types: png, jpg (jpeg), bmp. + Images should have square proportions, e.g. 400x400 px. + + +================================= += 3. Command-Line Parameters = +================================= +The following command-line parameters may be passed to the game when starting it through a shortcut +or from the console: + +-ConfigFile [Path\File]: Use [Path\File] as configuration file instead of Config.xml in the main folder. + The path to the file has to exist and needs to be an absolute path. + If only a filename is specified, the file is assumed to be in the current directory. + Examples: Vocaluxe.exe -ConfigFile MyConfig.xml + Vocaluxe.exe -ConfigFile C:\Vocaluxe\Configs\MyConfig.xml + +-ScoreFile [Path\File] : Use [File] as score database instead of HighscoreDB.sqlite in the application's + main folder. The path to the file has to exist and needs to be an absolute path. + If only a filename is specified, the file is assumed to be in the current directory. + Examples: Vocaluxe.exe -ScoreFile MyHighscoreDB.sqlite + Vocaluxe.exe -Scorefile C:\Vocaluxe\Highscores\MyHighscoreDB.sqlite + +-SongFolder [Path] : Use [Path] as song folder. The path has to exist and needs to be an absolute path. + Note that any song folders set in the config file will be ignored. + This parameter may be used multiple times to use different song folders. + Examples: Vocaluxe.exe -SongFolder D:\MySongCollection + Vocaluxe.exe -SongFolder D:\MySongCollection -SongFolder E:\MoreSongs + +-SongPath [Path] : Deprecated, see SongFolder [Path]. This alias is provided for convenience. + +Complete example: +Vocaluxe.exe -ConfigFile MyConfig.xml -ScoreFile C:\Vocaluxe\Highscores\MyHighscoreDB.sqlite -SongFolder D:\MySongCollection + + +================================= += 4. Controls = +================================= +[Mouse] to navigate through the screens: Left button: select/manipulate elements, + Right button: go to previous screen. +[Cursor] to navigate through the screens. +[Enter] to confirm +[Escape] or [Back] to go to the previous screen. + +[ALT] + [P] to take a ScreenShot. Screenshots are saved in the directory "Screenshots". +[ALT] + [ENTER] to toggle full screen mode. +[SHIFT] + [F1] to toggle theme edit mode. The theme edit mode is experimental. It allows you + to change the size and position of the element on the screens. You can save + your changes with [S] before leaving the theme edit mode. +[TAB] to open the background music controls (not on all screens). + +Songscreen +[R] to select a random song +[F3] or [CTRL]+[F] to open/close the song search menu +[A] to sing all songs from a category + + +================================= += 5. Help & Suppport = +================================= +GitHub Wiki: https://github.com/Vocaluxe/Vocaluxe/wiki +Support Forum (German): http://www.ultra-star.de +Song-DataBase (USDB): http://usdb.animux.de/ + + +================================= += 6. Source Code = +================================= +Source Code (GitHub): https://github.com/Vocaluxe/Vocaluxe +SF.Net Page: http://sourceforge.net/projects/vocaluxe/ \ No newline at end of file diff --git a/Output/Themes/Ambient.xml b/Output/Themes/Ambient.xml index 033f80e3..25940dca 100644 --- a/Output/Themes/Ambient.xml +++ b/Output/Themes/Ambient.xml @@ -1,12 +1,12 @@  - 4 + 5 Ambient bohning Ambient 0 - 1 + 2 Cursor diff --git a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml index c24f77ca..df19d2c3 100644 --- a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml +++ b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml @@ -18,13 +18,29 @@ + + + CoverBackground + + 50 + 0 + 0,00 + 50 + 50 + + + Visible + + + + PreviousIcon PreviousIcon - 50 + 125 0 0,00 50 @@ -71,7 +87,7 @@ PlayIcon - 125 + 200 5 0,00 40 @@ -118,7 +134,7 @@ PauseIcon - 125 + 200 5 0,00 40 @@ -165,7 +181,7 @@ NextIcon - 190 + 265 0 0,00 50 @@ -212,7 +228,7 @@ RepeatIcon - 265 + 330 0 0,00 50 @@ -225,7 +241,7 @@ ButtonSColor - 265 + 405 25 32 @@ -253,5 +269,174 @@ + + + VideoIcon + + VideoIcon + + 405 + 0 + 0,00 + 50 + 50 + + + ButtonColor + + + ButtonSColor + + + 315 + 0 + + 32 + + 142 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + + + Normal + + + + + + + + + + + + + VideoIcon + + VideoIcon + + 480 + 0 + 0,00 + 50 + 50 + + + ButtonColor + + + ButtonSColor + + + 315 + 0 + + 32 + + 142 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + + + Normal + + + + + + + + + + + + + DuetIcon + + DuetIcon + + 555 + 0 + 0,00 + 50 + 50 + + + ButtonColor + + + ButtonSColor + + + 380 + 0 + + 32 + + 142 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + + + Normal + + + + + + + + + + + + + 630 + 0 + + 0,00 + + 50 + + 650 + + + StaticColor + + + TextSColor + + Left + + + + Outline + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenHighscore.xml b/Output/Themes/Ambient/Screens/ScreenHighscore.xml index 596abbd3..80f2dd70 100644 --- a/Output/Themes/Ambient/Screens/ScreenHighscore.xml +++ b/Output/Themes/Ambient/Screens/ScreenHighscore.xml @@ -65,7 +65,7 @@ - Normal + Outline TR_SCREENHIGHSCORE_HIGHSCORE @@ -92,7 +92,7 @@ - Normal + Outline @@ -119,7 +119,7 @@ - Normal + Outline @@ -146,7 +146,7 @@ - Normal + Outline @@ -173,7 +173,7 @@ - Normal + Outline @@ -200,7 +200,7 @@ - Normal + Outline @@ -227,7 +227,7 @@ - Normal + Outline @@ -254,7 +254,7 @@ - Normal + Outline @@ -281,7 +281,7 @@ - Normal + Outline @@ -308,7 +308,7 @@ - Normal + Outline @@ -335,7 +335,7 @@ - Normal + Outline @@ -362,7 +362,7 @@ - Normal + Outline @@ -389,7 +389,7 @@ - Normal + Outline @@ -416,7 +416,7 @@ - Normal + Outline @@ -443,7 +443,7 @@ - Normal + Outline @@ -470,7 +470,7 @@ - Normal + Outline @@ -497,7 +497,7 @@ - Normal + Outline @@ -524,7 +524,7 @@ - Normal + Outline @@ -551,7 +551,7 @@ - Normal + Outline @@ -578,7 +578,7 @@ - Normal + Outline @@ -605,7 +605,7 @@ - Normal + Outline @@ -632,7 +632,7 @@ - Normal + Outline @@ -659,7 +659,7 @@ - Normal + Outline @@ -686,7 +686,7 @@ - Normal + Outline @@ -713,7 +713,7 @@ - Normal + Outline @@ -740,7 +740,7 @@ - Normal + Outline @@ -767,7 +767,7 @@ - Normal + Outline @@ -794,7 +794,7 @@ - Normal + Outline @@ -821,7 +821,7 @@ - Normal + Outline @@ -848,7 +848,7 @@ - Normal + Outline @@ -875,7 +875,7 @@ - Normal + Outline @@ -902,7 +902,7 @@ - Normal + Outline @@ -929,7 +929,7 @@ - Normal + Outline @@ -956,7 +956,7 @@ - Normal + Outline @@ -983,7 +983,7 @@ - Normal + Outline @@ -1010,7 +1010,7 @@ - Normal + Outline @@ -1037,7 +1037,7 @@ - Normal + Outline @@ -1064,7 +1064,7 @@ - Normal + Outline @@ -1091,7 +1091,7 @@ - Normal + Outline @@ -1118,7 +1118,7 @@ - Normal + Outline @@ -1145,7 +1145,7 @@ - Normal + Outline @@ -1172,7 +1172,7 @@ - Normal + Outline @@ -1199,7 +1199,7 @@ - Normal + Outline diff --git a/Output/Themes/Ambient/Screens/ScreenLoad.xml b/Output/Themes/Ambient/Screens/ScreenLoad.xml index a85293a5..bda793ce 100644 --- a/Output/Themes/Ambient/Screens/ScreenLoad.xml +++ b/Output/Themes/Ambient/Screens/ScreenLoad.xml @@ -49,7 +49,7 @@ - Normal + Outline TR_PROGRAM_NAME @@ -76,7 +76,7 @@ - Normal + Outline TR_SCREENLOAD_LOADING @@ -103,7 +103,7 @@ - Normal + Outline diff --git a/Output/Themes/Ambient/Screens/ScreenMain.xml b/Output/Themes/Ambient/Screens/ScreenMain.xml index 63ed0825..41404cb8 100644 --- a/Output/Themes/Ambient/Screens/ScreenMain.xml +++ b/Output/Themes/Ambient/Screens/ScreenMain.xml @@ -65,7 +65,7 @@ - Normal + Outline TR_SCREENMAIN_BUTTON_SING @@ -120,7 +120,7 @@ - Normal + Outline TR_SCREENMAIN_BUTTON_OPTIONS @@ -175,7 +175,7 @@ - Normal + Outline TR_SCREENMAIN_BUTTON_PROFILES @@ -230,7 +230,7 @@ - Normal + Outline TR_BUTTON_EXIT diff --git a/Output/Themes/Ambient/Screens/ScreenNames.xml b/Output/Themes/Ambient/Screens/ScreenNames.xml index 54e3df3c..0daa48e9 100644 --- a/Output/Themes/Ambient/Screens/ScreenNames.xml +++ b/Output/Themes/Ambient/Screens/ScreenNames.xml @@ -65,7 +65,7 @@ - Normal + Outline TR_SCREENNAMES_MENU @@ -93,7 +93,7 @@ - Normal + Outline @@ -136,7 +136,7 @@ - Normal + Outline TR_BUTTON_BACK @@ -191,7 +191,7 @@ - Normal + Outline TR_BUTTON_START @@ -246,7 +246,7 @@ - Normal + Outline TR_SCREENNAMES_BUTTON_1PLAYER @@ -293,7 +293,7 @@ - Normal + Outline TR_SCREENNAMES_BUTTON_2PLAYER @@ -340,7 +340,7 @@ - Normal + Outline TR_SCREENNAMES_BUTTON_3PLAYER @@ -410,7 +410,7 @@ 186,00 - Normal + Outline Bold @@ -475,7 +475,7 @@ 186,00 - Normal + Outline Bold @@ -540,7 +540,7 @@ 186,00 - Normal + Outline Bold diff --git a/Output/Themes/Ambient/Screens/ScreenOptions.xml b/Output/Themes/Ambient/Screens/ScreenOptions.xml index 0099e067..9bf1033a 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptions.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptions.xml @@ -49,7 +49,7 @@ - Normal + Outline TR_SCREENO_OPTIONS @@ -92,7 +92,7 @@ - Normal + Outline TR_SCREENO_BUTTON_GAME @@ -147,7 +147,7 @@ - Normal + Outline TR_SCRENNO_BUTTON_SOUND @@ -202,7 +202,7 @@ - Normal + Outline TR_SCREENO_BUTTON_RECORD @@ -257,7 +257,7 @@ - Normal + Outline TR_SCREENO_BUTTON_VIDEO @@ -312,7 +312,7 @@ - Normal + Outline TR_SCREENO_BUTTON_THEME diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml b/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml index 3ae21688..0054fae4 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml @@ -145,7 +145,7 @@ - Normal + Outline TR_SCREENOGAME_OPTIONS @@ -172,7 +172,7 @@ - Normal + Outline TR_SCREENOGAME_LANGUAGE @@ -199,7 +199,7 @@ - Normal + Outline TR_SCREENOGAME_DEBUGLEVEL @@ -226,7 +226,7 @@ - Normal + Outline TR_SCREENOGAME_SONGMENU @@ -253,7 +253,7 @@ - Normal + Outline TR_SCREENOGAME_SONGSORTING @@ -280,7 +280,7 @@ - Normal + Outline TR_SCREENOGAME_TABS @@ -307,7 +307,7 @@ - Normal + Outline TR_SCREENOGAME_TIMERMODE @@ -350,7 +350,7 @@ - Normal + Outline TR_BUTTON_BACK @@ -428,7 +428,7 @@ 205,33 - Normal + Outline Bold @@ -493,7 +493,7 @@ 205,33 - Normal + Outline Bold @@ -558,7 +558,7 @@ 205,33 - Normal + Outline Bold @@ -623,7 +623,7 @@ 205,33 - Normal + Outline Bold @@ -688,7 +688,7 @@ 308,00 - Normal + Outline Bold @@ -753,7 +753,7 @@ 205,33 - Normal + Outline Bold diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml index 3fdea73b..0e43d77c 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml @@ -177,7 +177,7 @@ - Normal + Outline TR_SCREENORECORD_OPTIONS @@ -204,7 +204,7 @@ - Normal + Outline TR_SCREENORECORD_DEVICE @@ -231,7 +231,7 @@ - Normal + Outline TR_SCREENORECORD_INPUT @@ -258,7 +258,7 @@ - Normal + Outline TR_SCREENORECORD_CHANNEL_1 @@ -285,7 +285,7 @@ - Normal + Outline TR_SCREENORECORD_CHANNEL_2 @@ -312,7 +312,7 @@ - Normal + Outline TR_SCREENORECORD_MIC_DELAY @@ -340,7 +340,7 @@ - Normal + Outline TR_SCREENORECORD_MIC_WARNING @@ -367,7 +367,7 @@ - Normal + Outline @@ -394,7 +394,7 @@ - Normal + Outline @@ -437,7 +437,7 @@ - Normal + Outline TR_BUTTON_BACK @@ -492,7 +492,7 @@ - Normal + Outline TR_SCREENORECORD_BUTTON_DELAYTEST @@ -570,7 +570,7 @@ 616,00 - Normal + Outline Bold @@ -635,7 +635,7 @@ 616,00 - Normal + Outline Bold @@ -700,7 +700,7 @@ 154,00 - Normal + Outline Bold @@ -765,7 +765,7 @@ 154,00 - Normal + Outline Bold @@ -830,7 +830,7 @@ 123,20 - Normal + Outline Bold diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml index 5d3d0e9e..35751819 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml @@ -1,7 +1,7 @@  - 1 + 2 Video @@ -55,7 +55,7 @@ - Normal + Outline TR_SCREENOSOUND_OPTIONS @@ -82,7 +82,7 @@ - Normal + Outline TR_SCREENOSOUND_BACKGROUNDMUSIC @@ -109,7 +109,7 @@ - Normal + Outline TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME @@ -136,7 +136,7 @@ - Normal + Outline TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE @@ -179,7 +179,7 @@ - Normal + Outline TR_BUTTON_BACK @@ -257,7 +257,7 @@ 205,33 - Normal + Outline Bold @@ -322,7 +322,7 @@ 205,33 - Normal + Outline Bold @@ -385,9 +385,9 @@ 32,00 - 500 + 500,00 - Normal + Outline Bold diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml b/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml index 3517c5bd..ac972646 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml @@ -161,7 +161,7 @@ - Normal + Outline TR_SCREENOTHEME_OPTIONS @@ -188,7 +188,7 @@ - Normal + Outline TR_SCREENOTHEME_THEME @@ -215,7 +215,7 @@ - Normal + Outline TR_SCREENOTHEME_SKIN @@ -242,7 +242,7 @@ - Normal + Outline TR_SCREENOTHEME_COVERTHEME @@ -269,7 +269,7 @@ - Normal + Outline TR_SCREENOTHEME_NOTELINES @@ -296,7 +296,7 @@ - Normal + Outline TR_SCREENOTHEME_TONEHELPER @@ -323,7 +323,7 @@ - Normal + Outline TR_SCREENOTHEME_TIMERLOOK @@ -350,7 +350,7 @@ - Normal + Outline TR_SCREENOTHEME_COVERLOADING @@ -393,7 +393,7 @@ - Normal + Outline TR_BUTTON_BACK @@ -471,7 +471,7 @@ 616,00 - Normal + Outline Bold @@ -536,7 +536,7 @@ 616,00 - Normal + Outline Bold @@ -601,7 +601,7 @@ 308,00 - Normal + Outline Bold @@ -666,7 +666,7 @@ 308,00 - Normal + Outline Bold @@ -731,7 +731,7 @@ 308,00 - Normal + Outline Bold @@ -796,7 +796,7 @@ 308,00 - Normal + Outline Bold @@ -861,7 +861,7 @@ 616,00 - Normal + Outline Bold diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml index 292cce63..9d8b1bc1 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml @@ -1,7 +1,7 @@  - 1 + 2 Video @@ -97,7 +97,7 @@ - Normal + Outline TR_SCREENOVIDEO_OPTIONS @@ -124,7 +124,7 @@ - Normal + Outline TR_SCREENOVIDEO_VIDEOBACKGROUNDS @@ -151,7 +151,7 @@ - Normal + Outline TR_SCREENOVIDEO_VIDEOPREVIEW @@ -178,13 +178,40 @@ - Normal + Outline TR_SCREENOVIDEO_VIDEOINSONGS + + + 75 + 285 + + 0,00 + + 32 + + + + StaticColor + + + TextSColor + + Left + + + + Normal + + TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND + + + + Button @@ -221,7 +248,7 @@ - Normal + Outline TR_BUTTON_BACK @@ -299,7 +326,7 @@ 205,33 - Normal + Outline Bold @@ -364,7 +391,7 @@ 205,33 - Normal + Outline Bold @@ -429,11 +456,76 @@ 205,33 - Normal + Outline Bold 3 + + + Invisible + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + 500 + 280 + 0,00 + 700 + 50 + + 505 + 225 + 0,00 + 40 + 40 + + 1170 + 225 + 0,00 + 40 + 40 + + + SelectSlideColor + + + SelectSlideSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 32,00 + + 205,33 + + Normal + + Bold + + 3 + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenProfiles.xml b/Output/Themes/Ambient/Screens/ScreenProfiles.xml index 7a6c788f..6f19efb6 100644 --- a/Output/Themes/Ambient/Screens/ScreenProfiles.xml +++ b/Output/Themes/Ambient/Screens/ScreenProfiles.xml @@ -145,7 +145,7 @@ - Normal + Outline TR_SCREENPROFILES_PROFILES @@ -172,7 +172,7 @@ - Normal + Outline TR_SCREENPROFILES_PLAYERNAME @@ -199,7 +199,7 @@ - Normal + Outline TR_SCREENPROFILES_GAMEDIFFICULTY @@ -226,7 +226,7 @@ - Normal + Outline TR_SCREENPROFILES_AVATAR @@ -253,7 +253,7 @@ - Normal + Outline TR_SCREENPROFILES_GUESTPROFILE @@ -280,7 +280,7 @@ - Normal + Outline TR_SCREENPROFILES_ACTIVE @@ -323,7 +323,7 @@ - Normal + Outline @@ -370,7 +370,7 @@ - Normal + Outline TR_BUTTON_BACK @@ -425,7 +425,7 @@ - Normal + Outline TR_BUTTON_SAVE @@ -480,7 +480,7 @@ - Normal + Outline TR_SCREENPROFILES_BUTTON_NEW @@ -535,7 +535,7 @@ - Normal + Outline TR_SCREENPROFILES_BUTTON_DELETE @@ -613,7 +613,7 @@ 219,20 - Normal + Outline Bold @@ -678,7 +678,7 @@ 208,67 - Normal + Outline Bold @@ -743,7 +743,7 @@ 208,67 - Normal + Outline Bold @@ -808,7 +808,7 @@ 313,00 - Normal + Outline Bold @@ -873,7 +873,7 @@ 313,00 - Normal + Outline Bold diff --git a/Output/Themes/Ambient/Screens/ScreenScore.xml b/Output/Themes/Ambient/Screens/ScreenScore.xml index d03c560d..1673c63e 100644 --- a/Output/Themes/Ambient/Screens/ScreenScore.xml +++ b/Output/Themes/Ambient/Screens/ScreenScore.xml @@ -398,7 +398,7 @@ - Normal + Outline TR_SCREENSCORE_SCORES @@ -425,7 +425,7 @@ - Normal + Outline @@ -452,7 +452,7 @@ - Normal + Outline @@ -479,7 +479,7 @@ - Normal + Outline @@ -506,7 +506,7 @@ - Normal + Outline @@ -533,7 +533,7 @@ - Normal + Outline @@ -560,7 +560,7 @@ - Normal + Outline @@ -587,7 +587,7 @@ - Normal + Outline @@ -614,7 +614,7 @@ - Normal + Outline @@ -641,7 +641,7 @@ - Normal + Outline @@ -668,7 +668,7 @@ - Normal + Outline @@ -695,7 +695,7 @@ - Normal + Outline @@ -722,7 +722,7 @@ - Normal + Outline @@ -749,7 +749,7 @@ - Normal + Outline @@ -776,7 +776,7 @@ - Normal + Outline @@ -803,7 +803,7 @@ - Normal + Outline @@ -830,7 +830,7 @@ - Normal + Outline @@ -857,7 +857,7 @@ - Normal + Outline @@ -884,7 +884,7 @@ - Normal + Outline @@ -911,7 +911,7 @@ - Normal + Outline @@ -938,7 +938,7 @@ - Normal + Outline @@ -965,7 +965,7 @@ - Normal + Outline @@ -992,7 +992,7 @@ - Normal + Outline @@ -1019,7 +1019,7 @@ - Normal + Outline @@ -1046,7 +1046,7 @@ - Normal + Outline @@ -1073,7 +1073,7 @@ - Normal + Outline diff --git a/Output/Themes/Ambient/Screens/ScreenSing.xml b/Output/Themes/Ambient/Screens/ScreenSing.xml index 935fb419..0e206c1d 100644 --- a/Output/Themes/Ambient/Screens/ScreenSing.xml +++ b/Output/Themes/Ambient/Screens/ScreenSing.xml @@ -611,7 +611,7 @@ - Normal + Outline TR_SCREENSING_BUTTON_CANCEL @@ -666,7 +666,7 @@ - Normal + Outline TR_SCREENSING_BUTTON_CONTINUE diff --git a/Output/Themes/Ambient/Screens/ScreenSong.xml b/Output/Themes/Ambient/Screens/ScreenSong.xml index 2d0cfcfb..f693065d 100644 --- a/Output/Themes/Ambient/Screens/ScreenSong.xml +++ b/Output/Themes/Ambient/Screens/ScreenSong.xml @@ -74,7 +74,7 @@ - Normal + Outline @@ -106,7 +106,7 @@ - Normal + Outline @@ -137,7 +137,7 @@ - Normal + Outline TR_SCREENSONG_SEARCH @@ -164,7 +164,7 @@ - Normal + Outline @@ -229,7 +229,7 @@ - Normal + Outline @@ -257,7 +257,7 @@ - Normal + Outline @@ -285,7 +285,7 @@ - Normal + Outline diff --git a/Output/Themes/Changelog/Changelog_ScreenOptionsSound.txt b/Output/Themes/Changelog/Changelog_ScreenOptionsSound.txt new file mode 100644 index 00000000..5bdf4bfd --- /dev/null +++ b/Output/Themes/Changelog/Changelog_ScreenOptionsSound.txt @@ -0,0 +1,18 @@ +ScreenOptionsSound + +++++++++++ +Version 2: + +Add: + + + + + + + +and some texts for description (Text2, Text3, Text4) +"TR_SCREENOSOUND_BACKGROUNDMUSIC" +"TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME" +"TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE" +++++++++++ diff --git a/Output/Themes/Changelog/Changelog_ScreenOptionsVideo.txt b/Output/Themes/Changelog/Changelog_ScreenOptionsVideo.txt new file mode 100644 index 00000000..a6898ab5 --- /dev/null +++ b/Output/Themes/Changelog/Changelog_ScreenOptionsVideo.txt @@ -0,0 +1,10 @@ +ScreenOptionsTheme + +++++++++++ +Version 2: + +Add: + +and some texts and statics for description (Text5) +"TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND" +++++++++++ \ No newline at end of file diff --git a/Output/Themes/Changelog/Changelog_ThemeSystem.txt b/Output/Themes/Changelog/Changelog_ThemeSystem.txt index 43e7ac09..0da5e6f1 100644 --- a/Output/Themes/Changelog/Changelog_ThemeSystem.txt +++ b/Output/Themes/Changelog/Changelog_ThemeSystem.txt @@ -1,5 +1,18 @@ Theme System +++++++++++ +Version 5: + +Added: + outline thickness 0..1 + outline color red + outline color green + outline color blue + outline color alpha + +to Fonts + + ++++++++++ Version 4: diff --git a/Output/x86/PortAudio.dll b/Output/x86/PortAudio.dll index 4588ded3..a91a1516 100644 Binary files a/Output/x86/PortAudio.dll and b/Output/x86/PortAudio.dll differ diff --git a/README b/README index e69de29b..071051a3 100644 --- a/README +++ b/README @@ -0,0 +1,50 @@ + __ __ _ + \ \ / /__ ___ __ _| |_ ___ _____ + \ \ / / _ \ / __/ _` | | | | \ \/ / _ \ + \ V / (_) | (_| (_| | | |_| |> < __/ + \_/ \___/ \___\__,_|_|\__,_/_/\_\___| + + +================================= += 1. About = += 2. Download = += 3. Development Guidelines = += 4. Help & Support = +================================= + + +================================= += 1. About = +================================= +Vocaluxe is a free and open source singing game. It allows up to three players (currently) to sing along with music using microphones in order to score points, depending on the pitch of the voice and the rhythm of singing. + +Vocaluxe is an entirely new development in C#, inspired by the original UltraStar (developed by corvus5) and the great Ultrastar Deluxe project. + +Supported Operating Systems / Requirements: +- WinXP, Vista, Windows 7 with .NET 2.0 +- 1 GHz CPU, 512 MB RAM, Graphics card with OpenGL 2.1 or DirectX 9.0 support + + +================================= += 2. Download = +================================= +You can donwloadn precompiles Windows binaries at SourceForge: + +Download: http://sourceforge.net/projects/vocaluxe/ + + +================================= += 3. Development Guidelines = +================================= +The development of Vocaluxe uses this git branching model: + + http://nvie.com/posts/a-successful-git-branching-model/ + + +================================= += 4. Help & Suppport = +================================= +GitHub Wiki: https://github.com/Vocaluxe/Vocaluxe/wiki +GitGub Issues Tracker: https://github.com/Vocaluxe/Vocaluxe/issues +Support Forum (German): http://www.ultra-star.de +Song-DataBase (USDB): http://usdb.animux.de/ \ No newline at end of file diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 352c9398..da7618bc 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -6,6 +6,9 @@ using System.IO; using Vocaluxe.Base; using System.Diagnostics; using Vocaluxe.Lib.Song; +using Vocaluxe.Lib.Draw; +using System.Drawing; +using Vocaluxe.Menu; namespace Vocaluxe.Base { @@ -14,26 +17,125 @@ namespace Vocaluxe.Base private static CHelper Helper = new CHelper(); private static int _CurrentMusicStream = -1; private static int _PreviousMusicIndex = 0; - private static string _CurrentMusicFilePath = String.Empty; - - private static List _AllFileNames = new List(); - private static List _NotPlayedFileNames = new List(); - private static List _BGMusicFileNames = new List(); - private static List _PreviousFileNames = new List(); + private static PlaylistElement _CurrentPlaylistElement = new PlaylistElement(); + + private static List _AllFileNames = new List(); + private static List _NotPlayedFileNames = new List(); + private static List _BGMusicFileNames = new List(); + private static List _PreviousFileNames = new List(); + + private static int _Video = -1; + private static STexture _CurrentVideoTexture = new STexture(-1); + private static Stopwatch _FadeTimer = new Stopwatch(); + private static bool _VideoEnabled; private static bool _OwnMusicAdded; private static bool _BackgroundMusicAdded; private static bool _Playing; + private static bool _Disabled; + + public static bool VideoEnabled + { + get + { + return _VideoEnabled; + } + set + { + if (_VideoEnabled && value) + return; + if (!_VideoEnabled && !value) + return; + if(_VideoEnabled && !value) + ToggleVideo(); + if (!_VideoEnabled && value) + ToggleVideo(); + _VideoEnabled = value; + } + } + + public static bool Disabled + { + get + { + return _Disabled; + } + set + { + _Disabled = value; + if (_Disabled) + Pause(); + else + Play(); + } + } + + public static int SongID + { + get + { + return _CurrentPlaylistElement._SongID; + } + } + + public static bool Duet + { + get + { + return _CurrentPlaylistElement.Duet; + } + } + + public static bool SongHasVideo + { + get + { + return File.Exists(_CurrentPlaylistElement.VideoFilePath); + } + } + + public static bool Playing + { + get + { + return CSound.IsPlaying(_CurrentMusicStream); + } + } + + public static string ArtistAndTitle + { + get + { + return _CurrentPlaylistElement.Artist + " - " + _CurrentPlaylistElement.Title; + } + } + + public static STexture Cover + { + get + { + return _CurrentPlaylistElement.Cover; + } + } public static void Init() { - _BGMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.mp3", true, true)); - _BGMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wav", true, true)); - _BGMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.ogg", true, true)); - _BGMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wma", true, true)); + List templist = new List(); + + foreach(string ending in CSettings.MusicFileTypes) + { + templist.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, ending, true, true)); + } + + foreach (string path in templist) + { + _BGMusicFileNames.Add(new PlaylistElement(path)); + } if(CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC) AddBackgroundMusic(); + if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) + _VideoEnabled = true; _Playing = false; } @@ -48,6 +150,8 @@ namespace Vocaluxe.Base { CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CSettings.BackgroundMusicFadeTime); CSound.Play(_CurrentMusicStream); + if (_VideoEnabled && _Video != -1) + CVideo.VdResume(_Video); _Playing = true; } else @@ -58,14 +162,25 @@ namespace Vocaluxe.Base public static void Stop() { + if (_VideoEnabled && _Video != -1) + { + CVideo.VdClose(_Video); + CDraw.RemoveTexture(ref _CurrentVideoTexture); + _Video = -1; + } CSound.FadeAndStop(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime); - _CurrentMusicFilePath = String.Empty; + _CurrentPlaylistElement = new PlaylistElement(); _Playing = false; } public static void Pause() { + if (_VideoEnabled && _Video != -1) + { + CVideo.VdPause(_Video); + CVideo.VdSkip(_Video, CSound.GetPosition(_CurrentMusicStream) + CSettings.BackgroundMusicFadeTime, _CurrentPlaylistElement.VideoGap); + } CSound.FadeAndPause(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime); _Playing = false; } @@ -91,10 +206,10 @@ namespace Vocaluxe.Base if (_NotPlayedFileNames.Count == 0) _NotPlayedFileNames.AddRange(_AllFileNames); - _CurrentMusicFilePath = _NotPlayedFileNames[CGame.Rand.Next(_NotPlayedFileNames.Count)]; - _NotPlayedFileNames.Remove(_CurrentMusicFilePath); + _CurrentPlaylistElement = _NotPlayedFileNames[CGame.Rand.Next(_NotPlayedFileNames.Count)]; + _NotPlayedFileNames.Remove(_CurrentPlaylistElement); - _PreviousFileNames.Add(_CurrentMusicFilePath); + _PreviousFileNames.Add(_CurrentPlaylistElement); _PreviousMusicIndex = _PreviousFileNames.Count - 1; } else if(_PreviousFileNames.Count > 0) //We are in the previous list @@ -102,10 +217,11 @@ namespace Vocaluxe.Base Stop(); _PreviousMusicIndex++; - _CurrentMusicFilePath = _PreviousFileNames[_PreviousMusicIndex]; + _CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex]; } - - _CurrentMusicStream = CSound.Load(_CurrentMusicFilePath); + _CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath); + if (_VideoEnabled) + LoadVideo(); CSound.SetStreamVolume(_CurrentMusicStream, 0f); Play(); } @@ -123,10 +239,11 @@ namespace Vocaluxe.Base if (_PreviousMusicIndex < 0) _PreviousMusicIndex = 0; //No previous songs left, so play the first - _CurrentMusicFilePath = _PreviousFileNames[_PreviousMusicIndex]; - + _CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex]; - _CurrentMusicStream = CSound.Load(_CurrentMusicFilePath); + _CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath); + if (_VideoEnabled) + LoadVideo(); CSound.SetStreamVolume(_CurrentMusicStream, 0f); Play(); } @@ -137,6 +254,8 @@ namespace Vocaluxe.Base if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1) { CSound.SetPosition(_CurrentMusicStream, 0); + if (_VideoEnabled && _Video != -1) + CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); } } @@ -151,8 +270,8 @@ namespace Vocaluxe.Base { foreach (CSong song in CSongs.AllSongs) { - _AllFileNames.Add(song.GetMP3()); - _NotPlayedFileNames.Add(song.GetMP3()); + _AllFileNames.Add(new PlaylistElement(song)); + _NotPlayedFileNames.Add(new PlaylistElement(song)); } } _OwnMusicAdded = true; @@ -169,7 +288,7 @@ namespace Vocaluxe.Base _NotPlayedFileNames.AddRange(_BGMusicFileNames); } - if (IsPlaying() && !IsBackgroundFile(_CurrentMusicFilePath) || _AllFileNames.Count == 0) + if (Playing && !IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0) Next(); _OwnMusicAdded = false; @@ -194,7 +313,7 @@ namespace Vocaluxe.Base AddOwnMusic(); _BackgroundMusicAdded = false; - if (IsPlaying() && IsBackgroundFile(_CurrentMusicFilePath) || _AllFileNames.Count == 0) + if (Playing && IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0) Next(); } } @@ -248,19 +367,232 @@ namespace Vocaluxe.Base CConfig.SaveConfig(); } - public static bool IsPlaying() + public static void ToggleVideo() { - return CSound.IsPlaying(_CurrentMusicStream); + if (_Video != -1) + { + if (_VideoEnabled) + { + _VideoEnabled = false; + CVideo.VdClose(_Video); + _Video = -1; + CDraw.RemoveTexture(ref _CurrentVideoTexture); + return; + } + if (CVideo.VdFinished(_Video)) + { + CVideo.VdClose(_Video); + CDraw.RemoveTexture(ref _CurrentVideoTexture); + _Video = -1; + return; + } + } + else + LoadVideo(); } - private static bool IsBackgroundFile(string FilePath) + public static STexture GetVideoTexture() { - foreach (string file in _BGMusicFileNames) + if (_Video != -1) { - if (file == FilePath) + float vtime = 0f; + CVideo.VdGetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), ref vtime); + if (_FadeTimer.ElapsedMilliseconds <= 3000L) + { + _CurrentVideoTexture.color.A = (_FadeTimer.ElapsedMilliseconds / 3000f); + } + else + { + _CurrentVideoTexture.color.A = 1f; + _FadeTimer.Stop(); + } + return _CurrentVideoTexture; + } + return new STexture(-1); + } + + private static bool IsBackgroundFile(PlaylistElement element) + { + foreach (PlaylistElement elements in _BGMusicFileNames) + { + if (elements.MusicFilePath == element.MusicFilePath) return true; } return false; } + + private static void LoadVideo() + { + if (_Video == -1) + { + _Video = CVideo.VdLoad(_CurrentPlaylistElement.VideoFilePath); + CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); + _VideoEnabled = true; + _FadeTimer.Reset(); + _FadeTimer.Start(); + } + } + } +} + +class PlaylistElement +{ + public int _SongID; + private string _MusicFilePath; + + public string MusicFilePath + { + get + { + if (_SongID >= 0) + { + CSong song = CSongs.GetSong(_SongID); + if (song != null) + return song.GetMP3(); + else + { + _SongID = -1; + CLog.LogError("Song not found"); + } + } + return _MusicFilePath; + } + + set + { + _MusicFilePath = value; + } + } + + public string VideoFilePath + { + get + { + if (_SongID >= 0) + { + CSong song = CSongs.GetSong(_SongID); + if (song != null) + return song.GetVideo(); + else + { + _SongID = -1; + CLog.LogError("Song not found"); + } + } + return string.Empty; + } + } + + public string Title + { + get + { + if (_SongID >= 0) + { + CSong song = CSongs.GetSong(_SongID); + if (song != null) + return song.Title; + else + { + _SongID = -1; + CLog.LogError("Song not found"); + } + } + return "Unknown"; + } + } + + public string Artist + { + get + { + if (_SongID >= 0) + { + CSong song = CSongs.GetSong(_SongID); + if (song != null) + return song.Artist; + else + { + _SongID = -1; + CLog.LogError("Song not found"); + } + } + return "Unknown"; + } + } + + public STexture Cover + { + get + { + if (_SongID >= 0) + { + CSong song = CSongs.GetSong(_SongID); + if (song != null) + return song.CoverTextureSmall; + else + { + _SongID = -1; + CLog.LogError("Song not found"); + } + } + return CCover.NoCover; + } + } + + public float VideoGap + { + get + { + if (_SongID >= 0) + { + CSong song = CSongs.GetSong(_SongID); + if (song != null) + return song.VideoGap; + else + { + _SongID = -1; + CLog.LogError("Song not found"); + } + } + return 0; + } + } + + public bool Duet + { + get + { + if (_SongID >= 0) + { + CSong song = CSongs.GetSong(_SongID); + if (song != null) + return song.IsDuet; + else + { + _SongID = -1; + CLog.LogError("Song not found"); + } + } + return false; + } + } + + public PlaylistElement(CSong song) + { + MusicFilePath = string.Empty; + _SongID = song.ID; + } + + public PlaylistElement(string FilePath) + { + MusicFilePath = FilePath; + _SongID = -1; + } + + public PlaylistElement() + { + MusicFilePath = string.Empty; + _SongID = -1; } } diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 1aad119c..00ced7f0 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -66,6 +66,19 @@ namespace Vocaluxe.Base TR_CONFIG_LEVEL_MAX //all debug infos } + public enum EBufferSize + { + b0 = 0, + b512 = 512, + b1024 = 1024, + b1536 = 1536, + b2048 = 2048, + b2560 = 2560, + b3072 = 3072, + b3584 = 3584, + b4096 = 4096 + } + public enum EPlaybackLib { PortAudio, @@ -177,7 +190,8 @@ namespace Vocaluxe.Base // Sound public static EPlaybackLib PlayBackLib = EPlaybackLib.PortAudio; public static ERecordLib RecordLib = ERecordLib.PortAudio; - public static uint PortAudioBufferSize = 1024; + public static EBufferSize AudioBufferSize = EBufferSize.b2048; + public static int AudioLatency = 125; public static int BackgroundMusicVolume = 50; public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON; public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC; @@ -198,6 +212,7 @@ namespace Vocaluxe.Base public static EOffOn VideoBackgrounds = EOffOn.TR_CONFIG_ON; public static EOffOn VideoPreview = EOffOn.TR_CONFIG_ON; public static EOffOn VideosInSongs = EOffOn.TR_CONFIG_ON; + public static EOffOn VideosToBackground = EOffOn.TR_CONFIG_OFF; // Record public static SMicConfig[] MicConfig; @@ -286,6 +301,14 @@ namespace Vocaluxe.Base #region Sound CHelper.TryGetEnumValueFromXML("//root/Sound/PlayBackLib", navigator, ref PlayBackLib); CHelper.TryGetEnumValueFromXML("//root/Sound/RecordLib", navigator, ref RecordLib); + CHelper.TryGetEnumValueFromXML("//root/Sound/AudioBufferSize", navigator, ref AudioBufferSize); + + CHelper.TryGetIntValueFromXML("//root/Sound/AudioLatency", navigator, ref AudioLatency); + if (AudioLatency < -500) + AudioLatency = -500; + if (AudioLatency > 500) + AudioLatency = 500; + CHelper.TryGetEnumValueFromXML("//root/Sound/BackgroundMusic", navigator, ref BackgroundMusic); CHelper.TryGetIntValueFromXML("//root/Sound/BackgroundMusicVolume", navigator, ref BackgroundMusicVolume); CHelper.TryGetEnumValueFromXML("//root/Sound/BackgroundMusicSource", navigator, ref BackgroundMusicSource); @@ -349,6 +372,7 @@ namespace Vocaluxe.Base CHelper.TryGetEnumValueFromXML("//root/Video/VideoBackgrounds", navigator, ref VideoBackgrounds); CHelper.TryGetEnumValueFromXML("//root/Video/VideoPreview", navigator, ref VideoPreview); CHelper.TryGetEnumValueFromXML("//root/Video/VideosInSongs", navigator, ref VideosInSongs); + CHelper.TryGetEnumValueFromXML("//root/Video/VideosToBackground", navigator, ref VideosToBackground); #endregion Video #region Record @@ -480,8 +504,14 @@ namespace Vocaluxe.Base writer.WriteComment("RecordLib: " + ListStrings(Enum.GetNames(typeof(ERecordLib)))); writer.WriteElementString("RecordLib", Enum.GetName(typeof(ERecordLib), RecordLib)); + writer.WriteComment("AudioBufferSize: " + ListStrings(Enum.GetNames(typeof(EBufferSize)))); + writer.WriteElementString("AudioBufferSize", Enum.GetName(typeof(EBufferSize), AudioBufferSize)); + + writer.WriteComment("AudioLatency from -500 to 500 ms"); + writer.WriteElementString("AudioLatency", AudioLatency.ToString()); + writer.WriteComment("Background Music"); - writer.WriteElementString("BackgroundMusicEnabled", Enum.GetName(typeof(EOffOn), BackgroundMusic)); + writer.WriteElementString("BackgroundMusic", Enum.GetName(typeof(EOffOn), BackgroundMusic)); writer.WriteComment("Background Music Volume from 0 to 100"); writer.WriteElementString("BackgroundMusicVolume", BackgroundMusicVolume.ToString()); @@ -558,6 +588,9 @@ namespace Vocaluxe.Base writer.WriteComment("Show Videos while singing: " + ListStrings(Enum.GetNames(typeof(EOffOn)))); writer.WriteElementString("VideosInSongs", Enum.GetName(typeof(EOffOn), VideosInSongs)); + writer.WriteComment("Show backgroundmusic videos as background: " + ListStrings(Enum.GetNames(typeof(EOffOn)))); + writer.WriteElementString("VideosToBackground", Enum.GetName(typeof(EOffOn), VideosToBackground)); + writer.WriteEndElement(); #endregion Video diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 90b52a93..15c6f6f2 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -27,21 +27,59 @@ namespace Vocaluxe.Base private static string _HighscoreFilePath; private static string _CoverFilePath; + private static string _CreditsRessourcesFilePath; public static void Init() { _HighscoreFilePath = Path.Combine(System.Environment.CurrentDirectory, CSettings.sFileHighscoreDB); _CoverFilePath = Path.Combine(System.Environment.CurrentDirectory, CSettings.sFileCoverDB); + _CreditsRessourcesFilePath = Path.Combine(System.Environment.CurrentDirectory, CSettings.sFileCreditsRessourcesDB); InitHighscoreDB(); InitCoverDB(); + InitCreditsRessourcesDB(); } #region Highscores + public static int AddScore(string PlayerName, int Score, int LineNr, long Date, int Medley, int Duet, int Diff, + string Artist, string Title, int NumPlayed, string FilePath) + { + SPlayer player = new SPlayer(); + player.Name = PlayerName; + player.Points = Score; + player.LineNr = LineNr; + player.DateTicks = Date; + player.Medley = (Medley == 1); + player.Duet = (Duet == 1); + player.Difficulty = (EGameDifficulty)Diff; + + SQLiteConnection connection = new SQLiteConnection(); + connection.ConnectionString = "Data Source=" + FilePath; + SQLiteCommand command; + + try + { + connection.Open(); + } + catch (Exception) + { + return -1; + } + + command = new SQLiteCommand(connection); + + int DataBaseSongID = GetDataBaseSongID(Artist, Title, NumPlayed, command); + int result = AddScore(player, command, DataBaseSongID); + + command.Dispose(); + connection.Close(); + connection.Dispose(); + + return result; + } + public static int AddScore(SPlayer player) { - int lastInsertID = -1; - SQLiteConnection connection = new SQLiteConnection(); connection.ConnectionString = "Data Source=" + _HighscoreFilePath; SQLiteCommand command; @@ -58,6 +96,18 @@ namespace Vocaluxe.Base command = new SQLiteCommand(connection); int DataBaseSongID = GetDataBaseSongID(player, command); + int result = AddScore(player, command, DataBaseSongID); + + connection.Close(); + connection.Dispose(); + + return result; + } + + private static int AddScore(SPlayer player, SQLiteCommand command, int DataBaseSongID) + { + int lastInsertID = -1; + if (DataBaseSongID >= 0) { @@ -68,7 +118,38 @@ namespace Vocaluxe.Base int Duet = 0; if (player.Duet) Duet = 1; - + + command.CommandText = "SELECT id FROM Scores WHERE SongID = @SongID AND PlayerName = @PlayerName AND Score = @Score AND " + + "LineNr = @LineNr AND Date = @Date AND Medley = @Medley AND Duet = @Duet AND Difficulty = @Difficulty"; + command.Parameters.Add("@SongID", System.Data.DbType.Int32, 0).Value = DataBaseSongID; + command.Parameters.Add("@PlayerName", System.Data.DbType.String, 0).Value = player.Name; + command.Parameters.Add("@Score", System.Data.DbType.Int32, 0).Value = (int)Math.Round(player.Points); + command.Parameters.Add("@LineNr", System.Data.DbType.Int32, 0).Value = (int)player.LineNr; + command.Parameters.Add("@Date", System.Data.DbType.Int64, 0).Value = player.DateTicks; + command.Parameters.Add("@Medley", System.Data.DbType.Int32, 0).Value = Medley; + command.Parameters.Add("@Duet", System.Data.DbType.Int32, 0).Value = Duet; + command.Parameters.Add("@Difficulty", System.Data.DbType.Int32, 0).Value = (int)player.Difficulty; + + SQLiteDataReader reader = null; + try + { + reader = command.ExecuteReader(); + } + catch (Exception) + { + ; + } + + if (reader != null && reader.HasRows) + { + if (reader.Read()) + return reader.GetInt32(0); + } + + if (reader != null) + reader.Close(); + + command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) " + "VALUES (@SongID, @PlayerName, @Score, @LineNr, @Date, @Medley, @Duet, @Difficulty)"; command.Parameters.Add("@SongID", System.Data.DbType.Int32, 0).Value = DataBaseSongID; @@ -84,7 +165,7 @@ namespace Vocaluxe.Base //Read last insert line command.CommandText = "SELECT id FROM Scores ORDER BY Date DESC LIMIT 0, 1"; - SQLiteDataReader reader = null; + reader = null; try { reader = command.ExecuteReader(); @@ -106,10 +187,6 @@ namespace Vocaluxe.Base } } - command.Dispose(); - connection.Close(); - connection.Dispose(); - return lastInsertID; } @@ -120,7 +197,7 @@ namespace Vocaluxe.Base SQLiteCommand command; Score = new List(); - + try { connection.Open(); @@ -149,7 +226,7 @@ namespace Vocaluxe.Base command.Parameters.Add("@SongID", System.Data.DbType.Int32, 0).Value = DataBaseSongID; command.Parameters.Add("@Medley", System.Data.DbType.Int32, 0).Value = Medley; command.Parameters.Add("@Duet", System.Data.DbType.Int32, 0).Value = Duet; - + SQLiteDataReader reader = null; try { @@ -174,13 +251,13 @@ namespace Vocaluxe.Base Score.Add(score); } - + reader.Close(); - reader.Dispose(); + reader.Dispose(); } - + } - + command.Dispose(); connection.Close(); @@ -194,9 +271,38 @@ namespace Vocaluxe.Base if (song == null) return -1; + return GetDataBaseSongID(song.Artist, song.Title, 0, command); + } + + private static int GetDataBaseSongID(string Artist, string Title, string FilePath, int DefNumPlayed) + { + SQLiteConnection connection = new SQLiteConnection(); + connection.ConnectionString = "Data Source=" + FilePath; + SQLiteCommand command; + + try + { + connection.Open(); + } + catch (Exception) + { + return -1; + } + + command = new SQLiteCommand(connection); + int id = GetDataBaseSongID(Artist, Title, DefNumPlayed, command); + command.Dispose(); + connection.Close(); + connection.Dispose(); + + return id; + } + + private static int GetDataBaseSongID(string Artist, string Title, int DefNumPlayed, SQLiteCommand command) + { command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist"; - command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = song.Title; - command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = song.Artist; + command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = Title; + command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = Artist; SQLiteDataReader reader = null; try @@ -222,14 +328,15 @@ namespace Vocaluxe.Base reader.Close(); command.CommandText = "INSERT INTO Songs (Title, Artist, NumPlayed) " + - "VALUES (@title, @artist, 0)"; - command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = song.Title; - command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = song.Artist; + "VALUES (@title, @artist, @numplayed)"; + command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = Title; + command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = Artist; + command.Parameters.Add("@numplayed", System.Data.DbType.Int32, 0).Value = DefNumPlayed; command.ExecuteNonQuery(); command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist"; - command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = song.Title; - command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = song.Artist; + command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = Title; + command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = Artist; reader = null; try @@ -256,14 +363,140 @@ namespace Vocaluxe.Base reader.Close(); reader.Dispose(); } - + return -1; } - private static bool InitHighscoreDB() + private static bool GetDataBaseSongInfos(int SongID, out string Artist, out string Title, out int NumPlayed, string FilePath) + { + Artist = String.Empty; + Title = String.Empty; + NumPlayed = 0; + + SQLiteConnection connection = new SQLiteConnection(); + connection.ConnectionString = "Data Source=" + FilePath; + SQLiteCommand command; + + try + { + connection.Open(); + } + catch (Exception) + { + return false; + } + + command = new SQLiteCommand(connection); + command.CommandText = "SELECT Artist, Title, NumPlayed FROM Songs WHERE [id] = @id"; + command.Parameters.Add("@id", System.Data.DbType.String, 0).Value = SongID; + + SQLiteDataReader reader = null; + try + { + reader = command.ExecuteReader(); + } + catch (Exception) + { + return false; + } + + if (reader != null && reader.HasRows) + { + reader.Read(); + Artist = reader.GetString(0); + Title = reader.GetString(1); + NumPlayed = reader.GetInt32(2); + reader.Close(); + reader.Dispose(); + + command.Dispose(); + connection.Close(); + connection.Dispose(); + return true; + } + else + { + if (reader != null) + reader.Close(); + } + + command.Dispose(); + connection.Close(); + connection.Dispose(); + + return false; + } + + private static void InitHighscoreDB() + { + string OldDBFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileOldHighscoreDB); + if (File.Exists(OldDBFilePath)) + { + if (File.Exists(_HighscoreFilePath)) + { + CreateOrConvert(OldDBFilePath); + CreateOrConvert(_HighscoreFilePath); + ImportData(OldDBFilePath, _HighscoreFilePath); + + File.Delete(OldDBFilePath); + } + else + { + File.Copy(OldDBFilePath, _HighscoreFilePath); + CreateOrConvert(_HighscoreFilePath); + File.Delete(OldDBFilePath); + } + } + else + CreateOrConvert(_HighscoreFilePath); + } + + private static void CreateHighscoreDB(string FilePath) { SQLiteConnection connection = new SQLiteConnection(); - connection.ConnectionString = "Data Source=" + _HighscoreFilePath; + connection.ConnectionString = "Data Source=" + FilePath; + SQLiteCommand command; + + try + { + connection.Open(); + } + catch (Exception) + { + return; + } + + command = new SQLiteCommand(connection); + + command.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);"; + command.ExecuteNonQuery(); + + command.CommandText = "INSERT INTO Version (id, Value) VALUES(NULL, " + CSettings.iDatabaseHighscoreVersion.ToString() + ")"; + command.ExecuteNonQuery(); + + command.CommandText = "CREATE TABLE IF NOT EXISTS Songs ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + + "Artist TEXT NOT NULL, Title TEXT NOT NULL, NumPlayed INTEGER);"; + command.ExecuteNonQuery(); + + command.CommandText = "CREATE TABLE IF NOT EXISTS Scores ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + + "SongID INTEGER NOT NULL, PlayerName TEXT NOT NULL, Score INTEGER NOT NULL, LineNr INTEGER NOT NULL, Date BIGINT NOT NULL, " + + "Medley INTEGER NOT NULL, Duet INTEGER NOT NULL, Difficulty INTEGER NOT NULL);"; + command.ExecuteNonQuery(); + + command.Dispose(); + connection.Close(); + connection.Dispose(); + } + + /// + /// Creates a new Vocaluxe Database if no file exists. Converts an existing old Ultrastar Deluxe highscore database into vocaluxe format. + /// + /// Database file path + /// + private static bool CreateOrConvert(string FilePath) + { + SQLiteConnection connection = new SQLiteConnection(); + connection.ConnectionString = "Data Source=" + FilePath; SQLiteCommand command; try @@ -292,12 +525,12 @@ namespace Vocaluxe.Base if (reader == null) { // create new database/tables - CreateHighscoreDB(); + CreateHighscoreDB(FilePath); } else if (reader.FieldCount == 0) { // create new database/tables - CreateHighscoreDB(); + CreateHighscoreDB(FilePath); } else { @@ -335,10 +568,10 @@ namespace Vocaluxe.Base //Check for USDX 1.1 DB if (version == 1) - ConvertFrom110(); + ConvertFrom110(FilePath); //Check for USDX 1.01 or CMD Mod DB else if (version == 0 && scoresTableExists) - ConvertFrom101(); + ConvertFrom101(FilePath); command.Dispose(); @@ -348,61 +581,15 @@ namespace Vocaluxe.Base return true; } - private static void CreateHighscoreDB() - { - SQLiteConnection connection = new SQLiteConnection(); - connection.ConnectionString = "Data Source=" + _HighscoreFilePath; - SQLiteCommand command; - - try - { - connection.Open(); - } - catch (Exception) - { - return; - } - - command = new SQLiteCommand(connection); - - command.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);"; - command.ExecuteNonQuery(); - - command.CommandText = "INSERT INTO Version (id, Value) VALUES(NULL, " + CSettings.iDatabaseHighscoreVersion.ToString() + ")"; - command.ExecuteNonQuery(); - - command.CommandText = "CREATE TABLE IF NOT EXISTS Songs ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + - "Artist TEXT NOT NULL, Title TEXT NOT NULL, NumPlayed INTEGER);"; - command.ExecuteNonQuery(); - - command.CommandText = "CREATE TABLE IF NOT EXISTS Scores ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + - "SongID INTEGER NOT NULL, PlayerName TEXT NOT NULL, Score INTEGER NOT NULL, LineNr INTEGER NOT NULL, Date BIGINT NOT NULL, " + - "Medley INTEGER NOT NULL, Duet INTEGER NOT NULL, Difficulty INTEGER NOT NULL);"; - command.ExecuteNonQuery(); - - command.Dispose(); - connection.Close(); - connection.Dispose(); - - /* - // Auslesen des zuletzt eingefügten Datensatzes. - command.CommandText = "SELECT id, name FROM beispiel ORDER BY id DESC LIMIT 0, 1"; - - while (reader.Read()) - { - Console.WriteLine("Dies ist der {0}. eingefügte Datensatz mit dem Wert: \"{1}\"", reader[0].ToString(), reader[1].ToString()); - } - */ - } - /// /// Converts a USDX 1.1 database into the Vocaluxe format /// + /// Database file path /// True if succeeded - private static bool ConvertFrom110() + private static bool ConvertFrom110(string FilePath) { SQLiteConnection connection = new SQLiteConnection(); - connection.ConnectionString = "Data Source=" + _HighscoreFilePath; + connection.ConnectionString = "Data Source=" + FilePath; SQLiteCommand command; try @@ -495,7 +682,7 @@ namespace Vocaluxe.Base command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id; command.ExecuteNonQuery(); } - + //Delete old tables after conversion command.CommandText = "DROP TABLE US_Scores;"; command.ExecuteNonQuery(); @@ -520,11 +707,12 @@ namespace Vocaluxe.Base /// /// Converts a USDX 1.01 or CMD 1.01 database to Vocaluxe format /// + /// Database file path /// True if succeeded - private static bool ConvertFrom101() + private static bool ConvertFrom101(string FilePath) { SQLiteConnection connection = new SQLiteConnection(); - connection.ConnectionString = "Data Source=" + _HighscoreFilePath; + connection.ConnectionString = "Data Source=" + FilePath; SQLiteCommand command; SQLiteDataReader reader = null; @@ -541,7 +729,7 @@ namespace Vocaluxe.Base command.CommandText = "PRAGMA table_info(US_Scores);"; reader = command.ExecuteReader(); - + bool dateExists = false; @@ -558,12 +746,12 @@ namespace Vocaluxe.Base } } } - + reader.Close(); //This is a USDX 1.01 DB - if(!dateExists) + if (!dateExists) command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', '0', '0', '0', Difficulty from US_Scores"; else // This is a CMD 1.01 DB command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores"; @@ -577,11 +765,11 @@ namespace Vocaluxe.Base List songs = new List(); Sqlite3.sqlite3 OldDB; - int res = Sqlite3.sqlite3_open(_HighscoreFilePath, out OldDB); + int res = Sqlite3.sqlite3_open(FilePath, out OldDB); if (res != Sqlite3.SQLITE_OK) { - CLog.LogError("Error opening Database: " + _HighscoreFilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")"); + CLog.LogError("Error opening Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")"); } else { @@ -590,11 +778,11 @@ namespace Vocaluxe.Base if (res != Sqlite3.SQLITE_OK) { - CLog.LogError("Error query Database: " + _HighscoreFilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")"); + CLog.LogError("Error query Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")"); } else { - Sqlite3.sqlite3_step(Stmt); + //Sqlite3.sqlite3_step(Stmt); Encoding UTF8 = Encoding.UTF8; Encoding CP1252 = Encoding.GetEncoding(1252); @@ -605,9 +793,9 @@ namespace Vocaluxe.Base data.id = Sqlite3.sqlite3_column_int(Stmt, 0); - byte[] bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 1); + byte[] bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 1); data.str1 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes)); - + bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 2); data.str2 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes)); @@ -617,7 +805,7 @@ namespace Vocaluxe.Base } Stmt = new Sqlite3.Vdbe(); - + if (!dateExists) res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT rowid, Player FROM US_Scores", -1, ref Stmt, 0); else @@ -625,11 +813,11 @@ namespace Vocaluxe.Base if (res != Sqlite3.SQLITE_OK) { - CLog.LogError("Error query Database: " + _HighscoreFilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")"); + CLog.LogError("Error query Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")"); } else { - Sqlite3.sqlite3_step(Stmt); + //Sqlite3.sqlite3_step(Stmt); Encoding UTF8 = Encoding.UTF8; Encoding CP1252 = Encoding.GetEncoding(1252); @@ -645,7 +833,7 @@ namespace Vocaluxe.Base if (dateExists) data.ticks = UnixTimeToTicks(Sqlite3.sqlite3_column_int(Stmt, 2)); - + scores.Add(data); } Sqlite3.sqlite3_finalize(Stmt); @@ -678,14 +866,14 @@ namespace Vocaluxe.Base command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id; command.ExecuteNonQuery(); } - + //Delete old tables after conversion command.CommandText = "DROP TABLE US_Scores;"; command.ExecuteNonQuery(); command.CommandText = "DROP TABLE US_Songs;"; command.ExecuteNonQuery(); - + reader.Dispose(); command.Dispose(); connection.Close(); @@ -693,6 +881,71 @@ namespace Vocaluxe.Base return true; } + + private static bool ImportData(string SourceDBPath, string DestinationDBPath) + { + #region open db + SQLiteConnection connSource = new SQLiteConnection(); + connSource.ConnectionString = "Data Source=" + SourceDBPath; + + try + { + connSource.Open(); + } + catch (Exception e) + { + CLog.LogError("Error on import high score data. Can't open source database \"" + SourceDBPath + "\" (" + e.Message + ")"); + return false; + } + #endregion open db + + SQLiteCommand cmdSource = new SQLiteCommand(connSource); + SQLiteDataReader rSource; + + #region import table scores + cmdSource.CommandText = "SELECT SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty FROM Scores"; + rSource = cmdSource.ExecuteReader(); + if (rSource == null) + { + cmdSource.Dispose(); + connSource.Close(); + return false; + } + + if (rSource.FieldCount == 0) + { + rSource.Close(); + cmdSource.Dispose(); + connSource.Close(); + return true; + } + + while (rSource.Read()) + { + int songid = rSource.GetInt32(0); + string player = rSource.GetString(1); + int score = rSource.GetInt32(2); + int linenr = rSource.GetInt32(3); + long date = rSource.GetInt64(4); + int medley = rSource.GetInt32(5); + int duet = rSource.GetInt32(6); + int diff = rSource.GetInt32(7); + + string artist, title; + int numplayed; + if (GetDataBaseSongInfos(songid, out artist, out title, out numplayed, SourceDBPath)) + { + AddScore(player, score, linenr, date, medley, duet, diff, artist, title, numplayed, _HighscoreFilePath); + } + } + #endregion import table scores + + rSource.Close(); + cmdSource.Dispose(); + connSource.Close(); + + return true; + } #endregion Highscores #region Cover @@ -784,7 +1037,7 @@ namespace Vocaluxe.Base return false; } - + int w = MaxSize; int h = MaxSize; @@ -801,7 +1054,7 @@ namespace Vocaluxe.Base byte[] data = new byte[w * h * 4]; BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - Marshal.Copy(bmp_data.Scan0, data, 0, w*h*4); + Marshal.Copy(bmp_data.Scan0, data, 0, w * h * 4); bmp.UnlockBits(bmp_data); bmp.Dispose(); @@ -947,6 +1200,273 @@ namespace Vocaluxe.Base } #endregion Cover + #region CreditsRessources + public static bool GetCreditsRessource(string FileName, ref STexture tex) + { + bool result = false; + + SQLiteConnection connection = new SQLiteConnection(); + connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath; + SQLiteCommand command; + try + { + connection.Open(); + } + catch (Exception) + { + return false; + } + command = new SQLiteCommand(connection); + + command.CommandText = "SELECT id, width, height FROM Images WHERE [Path] = @path"; + command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = FileName; + + SQLiteDataReader reader = null; + try + { + reader = command.ExecuteReader(); + } + catch (Exception) + { + throw; + } + + if (reader != null && reader.HasRows) + { + reader.Read(); + int id = reader.GetInt32(0); + int w = reader.GetInt32(1); + int h = reader.GetInt32(2); + reader.Close(); + + command.CommandText = "SELECT Data FROM ImageData WHERE ImageID = " + id.ToString(); + try + { + reader = command.ExecuteReader(); + } + catch (Exception) + { + throw; + } + + if (reader.HasRows) + { + result = true; + reader.Read(); + byte[] data = GetBytes(reader); + tex = CDraw.AddTexture(w, h, ref data); + } + } + + if (reader != null) + { + reader.Close(); + reader.Dispose(); + } + command.Dispose(); + connection.Close(); + connection.Dispose(); + + return result; + } + + //If you want to add an image to db, call this method! + private static bool AddImageToCreditsDB(String ImagePath) + { + bool result = false; + STexture tex; + + if (File.Exists(ImagePath)) + { + + SQLiteConnection connection = new SQLiteConnection(); + connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath; + SQLiteCommand command; + try + { + connection.Open(); + } + catch (Exception) + { + return false; + } + command = new SQLiteCommand(connection); + + SQLiteDataReader reader = null; + + if (reader != null) + reader.Close(); + + Bitmap origin; + try + { + origin = new Bitmap(ImagePath); + } + catch (Exception) + { + CLog.LogError("Error loading Texture: " + ImagePath); + tex = new STexture(-1); + + if (reader != null) + { + reader.Close(); + reader.Dispose(); + } + command.Dispose(); + connection.Close(); + connection.Dispose(); + + return false; + } + + int w = origin.Width; + int h = origin.Height; + + Bitmap bmp = new Bitmap(w, h); + Graphics g = Graphics.FromImage(bmp); + g.DrawImage(origin, new Rectangle(0, 0, w, h)); + g.Dispose(); + tex = CDraw.AddTexture(bmp); + byte[] data = new byte[w * h * 4]; + + BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + Marshal.Copy(bmp_data.Scan0, data, 0, w * h * 4); + bmp.UnlockBits(bmp_data); + bmp.Dispose(); + + command.CommandText = "INSERT INTO Images (Path, width, height) " + + "VALUES (@path, " + w.ToString() + ", " + h.ToString() + ")"; + command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = Path.GetFileName(ImagePath); + command.ExecuteNonQuery(); + + command.CommandText = "SELECT id FROM Images WHERE [Path] = @path"; + command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = Path.GetFileName(ImagePath); + reader = null; + try + { + reader = command.ExecuteReader(); + } + catch (Exception) + { + throw; + } + + if (reader != null) + { + reader.Read(); + int id = reader.GetInt32(0); + reader.Close(); + command.CommandText = "INSERT INTO ImageData (ImageID, Data) " + + "VALUES ('" + id.ToString() + "', @data)"; + command.Parameters.Add("@data", System.Data.DbType.Binary, 20).Value = data; + command.ExecuteReader(); + result = true; + } + } + + return result; + } + + private static bool InitCreditsRessourcesDB() + { + SQLiteConnection connection = new SQLiteConnection(); + connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath; + SQLiteCommand command; + + try + { + connection.Open(); + } + catch (Exception) + { + return false; + } + + command = new SQLiteCommand(connection); + command.CommandText = "SELECT Value FROM Version"; + + SQLiteDataReader reader = null; + + try + { + reader = command.ExecuteReader(); + } + catch (Exception) + { + ; + } + + if (reader == null) + { + // Log error + CLog.LogError("Can't find Credits-DB!"); + } + else if (reader.FieldCount == 0) + { + // Log error + CLog.LogError("Can't find Credits-DB! Field-Count = 0"); + } + else + { + reader.Read(); + + if (reader.GetInt32(0) < CSettings.iDatabaseHighscoreVersion) + { + // update database + } + } + + if (reader != null) + { + reader.Close(); + reader.Dispose(); + } + + command.Dispose(); + + connection.Close(); + connection.Dispose(); + + return true; + } + + private static void CreateCreditsRessourcesDB() + { + SQLiteConnection connection = new SQLiteConnection(); + connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath; + SQLiteCommand command; + + try + { + connection.Open(); + } + catch (Exception) + { + return; + } + + command = new SQLiteCommand(connection); + + command.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);"; + command.ExecuteNonQuery(); + + command.CommandText = "INSERT INTO Version (id, Value) VALUES(NULL, " + CSettings.iDatabaseCreditsRessourcesVersion.ToString() + ")"; + command.ExecuteNonQuery(); + + command.CommandText = "CREATE TABLE IF NOT EXISTS Images ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + + "Path TEXT NOT NULL, width INTEGER NOT NULL, height INTEGER NOT NULL);"; + command.ExecuteNonQuery(); + + command.CommandText = "CREATE TABLE IF NOT EXISTS ImageData ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + + "ImageID INTEGER NOT NULL, Data BLOB NOT NULL);"; + command.ExecuteNonQuery(); + + command.Dispose(); + connection.Close(); + connection.Dispose(); + } + #endregion CreditsRessources + private static byte[] GetBytes(SQLiteDataReader reader) { const int CHUNK_SIZE = 2 * 1024; @@ -973,4 +1493,4 @@ namespace Vocaluxe.Base return t70.Ticks; } } -} +} \ No newline at end of file diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index 514d3adc..6b00f4b9 100644 --- a/Vocaluxe/Base/CDraw.cs +++ b/Vocaluxe/Base/CDraw.cs @@ -289,6 +289,19 @@ namespace Vocaluxe.Base } } + public static void DrawTexture(CStatic StaticBounds, STexture Texture, EAspect Aspect) + { + RectangleF bounds = new RectangleF(StaticBounds.Rect.X, StaticBounds.Rect.Y, StaticBounds.Rect.W, StaticBounds.Rect.H); + RectangleF rect = new RectangleF(0f, 0f, Texture.width, Texture.height); + + if (rect.Height <= 0f) + return; + + CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, Aspect); + DrawTexture(Texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, StaticBounds.Rect.Z), + Texture.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); + } + public static void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { lock (mutex) @@ -319,6 +332,7 @@ namespace Vocaluxe.Base { #region private vars private string _TextureName; + private STexture _Texture; private SRectF _Rect; private float _Size; private SColorF _Color; @@ -333,7 +347,7 @@ namespace Vocaluxe.Base private float _Vsize; //size changing speed: period [s] private float _LastTime; private EParticeType _Type; - + private Stopwatch _Timer; #endregion private vars @@ -386,6 +400,7 @@ namespace Vocaluxe.Base public CParticle(string textureName, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize, EParticeType type) { _TextureName = textureName; + _Texture = new STexture(-1); _Color = color; _Rect = new SRectF(x, y, size, size, z); _Size = size; @@ -403,6 +418,29 @@ namespace Vocaluxe.Base _MaxAge = maxage; _Rotation = (float)(CGame.Rand.NextDouble() * 360.0); } + + public CParticle(STexture texture, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize, EParticeType type) + { + _TextureName = String.Empty; + _Texture = texture; + _Color = color; + _Rect = new SRectF(x, y, size, size, z); + _Size = size; + _Alpha = 1f; + _Angle = 0f; + _Vx = vx; + _Vy = vy; + _Vr = vr; + _Vsize = vsize; + _LastTime = 0f; + _Type = type; + + _Timer = new Stopwatch(); + _Age = 0f; + _MaxAge = maxage; + _Rotation = (float)(CGame.Rand.NextDouble() * 360.0); + } + #endregion Constructors public void Update() @@ -553,7 +591,10 @@ namespace Vocaluxe.Base public void Draw() { - CDraw.DrawTexture(CTheme.GetSkinTexture(_TextureName), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); + if (_TextureName != String.Empty) + CDraw.DrawTexture(CTheme.GetSkinTexture(_TextureName), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); + else + CDraw.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); } } @@ -561,6 +602,7 @@ namespace Vocaluxe.Base { private List _Stars; private string _TextureName; + private STexture _Texture; private int _MaxNumber; private SRectF _Area; private SColorF _Color; @@ -579,12 +621,33 @@ namespace Vocaluxe.Base } } + public SRectF Area + { + get { return _Area; } + set { _Area = value; } + } + public CParticleEffect(int MaxNumber, SColorF Color, SRectF Area, string TextureName, float Size, EParticeType Type) { _Stars = new List(); _Area = Area; _Color = Color; _TextureName = TextureName; + _Texture = new STexture(-1); + _MaxNumber = MaxNumber; + _Size = Size; + _Type = Type; + _SpawnTimer = new Stopwatch(); + _NextSpawnTime = 0f; + } + + public CParticleEffect(int MaxNumber, SColorF Color, SRectF Area, STexture texture, float Size, EParticeType Type) + { + _Stars = new List(); + _Area = Area; + _Color = Color; + _TextureName = String.Empty; + _Texture = texture; _MaxNumber = MaxNumber; _Size = Size; _Type = Type; @@ -682,10 +745,21 @@ namespace Vocaluxe.Base if (h < 0) h = 0; - CParticle star = new CParticle(_TextureName, _Color, - CGame.Rand.Next(w) + _Area.X - size / 4f, - CGame.Rand.Next(h) + _Area.Y - size / 4f, - size, lifetime, _Area.Z, vx, vy, vr, vsize, _Type); + CParticle star; + if (_TextureName != String.Empty) + { + star = new CParticle(_TextureName, _Color, + CGame.Rand.Next(w) + _Area.X - size / 4f, + CGame.Rand.Next(h) + _Area.Y - size / 4f, + size, lifetime, _Area.Z, vx, vy, vr, vsize, _Type); + } + else + { + star = new CParticle(_Texture, _Color, + CGame.Rand.Next(w) + _Area.X - size / 4f, + CGame.Rand.Next(h) + _Area.Y - size / 4f, + size, lifetime, _Area.Z, vx, vy, vr, vsize, _Type); + } _Stars.Add(star); } diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index 9841e1dd..16eb4208 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Drawing; +using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing.Text; using System.IO; @@ -38,6 +39,7 @@ namespace Vocaluxe.Base public CGlyph(char chr) { + float outline = CFonts.Outline; TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix; float factor = GetFactor(chr, flags); @@ -53,19 +55,53 @@ namespace Vocaluxe.Base g.Dispose(); bmp.Dispose(); - bmp = new Bitmap((int)(sizeB.Width * 1.5f), sizeB.Height); + bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height); g = System.Drawing.Graphics.FromImage(bmp); g.Clear(System.Drawing.Color.Transparent); + g.SmoothingMode = SmoothingMode.AntiAlias; + g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; CFonts.Height = SIZEh; fo = CFonts.GetFont(); - g.DrawString(chr.ToString(), fo, Brushes.White, new PointF((sizeB.Width - size.Width) / 2f, (sizeB.Height - size.Height - (size.Height + SIZEh/4f) * (1f - factor)) / 2f)); + + PointF point = new PointF( + outline * Math.Abs(sizeB.Width - size.Width) + (sizeB.Width - size.Width) / 2f + SIZEh / 5f, + (sizeB.Height - size.Height - (size.Height + SIZEh/4f) * (1f - factor)) / 2f); + + GraphicsPath path = new GraphicsPath(); + path.AddString( + chr.ToString(), + fo.FontFamily, + (int)fo.Style, + SIZEh, + point, + new StringFormat()); + + Pen pen = new Pen( + Color.FromArgb( + (int)CFonts.OutlineColor.A * 255, + (int)CFonts.OutlineColor.R * 255, + (int)CFonts.OutlineColor.G * 255, + (int)CFonts.OutlineColor.B * 255), + SIZEh * outline); + + pen.LineJoin = LineJoin.Round; + g.DrawPath(pen, path); + g.FillPath(Brushes.White, path); + + /* + g.DrawString( + chr.ToString(), + fo, + Brushes.White, + point); + * */ Texture = CDraw.AddTexture(bmp); - + //bmp.Save("test.png", ImageFormat.Png); Chr = chr; - width = (int)(sizeB.Width * Texture.width/factor / bmp.Width); + width = (int)((1f + outline / 2f) * sizeB.Width * Texture.width/factor / bmp.Width); bmp.Dispose(); g.Dispose(); @@ -146,7 +182,8 @@ namespace Vocaluxe.Base CFonts.Height = h; CGlyph glyph = _Glyphs[(int)_htGlyphs[chr]]; float factor = h / glyph.Texture.height; - CDraw.DrawTexture(glyph.Texture, new SRectF(x, y, glyph.Texture.width * factor, h, z), color); + float d = glyph.SIZEh / 5f * factor; + CDraw.DrawTexture(glyph.Texture, new SRectF(x - d, y, glyph.Texture.width * factor, h, z), color); } public void DrawGlyphReflection(char chr, float x, float y, float h, float z, SColorF color, float rspace, float rheight) @@ -156,7 +193,8 @@ namespace Vocaluxe.Base CFonts.Height = h; CGlyph glyph = _Glyphs[(int)_htGlyphs[chr]]; float factor = h / glyph.Texture.height; - SRectF rect = new SRectF(x, y, glyph.Texture.width * factor, h, z); + float d = glyph.SIZEh / 5f * factor; + SRectF rect = new SRectF(x - d, y, glyph.Texture.width * factor, h, z); CDraw.DrawTextureReflection(glyph.Texture, rect, color, rect, rspace, rheight); } @@ -168,8 +206,9 @@ namespace Vocaluxe.Base CGlyph glyph = _Glyphs[(int)_htGlyphs[chr]]; float factor = h / glyph.Texture.height; float width = glyph.Texture.width * factor; - - CDraw.DrawTexture(glyph.Texture, new SRectF(x, y, width, h, z), color, begin, end); + float d = glyph.SIZEh / 5f * factor; + + CDraw.DrawTexture(glyph.Texture, new SRectF(x - d, y, width, h, z), color, begin, end); } public float GetWidth(char chr) @@ -215,6 +254,9 @@ namespace Vocaluxe.Base public string FileBold; public string FileBoldItalic; + public float Outline; //0..1, 0=not outline 1=100% outline + public SColorF OutlineColor; + public CFont Normal; public CFont Italic; public CFont Bold; @@ -252,6 +294,30 @@ namespace Vocaluxe.Base } } + public static float Outline + { + get { return _Fonts[_CurrentFont].Outline; } + set + { + SFont font = _Fonts[_CurrentFont]; + font.Outline = value; + if (font.Outline < 0f) + font.Outline = 0f; + if (font.Outline > 1f) + font.Outline = 1f; + } + } + + public static SColorF OutlineColor + { + get { return _Fonts[_CurrentFont].OutlineColor; } + set + { + SFont font = _Fonts[_CurrentFont]; + font.OutlineColor = value; + } + } + public static void Init() { _settings.Indent = true; @@ -610,6 +676,15 @@ namespace Vocaluxe.Base f = new CFont(value); sf.BoldItalic = f; + sf.Outline = 0f; + CHelper.TryGetFloatValueFromXML("//root/Font" + i.ToString() + "/Outline", navigator, ref sf.Outline); + + sf.OutlineColor = new SColorF(0f, 0f, 0f, 1f); + CHelper.TryGetFloatValueFromXML("//root/Font" + i.ToString() + "/OutlineColorR", navigator, ref sf.OutlineColor.R); + CHelper.TryGetFloatValueFromXML("//root/Font" + i.ToString() + "/OutlineColorG", navigator, ref sf.OutlineColor.G); + CHelper.TryGetFloatValueFromXML("//root/Font" + i.ToString() + "/OutlineColorB", navigator, ref sf.OutlineColor.B); + CHelper.TryGetFloatValueFromXML("//root/Font" + i.ToString() + "/OutlineColorA", navigator, ref sf.OutlineColor.A); + _Fonts.Add(sf); i++; } @@ -662,6 +737,15 @@ namespace Vocaluxe.Base f = new CFont(value); sf.BoldItalic = f; + sf.Outline = 0f; + ok &= CHelper.TryGetFloatValueFromXML("//root/Fonts/Font" + i.ToString() + "/Outline", navigator, ref sf.Outline); + + sf.OutlineColor = new SColorF(0f, 0f, 0f, 1f); + ok &= CHelper.TryGetFloatValueFromXML("//root/Fonts/Font" + i.ToString() + "/OutlineColorR", navigator, ref sf.OutlineColor.R); + ok &= CHelper.TryGetFloatValueFromXML("//root/Fonts/Font" + i.ToString() + "/OutlineColorG", navigator, ref sf.OutlineColor.G); + ok &= CHelper.TryGetFloatValueFromXML("//root/Fonts/Font" + i.ToString() + "/OutlineColorB", navigator, ref sf.OutlineColor.B); + ok &= CHelper.TryGetFloatValueFromXML("//root/Fonts/Font" + i.ToString() + "/OutlineColorA", navigator, ref sf.OutlineColor.A); + if (ok) _Fonts.Add(sf); else @@ -698,6 +782,13 @@ namespace Vocaluxe.Base writer.WriteElementString("Name", _Fonts[Index].Name); writer.WriteElementString("Folder", _Fonts[Index].Folder); + + writer.WriteElementString("Outline", _Fonts[Index].Outline.ToString("#0.00")); + writer.WriteElementString("ColorR", _Fonts[Index].OutlineColor.R.ToString("#0.00")); + writer.WriteElementString("ColorG", _Fonts[Index].OutlineColor.G.ToString("#0.00")); + writer.WriteElementString("ColorB", _Fonts[Index].OutlineColor.B.ToString("#0.00")); + writer.WriteElementString("ColorA", _Fonts[Index].OutlineColor.A.ToString("#0.00")); + writer.WriteElementString("FileNormal", _Fonts[Index].FileNormal); writer.WriteElementString("FileBold", _Fonts[Index].FileBold); writer.WriteElementString("FileItalic", _Fonts[Index].FileItalic); diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index 07ea2d2d..9c2b6c7d 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -247,72 +247,60 @@ namespace Vocaluxe.Base for (int p = 0; p < _NumPlayer; p++) { - CSound.AnalyzeBuffer(p); - - if (CSound.RecordToneValid(p) || DEBUG_HIT) + + for (int beat = _OldBeatD + 1; beat <= _CurrentBeatD; beat++) { - for (int beat = _OldBeatD + 1; beat <= _CurrentBeatD; beat++) - { - CLine[] lines = song.Notes.GetLines(_Player[p].LineNr).Line; - int Line = -1; + CLine[] lines = song.Notes.GetLines(_Player[p].LineNr).Line; + int Line = -1; - for (int j = 0; j < lines.Length; j++) + for (int j = 0; j < lines.Length; j++) + { + if (beat >= lines[j].StartBeat && beat <= lines[j].EndBeat) { - if (beat >= lines[j].StartBeat && beat <= lines[j].EndBeat) - { - Line = j; - break; - } + Line = j; + break; + } + } + + if (Line >= 0) + { + if (Line != _Player[p].CurrentLine) + _Player[p].CurrentNote = -1; + + _Player[p].CurrentLine = Line; + + while (_Player[p].SingLine.Count <= Line) + { + _Player[p].SingLine.Add(new CLine()); } - if (Line >= 0) + CNote[] notes = lines[Line].Notes; + int Note = -1; + for (int j = 0; j < notes.Length; j++) { - if (Line != _Player[p].CurrentLine) - _Player[p].CurrentNote = -1; - - _Player[p].CurrentLine = Line; - - while (_Player[p].SingLine.Count <= Line) + if (beat >= notes[j].StartBeat && beat <= notes[j].EndBeat) { - _Player[p].SingLine.Add(new CLine()); + Note = j; + break; } + } - CNote[] notes = lines[Line].Notes; - int Note = -1; - for (int j = 0; j < notes.Length; j++) - { - if (beat >= notes[j].StartBeat && beat <= notes[j].EndBeat) - { - if (notes[j].PointsForBeat > 0) - Note = j; - break; - } - } + if (Note >= 0) + { + _Player[p].CurrentNote = Note; - if (Note >= 0) + if (Line == lines.Length - 1) { - if (Line == lines.Length - 1) + if (Note == lines[Line].NoteCount - 1) { - if (Note == lines[Line].NoteCount - 1) - { + if (notes[Note].EndBeat == beat) _Player[p].SongFinished = true; - } } } - if (Note >= 0 && notes[Note].PointsForBeat > 0) + CSound.AnalyzeBuffer(p); + if (notes[Note].PointsForBeat > 0 && (CSound.RecordToneValid(p) || DEBUG_HIT)) { - _Player[p].CurrentNote = Note; - - if (Line == lines.Length - 1) - { - if (Note == lines[Line].NoteCount - 1) - { - if (notes[Note].EndBeat == beat) - _Player[p].SongFinished = true; - } - } - int Tone = notes[Note].Tone; int TonePlayer = CSound.RecordGetTone(p); @@ -383,8 +371,8 @@ namespace Vocaluxe.Base } } } - } + } } _OldBeatD = _CurrentBeatD; diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index cf118839..6b209bba 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -77,6 +77,9 @@ namespace Vocaluxe.Base public static string Translate(string KeyWord) { + if (KeyWord == null) + return null; + if (KeyWord.Length < 3) return KeyWord; diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index bbd6164f..2f751e83 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -47,10 +47,11 @@ namespace Vocaluxe.Base public const int iVersionSub = 0; // steps public const ERevision VersionRevision = ERevision.Beta; - public const int iBuild = 53; // Increase on every published version! Never Reset! + public const int iBuild = 54; // Increase on every published version! Never Reset! public const int iDatabaseHighscoreVersion = 1; public const int iDatabaseCoverVersion = 1; + public const int iDatabaseCreditsRessourcesVersion = 1; public static int iRenderW = 1280; @@ -69,8 +70,10 @@ namespace Vocaluxe.Base public const string sFileCover = "Cover.xml"; public const string sFileFonts = "Fonts.xml"; + public const string sFileOldHighscoreDB = "Ultrastar.db"; public static string sFileHighscoreDB = "HighscoreDB.sqlite"; public const string sFileCoverDB = "CoverDB.sqlite"; + public const string sFileCreditsRessourcesDB = "CreditsRessourcesDB.sqlite"; public const string sFilePerformanceLog = "Performance.log"; public const string sFileErrorLog = "Error.log"; public const string sFileBenchmarkLog = "Benchmark.log"; @@ -111,6 +114,11 @@ namespace Vocaluxe.Base public static bool TabNavigation = false; public const float BackgroundMusicFadeTime = 0.5f; + + public static List MusicFileTypes = new List() + { + "*.mp3","*.wma","*.ogg","*.wav" + }; public static string GetVersionText() { diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index b201e6fb..2a2f9d0f 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -501,7 +501,7 @@ namespace Vocaluxe.Base long ticks = _Timer.ElapsedTicks; float dt = _Timer.ElapsedMilliseconds / 1000f; - if (nanosecPerTick > 0L) + if (Stopwatch.IsHighResolution) dt = (float)(ticks * nanosecPerTick / 1000000000.0); return _SetValue + dt; @@ -581,7 +581,7 @@ namespace Vocaluxe.Base long ticks = _STimer.ElapsedTicks; float dt = _STimer.ElapsedMilliseconds / 1000f; - if (nanosecPerTick > 0L) + if (Stopwatch.IsHighResolution) dt = (float)(ticks * nanosecPerTick / 1000000000.0); return _CurrentTime + dt; @@ -617,9 +617,9 @@ namespace Vocaluxe.Base long ticks = _STimer.ElapsedTicks; float dt = _STimer.ElapsedMilliseconds / 1000f; - if (nanosecPerTick > 0L) + if (Stopwatch.IsHighResolution) dt = (float)(ticks * nanosecPerTick / 1000000000.0); - + float Ts = 0f; if (dt > 0) Ts = 1 / (_T / dt + 1); diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index d28064da..639ebdac 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -82,7 +82,7 @@ namespace Vocaluxe.Base static class CTheme { // Version number for main theme and skin files. Increment it, if you've changed something on the theme files! - const int ThemeSystemVersion = 4; + const int ThemeSystemVersion = 5; const int SkinSystemVersion = 3; #region Vars diff --git a/Vocaluxe/Doc/Roadmap.txt b/Vocaluxe/Doc/Roadmap.txt index ed4f88e1..5cbb31b5 100644 --- a/Vocaluxe/Doc/Roadmap.txt +++ b/Vocaluxe/Doc/Roadmap.txt @@ -79,42 +79,29 @@ + v0.2.0: - Medley - WiiMote Support - - Jukebox light - -+ v0.3.0: - - Song Editor - - Help System - - Duet (full support) - - Mark newly added songs - - Playlist-Support - - Theme System Update (Theme Editor) - -+ v0.4.0: - - Challenge Mode (with more than 2 player at once) - - More Player at once - -+ v0.5.0: - - Party Mode: Team-Battle - - Party Mode: Tic, Tac, Toe - - Party Mode: 4 in a row - -+ v0.6.0: - - Jukebox - -+ v0.7.0: - - Tournament Mode - -+ v0.8.0: - - Party Mode: Casting Show - -+ v0.9.0: - - ? - -+ v1.0.0: - - ? - + - Jukebox light (bg music controls) + - Show Avatars and Player Name in Sing Screen (and perhaps some other screens) + - New Lyric Effects + ----------------- just some ideas: + - Installer + - More Song List Views + - Tile Board: Show title and artist under each tile - OnScreen Keyboard? - - Kinect Support? \ No newline at end of file + - Kinect Support? + - Help System + - Party Mode: Casting Show + - More Player at once + - Mark newly added songs + - Playlist-Support + - Theme Editor + - Jukebox + - Tournament Mode + - Party Mode: Team-Battle + - Party Mode: Tic, Tac, Toe + - Party Mode: 4 in a row + - Challenge Mode (with more than 2 player at once) + - Song Editor + - Duet (full support, choose/toggle names) \ No newline at end of file diff --git a/Vocaluxe/Lib/Song/CSong.cs b/Vocaluxe/Lib/Song/CSong.cs index 39c1d35f..37147e7c 100644 --- a/Vocaluxe/Lib/Song/CSong.cs +++ b/Vocaluxe/Lib/Song/CSong.cs @@ -118,6 +118,11 @@ namespace Vocaluxe.Lib.Song return Path.Combine(Folder, MP3FileName); } + public string GetVideo() + { + return Path.Combine(Folder, VideoFileName); + } + public bool ReadTXTSong(string FilePath) { if (!File.Exists(FilePath)) @@ -237,6 +242,11 @@ namespace Vocaluxe.Lib.Song this.MP3FileName = Value; HeaderFlags |= EHeaderFlags.MP3; } + else + { + CLog.LogError("Can't find audio file: " + Path.Combine(this.Folder, Value)); + return false; + } break; case "BPM": if (CHelper.TryParse(Value, out this.BPM)) @@ -283,6 +293,9 @@ namespace Vocaluxe.Lib.Song case "VIDEO": if (File.Exists(Path.Combine(this.Folder, Value))) this.VideoFileName = Value; + else + CLog.LogError("Can't find video file: " + Path.Combine(this.Folder, Value)); + break; case "VIDEOGAP": CHelper.TryParse(Value, out this.VideoGap); diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs index d39c6942..ad2122f0 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs @@ -620,7 +620,7 @@ namespace Vocaluxe.Lib.Sound IntPtr.Zero, ref outputParams, format.SamplesPerSecond, - 0,//CConfig.PortAudioBufferSize, + (uint)CConfig.AudioBufferSize, PortAudio.PaStreamFlags.paNoFlag, _paStreamCallback, data)); @@ -677,6 +677,21 @@ namespace Vocaluxe.Lib.Sound { if (EventDecode.WaitOne(10)) { + lock (MutexSyncSignals) + { + if (_SetSkip) + { + _skip = true; + EventDecode.Set(); + _waiting = true; + } + + _SetSkip = false; + + _Start = _SetStart; + _Loop = _SetLoop; + } + if (_skip) { DoSkip(); @@ -689,25 +704,6 @@ namespace Vocaluxe.Lib.Sound Update(); } } - - if (!_terminated) - { - lock (MutexSyncSignals) - { - if (_SetSkip) - { - _skip = true; - EventDecode.Set(); - _waiting = true; - } - - _SetSkip = false; - - _Start = _SetStart; - _Loop = _SetLoop; - } - } - } DoFree(); @@ -844,7 +840,7 @@ namespace Vocaluxe.Lib.Sound else _waiting = true; - float latency = buf.Length / _BytesPerSecond; + float latency = buf.Length / _BytesPerSecond + CConfig.AudioLatency/1000f; float time = _TimeCode - _data.BytesNotRead / _BytesPerSecond - latency; _CurrentTime = _SyncTimer.Update(time); @@ -856,7 +852,7 @@ namespace Vocaluxe.Lib.Sound } catch (Exception e) { - Console.WriteLine(e.ToString()); + CLog.LogError("Error PortAudio.StreamCallback: " + e.Message); } return PortAudio.PaStreamCallbackResult.paContinue; diff --git a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs index 04096ab9..87bff1ab 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs @@ -245,6 +245,9 @@ namespace Vocaluxe.Lib.Sound if (!_initialized) return null; + if (_Devices.Count == 0) + return null; + return _Devices.ToArray(); } diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index e6031786..767a9fb9 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -214,33 +214,34 @@ namespace Vocaluxe.Lib.Video class Decoder { - private IntPtr _instance = IntPtr.Zero; - private IntPtr _videodecoder = IntPtr.Zero; - private IntPtr _package = IntPtr.Zero; - private Stopwatch _Timer = new Stopwatch(); - private CLOSEPROC _Closeproc; - private int _StreamID; - private string _FileName; + private IntPtr _instance = IntPtr.Zero; // acinerella instance + private IntPtr _videodecoder = IntPtr.Zero; // acinerella video decoder instance + + private Stopwatch _LoopTimer = new Stopwatch(); + private CLOSEPROC _Closeproc; // delegate for stream closing + private int _StreamID; // stream ID for stream closing + private string _FileName; // current video file name - private FileStream _fs; - private TAc_read_callback _rc; - private TAc_seek_callback _sc; + private FileStream _fs; // video file stream + private TAc_read_callback _rc; // read callback for acinerella + private TAc_seek_callback _sc; // seek callback for acinerella private bool _FileOpened = false; - private float _VideoTimeBase = 0f; - private float _VideoTime = 0f; - private float _ActualVideoTime = 0f; - private bool _waiting = false; - private bool _skip = false; + private float _VideoTimeBase = 0f; // frame time + private float _VideoDecoderTime = 0f; // time of last decoded frame + private float _CurrentVideoTime = 0f; // current video position + private bool _BufferFull = false; // buffer is full, waiting for free frame slot + + private bool _skip = false; // do skip private float _Time = 0f; private float _Gap = 0f; private float _Start = 0f; private bool _Loop = false; private float _Duration = 0f; - private float _VideoSkipTime = 0f; - private float _NegativeSkipTime = 0f; - private float _SkipTime = 0f; + private float _VideoSkipTime = 0f; // = VideoGap + private float _SkipTime = 0f; // = Start + VideoGap + private bool _Paused = false; private bool _NoMoreFrames = false; private bool _Finished = false; @@ -260,7 +261,6 @@ namespace Vocaluxe.Lib.Video AutoResetEvent EventDecode = new AutoResetEvent(false); SFrameBuffer[] _FrameBuffer = new SFrameBuffer[5]; Object MutexFramebuffer = new Object(); - Object MutexFrame = new Object(); Object MutexSyncSignals = new Object(); public Decoder() @@ -293,15 +293,16 @@ namespace Vocaluxe.Lib.Video get { return _Paused; } set { - _Paused = value; lock (MutexSyncSignals) { + _Paused = value; if (_Paused) - _Timer.Stop(); + { + _LoopTimer.Stop(); + } else { - _Timer.Start(); - EventDecode.Set(); + _LoopTimer.Start(); } } } @@ -330,7 +331,7 @@ namespace Vocaluxe.Lib.Video return false; _FileName = FileName; - _thread.Priority = ThreadPriority.Highest; + _thread.Priority = ThreadPriority.Normal; _thread.Name = Path.GetFileName(FileName); _thread.Start(); return true; @@ -348,12 +349,12 @@ namespace Vocaluxe.Lib.Video { lock (MutexSyncSignals) { - _SetTime += _Timer.ElapsedMilliseconds / 1000f; + _SetTime += _LoopTimer.ElapsedMilliseconds / 1000f; VideoTime = _SetTime; - _Timer.Stop(); - _Timer.Reset(); - _Timer.Start(); + _LoopTimer.Stop(); + _LoopTimer.Reset(); + _LoopTimer.Start(); } @@ -362,12 +363,12 @@ namespace Vocaluxe.Lib.Video return true; } - if (_Time - _SetTime >= 0 || _SetTime > Time) + if (_SetTime != Time) { lock (MutexSyncSignals) { _SetTime = Time; - VideoTime = _VideoTime; + VideoTime = _CurrentVideoTime; } UploadNewFrame(ref frame); EventDecode.Set(); @@ -394,17 +395,15 @@ namespace Vocaluxe.Lib.Video #region Threading private void DoSkip() { - lock (MutexSyncSignals) - { - _VideoSkipTime = _Gap; - _NegativeSkipTime = _Start + _Gap; - _SkipTime = _Start + _Gap; - _BeforeLoop = false; - } + string extension = Path.GetExtension(_FileName); //just a workaround for the mkv-search-bug in ffmpeg - if (_SkipTime > 0) + _VideoSkipTime = _Gap; + _SkipTime = _Start + _Gap; + _BeforeLoop = false; + + if (_SkipTime > 0 && extension != ".mkv") { - _VideoTime = _SkipTime; + _VideoDecoderTime = _SkipTime; try { CAcinerella.ac_seek(_videodecoder, -1, (Int64)(_SkipTime * 1000f)); @@ -417,10 +416,11 @@ namespace Vocaluxe.Lib.Video } else { - _VideoTime = 0f; + _VideoDecoderTime = 0f; try { - CAcinerella.ac_seek(_videodecoder, -1, (Int64)0); + if (extension != ".mkv") + CAcinerella.ac_seek(_videodecoder, -1, (Int64)0); } catch (Exception e) { @@ -428,7 +428,10 @@ namespace Vocaluxe.Lib.Video } } - _ActualVideoTime = _VideoTime; + lock (MutexSyncSignals) + { + _CurrentVideoTime = _VideoDecoderTime; + } lock (MutexFramebuffer) { @@ -439,46 +442,41 @@ namespace Vocaluxe.Lib.Video } } - _waiting = false; + _BufferFull = false; + _skip = false; + EventDecode.Set(); } private void Execute() { DoOpen(); - + EventDecode.Set(); + while (!_terminated) { - if (EventDecode.WaitOne(1) || !_waiting) - { - if (_skip) - { - DoSkip(); - _skip = false; - } - - if (!_waiting) - { - DoDecode(); - } - - if (_waiting) - Copy(); - } - if (!_terminated) + if (EventDecode.WaitOne(10)) { lock (MutexSyncSignals) { _Time = _SetTime; if (_SetSkip) _skip = true; - + _SetSkip = false; _Gap = _SetGap; _Start = _SetStart; _Loop = _SetLoop; } + + if (_skip) + DoSkip(); + + if (!_BufferFull) + DoDecode(); + + if (_BufferFull) + Copy(); } - } DoFree(); @@ -544,7 +542,7 @@ namespace Vocaluxe.Lib.Video if (Videodecoder.stream_info.video_info.frames_per_second > 0) _VideoTimeBase = 1f / (float)Videodecoder.stream_info.video_info.frames_per_second; - _VideoTime = 0f; + _VideoDecoderTime = 0f; _Time = 0f; for (int i = 0; i < _FrameBuffer.Length; i++) @@ -563,14 +561,14 @@ namespace Vocaluxe.Lib.Video if (!_FileOpened) return; - if (_Paused || _NoMoreFrames) + if (_Paused || _NoMoreFrames || _BufferFull) return; - if ((_NegativeSkipTime < 0f) && (_Time + _NegativeSkipTime >= 0f)) - _NegativeSkipTime = 0f; + if ((_SkipTime < 0f) && (_Time + _SkipTime >= 0f)) + _SkipTime = 0f; float myTime = _Time + _VideoSkipTime; - float TimeDifference = myTime - _VideoTime; + float TimeDifference = myTime - _VideoDecoderTime; bool DropFrame = false; if (TimeDifference >= (FRAMEDROPCOUNT - 1) * _VideoTimeBase) @@ -595,17 +593,13 @@ namespace Vocaluxe.Lib.Video if (!_BeforeLoop && (!DropFrame || FrameFinished != 0)) { - lock (MutexFrame) + try { - try - { - FrameFinished = CAcinerella.ac_get_frame(_instance, _videodecoder); - } - catch (Exception) - { - CLog.LogError("Error AcGetFrame " + _FileName); - } - + FrameFinished = CAcinerella.ac_get_frame(_instance, _videodecoder); + } + catch (Exception) + { + CLog.LogError("Error AcGetFrame " + _FileName); } } @@ -637,7 +631,6 @@ namespace Vocaluxe.Lib.Video lock (MutexSyncSignals) { - _ActualVideoTime = 0f; _Start = 0f; _Gap = 0f; _SetTime = 0f; @@ -658,6 +651,7 @@ namespace Vocaluxe.Lib.Video private void Copy() { int num = -1; + lock (MutexFramebuffer) { for (int i = 0; i < _FrameBuffer.Length; i++) @@ -670,29 +664,37 @@ namespace Vocaluxe.Lib.Video } if (num == -1) - _waiting = true; + { + _BufferFull = true; + } else { + TAc_decoder Videodecoder = (TAc_decoder)Marshal.PtrToStructure(_videodecoder, typeof(TAc_decoder)); - lock (MutexFrame) + _VideoDecoderTime = (float)Videodecoder.timecode; + _FrameBuffer[num].time = _VideoDecoderTime; + + if (Videodecoder.buffer != IntPtr.Zero) { - TAc_decoder Videodecoder = (TAc_decoder)Marshal.PtrToStructure(_videodecoder, typeof(TAc_decoder)); + Marshal.Copy(Videodecoder.buffer, _FrameBuffer[num].data, 0, _Width * _Height * 4); - _FrameBuffer[num].time = _VideoTime; - _VideoTime = (float)Videodecoder.timecode; - - if (Videodecoder.buffer != IntPtr.Zero) - { - Marshal.Copy(Videodecoder.buffer, _FrameBuffer[num].data, 0, _Width * _Height * 4); - - _FrameBuffer[num].displayed = false; - } + _FrameBuffer[num].displayed = false; } - - _waiting = false; + int numfull = 0; + for (int i = 0; i < _FrameBuffer.Length; i++) + { + if (!_FrameBuffer[i].displayed) + numfull++; + } + + if (numfull < _FrameBuffer.Length) + _BufferFull = false; } } + + if (!_BufferFull) + EventDecode.Set(); } private void UploadNewFrame(ref STexture frame) @@ -715,8 +717,13 @@ namespace Vocaluxe.Lib.Video { CDraw.UpdateTexture(ref frame, ref _FrameBuffer[num].data); } - _ActualVideoTime = _FrameBuffer[num].time; + + lock (MutexSyncSignals) + { + _CurrentVideoTime = _FrameBuffer[num].time; + } _Finished = false; + EventDecode.Set(); } else { @@ -724,7 +731,6 @@ namespace Vocaluxe.Lib.Video _Finished = true; } } - EventDecode.Set(); } private int FindFrame() @@ -736,27 +742,28 @@ namespace Vocaluxe.Lib.Video { float td = _SetTime + _VideoSkipTime - _FrameBuffer[i].time; + if (td > _VideoTimeBase * 2) + { + _FrameBuffer[i].displayed = true; + } + if (!_FrameBuffer[i].displayed && (td < diff) && (td > _VideoTimeBase)) { diff = Math.Abs(_FrameBuffer[i].time - _SetTime - _VideoSkipTime); Result = i; } - - if (td > _VideoTimeBase * 2) - _FrameBuffer[i].displayed = true; } if (Result != -1) + { _FrameBuffer[Result].displayed = true; + } return Result; } private void DoFree() { - if (_package != IntPtr.Zero) - CAcinerella.ac_free_package(_package); - if (_videodecoder != IntPtr.Zero) CAcinerella.ac_free_decoder(_videodecoder); diff --git a/Vocaluxe/Menu/CBackground.cs b/Vocaluxe/Menu/CBackground.cs index c6adfa33..cedc4eb5 100644 --- a/Vocaluxe/Menu/CBackground.cs +++ b/Vocaluxe/Menu/CBackground.cs @@ -137,8 +137,16 @@ namespace Vocaluxe.Menu public bool Draw() { bool ok = false; - if (_Theme.Type == EBackgroundTypes.Video && CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) + if (_Theme.Type == EBackgroundTypes.Video && CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON && CBackgroundMusic.Playing && CBackgroundMusic.SongHasVideo && CBackgroundMusic.VideoEnabled && !CBackgroundMusic.Disabled) + { + Pause(); + ok = DrawBackgroundMusicVideo(); + } + else if (_Theme.Type == EBackgroundTypes.Video && CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) + { + Resume(); ok = DrawVideo(); + } if (_Theme.TextureName != String.Empty && (_Theme.Type == EBackgroundTypes.Texture || @@ -206,6 +214,21 @@ namespace Vocaluxe.Menu } return false; } + + private bool DrawBackgroundMusicVideo() + { + STexture VideoTexture = CBackgroundMusic.GetVideoTexture(); + if (VideoTexture.height > 0) + { + RectangleF bounds = new RectangleF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH); + RectangleF rect = new RectangleF(0f, 0f, VideoTexture.width, VideoTexture.height); + CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); + + CDraw.DrawTexture(VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.zFar / 4)); + return true; + } + return false; + } #endregion internal #region ThemeEdit diff --git a/Vocaluxe/Menu/CButton.cs b/Vocaluxe/Menu/CButton.cs index 0341bf03..d4b5d231 100644 --- a/Vocaluxe/Menu/CButton.cs +++ b/Vocaluxe/Menu/CButton.cs @@ -41,6 +41,7 @@ namespace Vocaluxe.Menu public float SReflectionHeight; private bool _Selected; + public bool Pressed; public bool Selected { get { return _Selected; } @@ -234,7 +235,8 @@ namespace Vocaluxe.Menu return; STexture texture = new STexture(-1); - if (!Selected) + + if (!Selected && !Pressed) { texture = CTheme.GetSkinTexture(_Theme.TextureName); CDraw.DrawTexture(texture, Rect, Color); diff --git a/Vocaluxe/Menu/CGraphics.cs b/Vocaluxe/Menu/CGraphics.cs index 91908275..d64691f1 100644 --- a/Vocaluxe/Menu/CGraphics.cs +++ b/Vocaluxe/Menu/CGraphics.cs @@ -31,6 +31,8 @@ namespace Vocaluxe.Menu ScreenNames = 14, + ScreenCredits = 15, + ScreenNull = -1 } @@ -212,6 +214,7 @@ namespace Vocaluxe.Menu { // Add Screens, must be the same order as in EScreens! CLog.StartBenchmark(1, "Build Screen List"); + _Screens.Add(new CScreenTest()); _Screens.Add(new CScreenLoad()); _Screens.Add(new CScreenMain()); @@ -227,8 +230,10 @@ namespace Vocaluxe.Menu _Screens.Add(new CScreenOptionsVideo()); _Screens.Add(new CScreenOptionsTheme()); _Screens.Add(new CScreenNames()); + _Screens.Add(new CScreenCredits()); _PopupScreens.Add(new CPopupScreenPlayerControl()); + CLog.StopBenchmark(1, "Build Screen List"); _CurrentScreen = EScreens.ScreenLoad; @@ -255,9 +260,12 @@ namespace Vocaluxe.Menu for (int i = 0; i < _Screens.Count; i++) { - CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]); - _Screens[i].LoadTheme(); - CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]); + if (Enum.GetNames(typeof(EScreens))[i] != Enum.GetName(typeof(EScreens), (int)EScreens.ScreenCredits)) + { + CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]); + _Screens[i].LoadTheme(); + CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]); + } } for (int i = 0; i < _PopupScreens.Count; i++) @@ -271,7 +279,10 @@ namespace Vocaluxe.Menu ReloadCursor(); for (int i = 0; i < _Screens.Count; i++) { - _Screens[i].ReloadTheme(); + if (Enum.GetNames(typeof(EScreens))[i] != Enum.GetName(typeof(EScreens), (int)EScreens.ScreenCredits)) + { + _Screens[i].ReloadTheme(); + } } for (int i = 0; i < _PopupScreens.Count; i++) @@ -285,7 +296,10 @@ namespace Vocaluxe.Menu ReloadCursor(); for (int i = 0; i < _Screens.Count; i++) { - _Screens[i].ReloadTextures(); + if (Enum.GetNames(typeof(EScreens))[i] != Enum.GetName(typeof(EScreens), (int)EScreens.ScreenCredits)) + { + _Screens[i].ReloadTextures(); + } } for (int i = 0; i < _PopupScreens.Count; i++) @@ -299,7 +313,10 @@ namespace Vocaluxe.Menu CTheme.SaveTheme(); for (int i = 0; i < _Screens.Count; i++) { - _Screens[i].SaveTheme(); + if (Enum.GetNames(typeof(EScreens))[i] != Enum.GetName(typeof(EScreens), (int)EScreens.ScreenCredits)) + { + _Screens[i].SaveTheme(); + } } for (int i = 0; i < _PopupScreens.Count; i++) diff --git a/Vocaluxe/Menu/CLyric.cs b/Vocaluxe/Menu/CLyric.cs index 24651cc3..8a70e0ab 100644 --- a/Vocaluxe/Menu/CLyric.cs +++ b/Vocaluxe/Menu/CLyric.cs @@ -15,7 +15,8 @@ namespace Vocaluxe.Menu { Fill, Jump, - Slide + Slide, + Zoom } struct SNote @@ -23,6 +24,7 @@ namespace Vocaluxe.Menu public string Text; public int StartBeat; public int EndBeat; + public int Duration; public ENoteType Type; } @@ -205,6 +207,7 @@ namespace Vocaluxe.Menu n.Text = note.Text; n.StartBeat = note.StartBeat; n.EndBeat = note.EndBeat; + n.Duration = note.Duration; n.Type = note.NoteType; _Text.Text = note.Text; @@ -229,6 +232,7 @@ namespace Vocaluxe.Menu return _X - _width / 2; } + #region draw public void Draw(float ActualBeat) { if (Visible || CSettings.GameState == EGameState.EditTheme) @@ -236,12 +240,17 @@ namespace Vocaluxe.Menu switch (_Style) { case ELyricStyle.Fill: + DrawFill(ActualBeat); break; case ELyricStyle.Jump: + DrawJump(ActualBeat); break; case ELyricStyle.Slide: DrawSlide(ActualBeat); break; + case ELyricStyle.Zoom: + DrawZoom(ActualBeat); + break; default: DrawSlide(ActualBeat); break; @@ -257,6 +266,8 @@ namespace Vocaluxe.Menu { _Text.X = x; _Text.Style = EStyle.Bold; + _Text.Text = note.Text; + RectangleF rect = CDraw.GetTextBounds(_Text); if (note.Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; @@ -266,7 +277,7 @@ namespace Vocaluxe.Menu if (CurrentBeat <= note.EndBeat) { _Text.Color = ColorProcessed; - _Text.Text = note.Text; + float diff = note.EndBeat - note.StartBeat; if (diff == 0) @@ -280,23 +291,202 @@ namespace Vocaluxe.Menu } else { - _Text.Color = ColorProcessed; - _Text.Text = note.Text; + _Text.Color = ColorProcessed; _Text.Draw(); } } else { - _Text.Color = Color; - _Text.Text = note.Text; + _Text.Color = Color; _Text.Draw(); } - RectangleF rect = CDraw.GetTextBounds(_Text); + x += rect.Width; } } + private void DrawZoom(float CurrentBeat) + { + float x = _X - _width / 2; // most left position + + //find last active note + int last_note = -1; + for (int i = 0; i < _Notes.Count; i++) + { + if (CurrentBeat >= _Notes[i].StartBeat) + last_note = i; + } + + int zoom_note = -1; + float zoomx = 0f; + + int current_note = -1; + foreach (SNote note in _Notes) + { + current_note++; + + _Text.X = x; + _Text.Style = EStyle.Bold; + _Text.Text = note.Text; + RectangleF rect = CDraw.GetTextBounds(_Text); + + if (note.Type == ENoteType.Freestyle) + _Text.Style = EStyle.BoldItalic; + + if (CurrentBeat >= note.StartBeat) + { + if (CurrentBeat <= note.EndBeat) + { + zoom_note = current_note; + zoomx = _Text.X; + } + else + { + // already passed + if (current_note == last_note) + _Text.Color = ColorProcessed; + else + _Text.Color = Color; + + _Text.Draw(); + } + + } + else + { + // not passed + _Text.Color = Color; + _Text.Draw(); + } + + x += rect.Width; + } + + if (zoom_note > -1) + { + if (_Notes[zoom_note].Duration == 0) + return; + + _Text.X = zoomx; + _Text.Text = _Notes[zoom_note].Text; + _Text.Color = ColorProcessed; + _Text.Style = EStyle.Bold; + + if (_Notes[zoom_note].Type == ENoteType.Freestyle) + _Text.Style = EStyle.BoldItalic; + + RectangleF rect = CDraw.GetTextBounds(_Text); + + float diff = _Notes[zoom_note].EndBeat - _Notes[zoom_note].StartBeat; + + float p = (CurrentBeat - _Notes[zoom_note].StartBeat) / _Notes[zoom_note].Duration; + if (p > 1f) + p = 1f; + + p = 1f - p; + + float ty = _Text.Y; + float tx = _Text.X; + float th = _Text.Height; + float tz = _Text.Z; + + _Text.Height += _Text.Height * p * 0.4f; + RectangleF rectz = CDraw.GetTextBounds(_Text); + _Text.X -= (rectz.Width - rect.Width) / 2f; + _Text.Y -= (rectz.Height - rect.Height) / 2f; + _Text.Z -= 0.1f; + + _Text.Draw(); + + _Text.Y = ty; + _Text.X = tx; + _Text.Height = th; + _Text.Z = tz; + } + } + + private void DrawFill(float CurrentBeat) + { + float x = _X - _width / 2; // most left position + + foreach (SNote note in _Notes) + { + _Text.X = x; + _Text.Style = EStyle.Bold; + _Text.Text = note.Text; + RectangleF rect = CDraw.GetTextBounds(_Text); + + if (note.Type == ENoteType.Freestyle) + _Text.Style = EStyle.BoldItalic; + + if (CurrentBeat >= note.StartBeat) + { + _Text.Color = ColorProcessed; + _Text.Draw(); + } + else + { + // not passed + _Text.Color = Color; + _Text.Draw(); + } + + x += rect.Width; + } + } + + private void DrawJump(float CurrentBeat) + { + float x = _X - _width / 2; // most left position + + foreach (SNote note in _Notes) + { + _Text.X = x; + _Text.Style = EStyle.Bold; + _Text.Text = note.Text; + RectangleF rect = CDraw.GetTextBounds(_Text); + + if (note.Type == ENoteType.Freestyle) + _Text.Style = EStyle.BoldItalic; + + if (CurrentBeat >= note.StartBeat) + { + if (CurrentBeat <= note.EndBeat) + { + _Text.Color = ColorProcessed; + + float diff = note.EndBeat - note.StartBeat; + if (diff == 0) + _Text.Draw(); + else + { + float y = _Text.Y; + _Text.Y -= _Text.Height * 0.1f; + _Text.Draw(); + _Text.Y = y; + } + } + else + { + // already passed + _Text.Color = Color; + _Text.Draw(); + } + + } + else + { + // not passed + _Text.Color = Color; + _Text.Draw(); + } + + x += rect.Width; + } + } + #endregion draw + public void UnloadTextures() { } diff --git a/Vocaluxe/Menu/CText.cs b/Vocaluxe/Menu/CText.cs index 770a40f3..c0c95948 100644 --- a/Vocaluxe/Menu/CText.cs +++ b/Vocaluxe/Menu/CText.cs @@ -423,6 +423,9 @@ namespace Vocaluxe.Menu CurrentColor = new SColorF(SColor); SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha); + + CFonts.SetFont(Fon); + CFonts.Style = Style; CFonts.DrawText(CLanguage.Translate(Text), h, x, y, Z, color); if (Reflection) @@ -461,6 +464,9 @@ namespace Vocaluxe.Menu CurrentColor = new SColorF(SColor); SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha); + + CFonts.SetFont(Fon); + CFonts.Style = Style; CFonts.DrawText(Text, Height, x, Y, Z, color, begin, end); if (Reflection) @@ -520,6 +526,9 @@ namespace Vocaluxe.Menu CurrentColor = new SColorF(SColor); SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha); + + CFonts.SetFont(Fon); + CFonts.Style = Style; CFonts.DrawText(CLanguage.Translate(Text), h, x, y, Z, color); if (reflection) diff --git a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs index 43cd6f28..7c5c069e 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs @@ -394,7 +394,7 @@ namespace Vocaluxe.Menu.SongMenu if (_streams.Count > 0 && _video != -1) { - if (CVideo.VdFinished(_video)) + if (CVideo.VdFinished(_video) || CSound.IsFinished(_actsongstream)) { CVideo.VdClose(_video); _video = -1; diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index 6ff04a93..94811a02 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -86,13 +86,6 @@ namespace Vocaluxe Application.DoEvents(); - // Init Background Music - CLog.StartBenchmark(0, "Init Background Music"); - CBackgroundMusic.Init(); - CLog.StopBenchmark(0, "Init Background Music"); - - Application.DoEvents(); - // Init Profiles CLog.StartBenchmark(0, "Init Profiles"); CProfiles.Init(); @@ -121,6 +114,13 @@ namespace Vocaluxe Application.DoEvents(); + // Init Background Music + CLog.StartBenchmark(0, "Init Background Music"); + CBackgroundMusic.Init(); + CLog.StopBenchmark(0, "Init Background Music"); + + Application.DoEvents(); + // Theme System CLog.StartBenchmark(0, "Init Theme"); CTheme.InitTheme(); @@ -192,6 +192,8 @@ namespace Vocaluxe class SplashScreen : Form { + Bitmap logo; + public SplashScreen() { string path = Path.Combine(Environment.CurrentDirectory, Path.Combine(CSettings.sFolderGraphics, CSettings.sLogo)); @@ -199,9 +201,8 @@ namespace Vocaluxe { try { - Bitmap logo = new Bitmap(path); + logo = new Bitmap(path); this.ClientSize = new Size(logo.Width, logo.Height); - this.BackgroundImage = logo; } catch (Exception e) { @@ -226,11 +227,27 @@ namespace Vocaluxe } else CLog.LogError("Can't find " + path); - + + SetStyle(ControlStyles.SupportsTransparentBackColor, true); + this.BackColor = Color.Transparent; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Text = CSettings.sProgramName; this.CenterToScreen(); this.Show(); } + + protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) + { + } + + protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e) + { + if (logo == null) + return; + + Graphics g = e.Graphics; + g.DrawImage(logo, new Rectangle(0, 0, this.Width, this.Height)); + } } } diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index c6fea31b..3e383be6 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -7,6 +7,7 @@ using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Lib.Draw; using Vocaluxe.Menu; +using Vocaluxe.Lib.Song; namespace Vocaluxe.Screens { @@ -16,13 +17,60 @@ namespace Vocaluxe.Screens const int ScreenVersion = 1; private const string StaticBG = "StaticBG"; - private const string Cover = "Cover"; + private const string StaticCover = "StaticCover"; private const string ButtonPrevious = "ButtonPrevious"; private const string ButtonPlay = "ButtonPlay"; private const string ButtonPause = "ButtonPause"; private const string ButtonNext = "ButtonNext"; private const string ButtonRepeat = "ButtonRepeat"; + private const string ButtonShowVideo = "ButtonShowVideo"; + private const string ButtonSing = "ButtonSing"; + private const string ButtonToBackgroundVideo = "ButtonToBackgroundVideo"; + + private const string TextCurrentSong = "TextCurrentSong"; + private bool _VideoPreview = false; + + private bool VideoPreview + { + get + { + return _VideoPreview; + } + set + { + _VideoPreview = value; + if (!_VideoPreview && !VideoBackground) + CBackgroundMusic.VideoEnabled = false; + else + CBackgroundMusic.VideoEnabled = true; + } + } + private bool VideoBackground + { + get + { + return CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON; + } + set + { + if (!value) + { + if (CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON) + { + CConfig.VideosToBackground = EOffOn.TR_CONFIG_OFF; + if (!_VideoPreview) + CBackgroundMusic.VideoEnabled = false; + } + } + else + { + CConfig.VideosToBackground = EOffOn.TR_CONFIG_ON; + CBackgroundMusic.VideoEnabled = true; + } + CConfig.SaveConfig(); + } + } public CPopupScreenPlayerControl() { @@ -36,7 +84,8 @@ namespace Vocaluxe.Screens _ThemeName = "PopupScreenPlayerControl"; _ScreenVersion = ScreenVersion; - _ThemeStatics = new string[] { StaticBG, Cover }; + _ThemeStatics = new string[] { StaticBG, StaticCover }; + _ThemeTexts = new string[] { TextCurrentSong }; List buttons = new List(); buttons.Add(ButtonPlay); @@ -44,6 +93,9 @@ namespace Vocaluxe.Screens buttons.Add(ButtonPrevious); buttons.Add(ButtonNext); buttons.Add(ButtonRepeat); + buttons.Add(ButtonShowVideo); + buttons.Add(ButtonSing); + buttons.Add(ButtonToBackgroundVideo); _ThemeButtons = buttons.ToArray(); } @@ -81,6 +133,12 @@ namespace Vocaluxe.Screens CBackgroundMusic.Pause(); if (Buttons[htButtons(ButtonRepeat)].Selected) CBackgroundMusic.Repeat(); + if (Buttons[htButtons(ButtonShowVideo)].Selected) + VideoPreview = !VideoPreview; + if (Buttons[htButtons(ButtonSing)].Selected) + StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet); + if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected) + VideoBackground = !VideoBackground; break; } } @@ -103,13 +161,19 @@ namespace Vocaluxe.Screens CBackgroundMusic.Pause(); if (Buttons[htButtons(ButtonRepeat)].Selected) CBackgroundMusic.Repeat(); + if (Buttons[htButtons(ButtonShowVideo)].Selected) + VideoPreview = !VideoPreview; + if (Buttons[htButtons(ButtonSing)].Selected) + StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet); + if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected) + VideoBackground = !VideoBackground; } else if (MouseEvent.LB) { - CGraphics.HidePopup(EPopupScreens.PopupPlayerControl); + //CGraphics.HidePopup(EPopupScreens.PopupPlayerControl); return false; } else if (MouseEvent.RB) { - CGraphics.HidePopup(EPopupScreens.PopupPlayerControl); + //CGraphics.HidePopup(EPopupScreens.PopupPlayerControl); return false; } return true; @@ -117,23 +181,47 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.IsPlaying(); - Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.IsPlaying(); + + Statics[htStatics(StaticCover)].Visible = !_VideoPreview || !CBackgroundMusic.SongHasVideo; + Buttons[htButtons(ButtonToBackgroundVideo)].Pressed = VideoBackground; + Buttons[htButtons(ButtonShowVideo)].Pressed = _VideoPreview; return true; } public override void OnShow() { base.OnShow(); - } public override bool Draw() { if (!_Active) return false; + Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.Cover; + if (CBackgroundMusic.VideoEnabled && VideoPreview && CBackgroundMusic.SongHasVideo) + CDraw.DrawTexture(Statics[htStatics(StaticCover)], CBackgroundMusic.GetVideoTexture(), EAspect.Crop); + Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.Playing; + Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.Playing; + Texts[htTexts(TextCurrentSong)].Text = CBackgroundMusic.ArtistAndTitle; return base.Draw(); } + + private void StartSong(int SongNr, bool Duet) + { + if (SongNr >= 0 && CSongs.SongsLoaded) + { + if (Duet) + CGame.SetGameMode(GameModes.EGameMode.Duet); + else + CGame.SetGameMode(GameModes.EGameMode.Normal); + + CGame.Reset(); + CGame.ClearSongs(); + CGame.AddSong(SongNr); + + CGraphics.FadeTo(EScreens.ScreenNames); + } + } } } diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs new file mode 100644 index 00000000..278b4720 --- /dev/null +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -0,0 +1,367 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Text; +using System.Windows.Forms; + +using Vocaluxe.Base; +using Vocaluxe.Lib.Draw; +using Vocaluxe.Menu; + +enum EDirection +{ + Left, + Right, + Up +} + +class CCreditName +{ + public CStatic image; + public CParticleEffect particle; + public SRectF particleRect; + public EDirection direction; + public float StartTimeUp; + public bool active; +} + +namespace Vocaluxe.Screens +{ + class CScreenCredits :CMenu + { + // Version number for theme files. Increment it, if you've changed something on the theme files! + const int ScreenVersion = 1; + + + private CStatic logo; + private CParticleEffect starsRed; + private CParticleEffect starsBlue; + private List _CreditNames; + + private Stopwatch LogoTimer; + private Stopwatch CreditsTimer; + + public CScreenCredits() + { + Init(); + } + + protected override void Init() + { + base.Init(); + + _ThemeName = "ScreenCredits"; + _ScreenVersion = ScreenVersion; + + LogoTimer = new Stopwatch(); + CreditsTimer = new Stopwatch(); + } + + public override bool HandleInput(KeyEvent KeyEvent) + { + if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode)) + { + + } + else + { + switch (KeyEvent.Key) + { + case Keys.Escape: + case Keys.Back: + CGraphics.FadeTo(EScreens.ScreenMain); + break; + + case Keys.Enter: + CGraphics.FadeTo(EScreens.ScreenMain); + break; + } + } + + return true; + } + + public override bool HandleMouse(MouseEvent MouseEvent) + { + if (MouseEvent.LB && IsMouseOver(MouseEvent)) + { + + } + + if (MouseEvent.LB) + { + CGraphics.FadeTo(EScreens.ScreenMain); + } + + if (MouseEvent.RB) + { + CGraphics.FadeTo(EScreens.ScreenMain); + } + return true; + } + + public override bool UpdateGame() + { + if (!animation()) + { + CGraphics.FadeTo(EScreens.ScreenMain); + } + return true; + } + + public override void OnShow() + { + STexture tex = new STexture(); + STexture particleTex = new STexture(); + + //Vocaluxe-Logo + CDataBase.GetCreditsRessource("Logo_voc.png", ref tex); + logo = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF((CSettings.iRenderW - tex.width)/2, -270 , tex.width, tex.height, -2)); + + //Little stars for logo + CDataBase.GetCreditsRessource("PerfectNoteStar.png", ref particleTex); + int numstars = (int)(logo.Rect.W * 0.25f /2f); + starsRed = new CParticleEffect(numstars, new SColorF(1, 0, 0, 1), new SRectF(logo.Rect.X, logo.Rect.Y, logo.Rect.W, logo.Rect.H, -1), particleTex, 35, EParticeType.Star); + starsBlue = new CParticleEffect(numstars, new SColorF(0.149f, 0.415f, 0.819f, 1), new SRectF(logo.Rect.X, logo.Rect.Y, logo.Rect.W, logo.Rect.H, -1), particleTex, 35, EParticeType.Star); + + //Credit names + _CreditNames = new List(); + + CCreditName CreditEntry = new CCreditName(); + + //brunzel + CDataBase.GetCreditsRessource("brunzel.png", ref tex); + CCreditName CreditEntryBrunzel = new CCreditName(); + CreditEntryBrunzel.image = new CStatic(tex, new SColorF(1,1,1,1), new SRectF(-450, 580, 400, 120, -4)); + CreditEntryBrunzel.particleRect = new SRectF(CreditEntryBrunzel.image.Rect.X + 342, CreditEntryBrunzel.image.Rect.Y + 4, 30, 30, -5); + CreditEntryBrunzel.particle = new CParticleEffect(8, new SColorF(1, 0, 0, 1), CreditEntryBrunzel.particleRect, particleTex, 35, EParticeType.Star); + CreditEntryBrunzel.active = true; + CreditEntryBrunzel.direction = EDirection.Left; + _CreditNames.Add(CreditEntryBrunzel); + + //Darkice + CDataBase.GetCreditsRessource("Darkice.png", ref tex); + CCreditName CreditEntryDarkice = new CCreditName(); + CreditEntryDarkice.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(CSettings.iRenderW, 580, 400, 120, -4)); + CreditEntryDarkice.particleRect = new SRectF(CreditEntryDarkice.image.Rect.X + 242, CreditEntryDarkice.image.Rect.Y + 23, 30, 30, -5); + CreditEntryDarkice.particle = new CParticleEffect(8, new SColorF(0.149f, 0.415f ,0.819f, 1), CreditEntryDarkice.particleRect, particleTex, 35, EParticeType.Star); + CreditEntryDarkice.active = true; + CreditEntryDarkice.direction = EDirection.Right; + _CreditNames.Add(CreditEntryDarkice); + + //flokuep + CDataBase.GetCreditsRessource("flokuep.png", ref tex); + CCreditName CreditEntryFlokuep = new CCreditName(); + CreditEntryFlokuep.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(-450, 580, 400, 120, -4)); + CreditEntryFlokuep.particleRect = new SRectF(CreditEntryFlokuep.image.Rect.X + 141, CreditEntryFlokuep.image.Rect.Y-2, 30, 30, -5); + CreditEntryFlokuep.particle = new CParticleEffect(8, new SColorF(1, 0, 0, 1), CreditEntryFlokuep.particleRect, particleTex, 35, EParticeType.Star); + CreditEntryFlokuep.active = true; + CreditEntryFlokuep.direction = EDirection.Left; + _CreditNames.Add(CreditEntryFlokuep); + + //bohning + CDataBase.GetCreditsRessource("bohning.png", ref tex); + CCreditName CreditEntryBohning = new CCreditName(); + CreditEntryBohning.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(CSettings.iRenderW, 580, 350, 110, -4)); + CreditEntryBohning.particleRect = new SRectF(CreditEntryBohning.image.Rect.X + 172, CreditEntryBohning.image.Rect.Y + 16, 10, 10, -5); + CreditEntryBohning.particle = new CParticleEffect(4, new SColorF(0.149f, 0.415f ,0.819f, 1), CreditEntryBohning.particleRect, particleTex, 25, EParticeType.Star); + CreditEntryBohning.active = true; + CreditEntryBohning.direction = EDirection.Right; + _CreditNames.Add(CreditEntryBohning); + + //mesand + CDataBase.GetCreditsRessource("mesand.png", ref tex); + CCreditName CreditEntryMesand = new CCreditName(); + CreditEntryMesand.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(-450, 580, 350, 110, -4)); + CreditEntryMesand.particleRect = new SRectF(CreditEntryMesand.image.Rect.X + 240, CreditEntryMesand.image.Rect.Y - 2, 10, 10, -5); + CreditEntryMesand.particle = new CParticleEffect(4, new SColorF(1, 0, 0, 1), CreditEntryMesand.particleRect, particleTex, 25, EParticeType.Star); + CreditEntryMesand.active = true; + CreditEntryMesand.direction = EDirection.Left; + _CreditNames.Add(CreditEntryMesand); + + //babene03 + CDataBase.GetCreditsRessource("babene03.png", ref tex); + CCreditName CreditEntryBabene03 = new CCreditName(); + CreditEntryBabene03.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(CSettings.iRenderW, 580, 350, 110, -4)); + CreditEntryBabene03.particleRect = new SRectF(CreditEntryBabene03.image.Rect.X + 7, CreditEntryBabene03.image.Rect.Y + 4, 10, 10, -5); + CreditEntryBabene03.particle = new CParticleEffect(4, new SColorF(0.149f, 0.415f ,0.819f, 1), CreditEntryBabene03.particleRect, particleTex, 25, EParticeType.Star); + CreditEntryBabene03.active = true; + CreditEntryBabene03.direction = EDirection.Right; + _CreditNames.Add(CreditEntryBabene03); + + //pantero + CDataBase.GetCreditsRessource("pantero.png", ref tex); + CCreditName CreditEntrypantero = new CCreditName(); + CreditEntrypantero.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(-450, 580, 350, 110, -4)); + CreditEntrypantero.particleRect = new SRectF(CreditEntrypantero.image.Rect.X + 140, CreditEntrypantero.image.Rect.Y + 15, 10, 10, -5); + CreditEntrypantero.particle = new CParticleEffect(4, new SColorF(1, 0, 0, 1), CreditEntrypantero.particleRect, particleTex, 25, EParticeType.Star); + CreditEntrypantero.active = true; + CreditEntrypantero.direction = EDirection.Left; + _CreditNames.Add(CreditEntrypantero); + + //Pinky007 + CDataBase.GetCreditsRessource("Pinky007.png", ref tex); + CCreditName CreditEntryPinky007 = new CCreditName(); + CreditEntryPinky007.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(CSettings.iRenderW, 580, 350, 110, -4)); + CreditEntryPinky007.particleRect = new SRectF(CreditEntryPinky007.image.Rect.X + 42, CreditEntryPinky007.image.Rect.Y + 15, 10, 10, -5); + CreditEntryPinky007.particle = new CParticleEffect(4, new SColorF(0.149f, 0.415f ,0.819f, 1), CreditEntryPinky007.particleRect, particleTex, 25, EParticeType.Star); + CreditEntryPinky007.active = true; + CreditEntryPinky007.direction = EDirection.Right; + _CreditNames.Add(CreditEntryPinky007); + + + //CreditEntry.image = new CStatic(tex, new SColorF(1, 1, 1, 1), new SRectF(0, 0, 350, 110, -4)); + + } + + public override void OnShowFinish() + { + base.OnShowFinish(); + + LogoTimer.Start(); + } + + public override bool Draw() + { + base.Draw(); + + //Draw background + CDraw.DrawColor(new SColorF(0, 0.18f, 0.474f, 1), new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, 0)); + + //Draw stars + starsBlue.Update(); + starsBlue.Draw(); + starsRed.Update(); + starsRed.Draw(); + + logo.Draw(); + + //Draw credit-entries + for (int i = 0; i < _CreditNames.Count; i++) + { + if (_CreditNames[i].active) + { + _CreditNames[i].image.Draw(); + _CreditNames[i].particle.Update(); + _CreditNames[i].particle.Draw(); + } + } + return true; + } + + private bool animation() + { + bool active = false; + if (LogoTimer.IsRunning) + { + active = true; + + logo.Rect.Y = -270 + (270f / 3000f) * LogoTimer.ElapsedMilliseconds; + SRectF rect = new SRectF(logo.Rect.X, logo.Rect.Y, logo.Rect.W, logo.Rect.H, -1); + starsRed.Area = rect; + starsBlue.Area = rect; + if (LogoTimer.ElapsedMilliseconds >= 2000 && !CreditsTimer.IsRunning) + { + CreditsTimer.Start(); + } + if (LogoTimer.ElapsedMilliseconds >= 3000) + { + LogoTimer.Stop(); + LogoTimer.Reset(); + } + } + + if (CreditsTimer.IsRunning) + { + active = true; + + for (int i = 0; i < _CreditNames.Count; i++) + { + if (_CreditNames[i].active) + { + switch (_CreditNames[i].direction) + { + case EDirection.Left: + if (i * 4000f <= CreditsTimer.ElapsedMilliseconds) + { + float xOld = _CreditNames[i].image.Rect.X; + _CreditNames[i].image.Rect.X = -450 + (((CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2)/3000f) * (CreditsTimer.ElapsedMilliseconds-(i*4000f)); + _CreditNames[i].particleRect.X += (_CreditNames[i].image.Rect.X - xOld); + _CreditNames[i].particle.Area = _CreditNames[i].particleRect; + + //Check if name is in middle of screen and should go up + if (_CreditNames[i].image.Rect.X >= (CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2) + { + _CreditNames[i].direction = EDirection.Up; + _CreditNames[i].StartTimeUp = CreditsTimer.ElapsedMilliseconds; + } + + } + break; + + case EDirection.Right: + if (i * 4000f <= CreditsTimer.ElapsedMilliseconds) + { + float xOld = _CreditNames[i].image.Rect.X; + _CreditNames[i].image.Rect.X = CSettings.iRenderW - (((CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2) / 3000f) * (CreditsTimer.ElapsedMilliseconds - (i * 4000f)); + _CreditNames[i].particleRect.X -= (xOld - _CreditNames[i].image.Rect.X); + _CreditNames[i].particle.Area = _CreditNames[i].particleRect; + + //Check if name is in middle of screen and should go up + if (_CreditNames[i].image.Rect.X <= (CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2 ) + { + _CreditNames[i].direction = EDirection.Up; + _CreditNames[i].StartTimeUp = CreditsTimer.ElapsedMilliseconds; + } + + } + break; + + case EDirection.Up: + float yOld = _CreditNames[i].image.Rect.Y; + _CreditNames[i].image.Rect.Y = 580 - (430f / 3000f) * (CreditsTimer.ElapsedMilliseconds - _CreditNames[i].StartTimeUp); + _CreditNames[i].particleRect.Y -= (yOld - _CreditNames[i].image.Rect.Y); + _CreditNames[i].particle.Area = _CreditNames[i].particleRect; + + //Fade names out + if (_CreditNames[i].image.Rect.Y <= 350f) + { + //Catch some bad alpha-values + float alpha = ((250 - _CreditNames[i].image.Rect.Y) / 20); + if(alpha > 1) + { + alpha = 1; + } + else if(alpha < 0) + { + alpha = 0; + } + _CreditNames[i].image.Alpha = 1 - alpha; + } + + //Set name inactive + if (_CreditNames[i].image.Rect.Y <= 150f) + { + _CreditNames[i].active = false; + //Check, if last name is set to false + if (i == _CreditNames.Count - 1) + { + //Will later fade to Main-Screen + active = false; + + //Stop and reset timer for next time + CreditsTimer.Stop(); + CreditsTimer.Reset(); + } + } + break; + } + } + } + } + + return active; + } + } +} diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs index 1ffa133c..e1b4cd00 100644 --- a/Vocaluxe/Screens/CScreenLoad.cs +++ b/Vocaluxe/Screens/CScreenLoad.cs @@ -138,7 +138,7 @@ namespace Vocaluxe.Screens _SongLoaderThread.Start(); _timer.Start(); - if (!CBackgroundMusic.IsPlaying()) + if (!CBackgroundMusic.Playing) CBackgroundMusic.Next(); } @@ -177,7 +177,7 @@ namespace Vocaluxe.Screens { CBackgroundMusic.AddOwnMusic(); - if (!CBackgroundMusic.IsPlaying()) + if (!CBackgroundMusic.Playing) CBackgroundMusic.Next(); } diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index 99c5e824..703c313a 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -65,6 +65,10 @@ namespace Vocaluxe.Screens CGraphics.FadeTo(EScreens.ScreenSong); break; + case Keys.C: + CGraphics.FadeTo(EScreens.ScreenCredits); + break; + case Keys.Enter: if (Buttons[htButtons(ButtonSing)].Selected) CGraphics.FadeTo(EScreens.ScreenSong); diff --git a/Vocaluxe/Screens/CScreenOptionsSound.cs b/Vocaluxe/Screens/CScreenOptionsSound.cs index a3fd049e..2e8207f7 100644 --- a/Vocaluxe/Screens/CScreenOptionsSound.cs +++ b/Vocaluxe/Screens/CScreenOptionsSound.cs @@ -12,7 +12,7 @@ namespace Vocaluxe.Screens class CScreenOptionsSound : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! - const int ScreenVersion = 1; + const int ScreenVersion = 2; private const string SelectSlideBackgroundMusic = "SelectSlideBackgroundMusic"; private const string SelectSlideBackgroundMusicVolume = "SelectSlideBackgroundMusicVolume"; diff --git a/Vocaluxe/Screens/CScreenOptionsVideo.cs b/Vocaluxe/Screens/CScreenOptionsVideo.cs index 04e9d4e1..fd693db6 100644 --- a/Vocaluxe/Screens/CScreenOptionsVideo.cs +++ b/Vocaluxe/Screens/CScreenOptionsVideo.cs @@ -12,11 +12,12 @@ namespace Vocaluxe.Screens class CScreenOptionsVideo : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! - const int ScreenVersion = 1; + const int ScreenVersion = 2; private const string SelectSlideVideoBackgrounds = "SelectSlideVideoBackgrounds"; private const string SelectSlideVideoPreview = "SelectSlideVideoPreview"; private const string SelectSlideVideosInSongs = "SelectSlideVideosInSongs"; + private const string SelectSlideVideosToBackground = "SelectSlideVideosToBackground"; private const string ButtonExit = "ButtonExit"; @@ -33,7 +34,7 @@ namespace Vocaluxe.Screens _ScreenVersion = ScreenVersion; _ThemeButtons = new string[] { ButtonExit }; - _ThemeSelectSlides = new string[] { SelectSlideVideoBackgrounds, SelectSlideVideoPreview, SelectSlideVideosInSongs }; + _ThemeSelectSlides = new string[] { SelectSlideVideoBackgrounds, SelectSlideVideoPreview, SelectSlideVideosInSongs, SelectSlideVideosToBackground }; } public override void LoadTheme() @@ -43,6 +44,7 @@ namespace Vocaluxe.Screens SelectSlides[htSelectSlides(SelectSlideVideoBackgrounds)].SetValues((int)CConfig.VideoBackgrounds); SelectSlides[htSelectSlides(SelectSlideVideoPreview)].SetValues((int)CConfig.VideoPreview); SelectSlides[htSelectSlides(SelectSlideVideosInSongs)].SetValues((int)CConfig.VideosInSongs); + SelectSlides[htSelectSlides(SelectSlideVideosToBackground)].SetValues((int)CConfig.VideosToBackground); } public override bool HandleInput(KeyEvent KeyEvent) @@ -110,6 +112,7 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { + SelectSlides[htSelectSlides(SelectSlideVideosToBackground)].Selection = (int)CConfig.VideosToBackground; return true; } @@ -124,6 +127,8 @@ namespace Vocaluxe.Screens CConfig.VideoBackgrounds = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideoBackgrounds)].Selection; CConfig.VideoPreview = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideoPreview)].Selection; CConfig.VideosInSongs = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideosInSongs)].Selection; + CConfig.VideosToBackground = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideosToBackground)].Selection; + CBackgroundMusic.VideoEnabled = true; CConfig.SaveConfig(); } diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 48ea1105..f1d4fe7e 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -326,7 +326,7 @@ namespace Vocaluxe.Screens } SetVisuability(); - CBackgroundMusic.Pause(); + CBackgroundMusic.Disabled = true; } public override void OnShowFinish() @@ -335,7 +335,7 @@ namespace Vocaluxe.Screens CGame.Start(); LoadNextSong(); - CBackgroundMusic.Pause(); + CBackgroundMusic.Disabled = true; } public override bool Draw() @@ -382,16 +382,16 @@ namespace Vocaluxe.Screens } break; } - - Lyrics[htLyrics(LyricMain)].Draw(CGame.Beat); Lyrics[htLyrics(LyricSub)].Draw(-100); + Lyrics[htLyrics(LyricMain)].Draw(CGame.Beat); - Lyrics[htLyrics(LyricMainDuet)].Draw(CGame.Beat); Lyrics[htLyrics(LyricSubDuet)].Draw(-100); + Lyrics[htLyrics(LyricMainDuet)].Draw(CGame.Beat); - Lyrics[htLyrics(LyricMainTop)].Draw(CGame.Beat); Lyrics[htLyrics(LyricSubTop)].Draw(-100); + Lyrics[htLyrics(LyricMainTop)].Draw(CGame.Beat); + for (int i = 0; i < CGame.NumPlayer; i++) { @@ -418,6 +418,7 @@ namespace Vocaluxe.Screens public override void OnClose() { base.OnClose(); + CBackgroundMusic.Disabled = false; CloseSong(); } @@ -581,7 +582,8 @@ namespace Vocaluxe.Screens lines[i] = song.Notes.GetLines(i); CLine[] line = lines[i].Line; - + + // find current line (it must be the same as in CalcFadingAlpha) int nr = -1; for (int j = 0; j < line.Length; j++) { @@ -850,6 +852,20 @@ namespace Vocaluxe.Screens lines[i] = Song.Notes.GetLines(i); CLine[] line = lines[i].Line; + // find current line for lyric sub fading (it must be the same as in UpdateLyrics) + int CurrentLineSub = 0; + for (int j = 0; j < line.Length; j++) + { + if (line[j].StartBeat <= _CurrentBeat) + { + if (CGame.GetTimeFromBeats(line[j].FirstBeat, Song.BPM) <= _CurrentTime - Song.Gap + 10f) + { + CurrentLineSub = j; + } + } + } + + // find current line for lyric main fading int CurrentLine = 0; for (int j = 0; j < line.Length; j++) { @@ -863,9 +879,11 @@ namespace Vocaluxe.Screens Alpha[i * 2] = 1f; Alpha[i * 2 + 1] = 1f; - // main + // main line alpha if (CurrentLine == 0 && CurrentTime < CGame.GetTimeFromBeats(line[CurrentLine].FirstBeat, Song.BPM)) { + // first main line and fist note is not reached + // => fade in float diff = CGame.GetTimeFromBeats(line[CurrentLine].FirstBeat, Song.BPM) - CurrentTime; if (diff > dt) { @@ -875,20 +893,29 @@ namespace Vocaluxe.Screens else if (CurrentLine < line.Length - 1 && CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM) < CurrentTime && CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) > CurrentTime) { + // current position is between two lines + + // time between the to lines float diff = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) - CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM); + // fade only if there is enough time for fading if (diff > 3.3f * dt) { + // time elapsed since last line float last = CurrentTime - CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM); + + // time to next line float next = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) - CurrentTime; if (last < next) { + // fade out Alpha[i * 2] = 1f - last / rt; } else { + // fade in if it is time for if (next > dt) Alpha[i * 2] = 1f - (next - dt) / rt; } @@ -896,14 +923,18 @@ namespace Vocaluxe.Screens } else if (CurrentLine == line.Length - 1 && CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM) < CurrentTime) { + // last main line and last note was reached + // => fade out float diff = CurrentTime - CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM); Alpha[i * 2] = 1f - diff / rt; } // sub - if (CurrentLine < line.Length - 2) + if (CurrentLineSub < line.Length - 2) { - float diff = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) - CurrentTime; + float diff = 0f; + diff = CGame.GetTimeFromBeats(line[CurrentLineSub + 1].FirstBeat, Song.BPM) - CurrentTime; + if (diff > dt) { Alpha[i * 2 + 1] = 1f - (diff - dt) / rt; diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index abc609de..5599b3ff 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -173,12 +173,12 @@ namespace Vocaluxe.Screens if ((CSongs.Category >= 0) && (song >= 0) && song < CSongs.VisibleSongs.Length) { Texts[htTexts(TextSelection)].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title; - CBackgroundMusic.Pause(); + CBackgroundMusic.Disabled = true; } else if ((CSongs.Category == -1) && (song >= 0) && song < CSongs.Categories.Length) { Texts[htTexts(TextSelection)].Text = CSongs.Categories[song].Name; - CBackgroundMusic.Play(); + CBackgroundMusic.Disabled = false; } else Texts[htTexts(TextSelection)].Text = String.Empty; @@ -213,6 +213,7 @@ namespace Vocaluxe.Screens public override void OnClose() { base.OnClose(); + CBackgroundMusic.Disabled = false; SongMenus[htSongMenus(SongMenu)].OnHide(); } diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index a62154d3..6f08fdce 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -188,6 +188,7 @@ Form +