Added new Options ShowVideo and Sing, ShowVideo is not working yet, need icon for sing button!

This commit is contained in:
Stephan Sundermann committed 2012-03-05 13:59:28 +01:00
1 parent 4593a3ae98
commit 9addfa0957
5 files changed
+341 -35

No files matched your search

@@ -253,5 +253,143 @@
<!-- <Space>: Reflection Space of selected button-->
<!-- <Height>: Reflection Height of selected button-->
</ButtonRepeat>
<ButtonShowVideo>
<!--<Skin>: Texture name-->
<Skin>VideoIcon</Skin>
<!--<SkinSelected>: Texture name for selected button-->
<SkinSelected>VideoIcon</SkinSelected>
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
<X>315</X>
<Y>0</Y>
<Z>0,00</Z>
<W>50</W>
<H>50</H>
<!--<Color>: Button color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>ButtonColor</Color>
<!--<SColor>: Selected button color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>ButtonSColor</SColor>
<Text>
<!--<X>, <Y>: Text position-->
<X>315</X>
<Y>0</Y>
<!--<H>: Text height-->
<H>32</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>142</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>ButtonTextColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>ButtonTextSColor</SColor>
<!--<Align>: Text align: Left, Center, Right-->
<Align>Center</Align>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Normal</Font>
<!--<Text>: Text or translation tag-->
<Text></Text>
</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
<!--<SReflection> If exists:-->
<!-- <Space>: Reflection Space of selected button-->
<!-- <Height>: Reflection Height of selected button-->
</ButtonShowVideo>
<ButtonSing>
<!--<Skin>: Texture name-->
<Skin>DuetIcon</Skin>
<!--<SkinSelected>: Texture name for selected button-->
<SkinSelected>DuetIcon</SkinSelected>
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
<X>380</X>
<Y>0</Y>
<Z>0,00</Z>
<W>50</W>
<H>50</H>
<!--<Color>: Button color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>ButtonColor</Color>
<!--<SColor>: Selected button color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>ButtonSColor</SColor>
<Text>
<!--<X>, <Y>: Text position-->
<X>380</X>
<Y>0</Y>
<!--<H>: Text height-->
<H>32</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>142</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>ButtonTextColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>ButtonTextSColor</SColor>
<!--<Align>: Text align: Left, Center, Right-->
<Align>Center</Align>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Normal</Font>
<!--<Text>: Text or translation tag-->
<Text></Text>
</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
<!--<SReflection> If exists:-->
<!-- <Space>: Reflection Space of selected button-->
<!-- <Height>: Reflection Height of selected button-->
</ButtonSing>
<TextCurrentSong>
<!--<X>, <Y>: Text position-->
<X>465</X>
<Y>0</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>50</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>825</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align: Left, Center, Right-->
<Align>Left</Align>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Normal</Font>
<!--<Text>: Text or translation tag-->
<Text />
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</TextCurrentSong>
<StaticCover>
<!--<Skin>: Texture name-->
<Skin>CoverBackground</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Static position, width and height-->
<X>0</X>
<Y>0</Y>
<Z>0,00</Z>
<W>50</W>
<H>50</H>
<!--<Color>: Static color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Visible</Color>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</StaticCover>
</PopupScreenPlayerControl>
</root>
+154 -26
View File
@@ -6,6 +6,8 @@ using System.IO;
using Vocaluxe.Base;
using System.Diagnostics;
using Vocaluxe.Lib.Song;
using Vocaluxe.Lib.Draw;
using System.Drawing;
namespace Vocaluxe.Base
{
@@ -14,23 +16,40 @@ 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<string> _AllFileNames = new List<string>();
private static List<string> _NotPlayedFileNames = new List<string>();
private static List<string> _BGMusicFileNames = new List<string>();
private static List<string> _PreviousFileNames = new List<string>();
private static PlaylistElement _CurrentPlaylistElement = new PlaylistElement();
private static List<PlaylistElement> _AllFileNames = new List<PlaylistElement>();
private static List<PlaylistElement> _NotPlayedFileNames = new List<PlaylistElement>();
private static List<PlaylistElement> _BGMusicFileNames = new List<PlaylistElement>();
private static List<PlaylistElement> _PreviousFileNames = new List<PlaylistElement>();
private static bool _OwnMusicAdded;
private static bool _BackgroundMusicAdded;
private static bool _Playing;
private static int _Video;
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));
foreach(string path in Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.mp3", true, true))
{
_BGMusicFileNames.Add(new PlaylistElement(path));
}
foreach(string path in Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.ogg", true, true))
{
_BGMusicFileNames.Add(new PlaylistElement(path));
}
foreach(string path in Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wma", true, true))
{
_BGMusicFileNames.Add(new PlaylistElement(path));
}
foreach(string path in Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wav", true, true))
{
_BGMusicFileNames.Add(new PlaylistElement(path));
}
if(CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
AddBackgroundMusic();
@@ -60,7 +79,7 @@ namespace Vocaluxe.Base
{
CSound.FadeAndStop(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime);
_CurrentMusicFilePath = String.Empty;
_CurrentPlaylistElement = new PlaylistElement();
_Playing = false;
}
@@ -91,10 +110,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 +121,10 @@ namespace Vocaluxe.Base
Stop();
_PreviousMusicIndex++;
_CurrentMusicFilePath = _PreviousFileNames[_PreviousMusicIndex];
_CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
}
_CurrentMusicStream = CSound.Load(_CurrentMusicFilePath);
_CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.GetMusicFilePath());
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
Play();
}
@@ -123,10 +142,9 @@ 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.GetMusicFilePath());
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
Play();
}
@@ -151,8 +169,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 +187,7 @@ namespace Vocaluxe.Base
_NotPlayedFileNames.AddRange(_BGMusicFileNames);
}
if (IsPlaying() && !IsBackgroundFile(_CurrentMusicFilePath) || _AllFileNames.Count == 0)
if (IsPlaying() && !IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
Next();
_OwnMusicAdded = false;
@@ -194,7 +212,7 @@ namespace Vocaluxe.Base
AddOwnMusic();
_BackgroundMusicAdded = false;
if (IsPlaying() && IsBackgroundFile(_CurrentMusicFilePath) || _AllFileNames.Count == 0)
if (IsPlaying() && IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
Next();
}
}
@@ -253,14 +271,124 @@ namespace Vocaluxe.Base
return CSound.IsPlaying(_CurrentMusicStream);
}
private static bool IsBackgroundFile(string FilePath)
public static string GetSongArtistAndTitle()
{
foreach (string file in _BGMusicFileNames)
return _CurrentPlaylistElement.GetArtist() +" - " + _CurrentPlaylistElement.GetTitle();
}
public static STexture GetCover()
{
return _CurrentPlaylistElement.GetCover();
}
public static void ToggleVideo()
{
_Video = CVideo.VdLoad(_CurrentPlaylistElement.GetVideoFilePath());
CVideo.VdSkip(_Video, CSound.GetLength(_CurrentMusicStream) / 4f, _CurrentPlaylistElement.GetVideoGap());
}
public static int GetSongNr()
{
return _CurrentPlaylistElement.GetSongNr();
}
public static bool IsDuet()
{
return _CurrentPlaylistElement.IsDuet();
}
private static bool IsBackgroundFile(PlaylistElement element)
{
foreach (PlaylistElement elements in _BGMusicFileNames)
{
if (file == FilePath)
if (elements.GetMusicFilePath() == element.GetMusicFilePath())
return true;
}
return false;
}
}
}
class PlaylistElement
{
string _Title;
string _Artist;
string _MusicFilePath;
string _VideoFilePath;
STexture _Cover;
float _VideoGap;
int _SongNr;
bool _Duet;
public PlaylistElement(CSong song)
{
_Title = song.Title;
_Artist = song.Artist;
_MusicFilePath = song.GetMP3();
_VideoFilePath = song.GetVideo();
_Cover = song.CoverTextureSmall;
_VideoGap = song.VideoGap;
_SongNr = song.ID;
_Duet = song.IsDuet;
}
public PlaylistElement(string FilePath)
{
_Title = "Unknown";
_Artist = "Unknown";
_MusicFilePath = FilePath;
_VideoFilePath = string.Empty;
_Cover = CCover.NoCover;
_SongNr = -1;
}
public PlaylistElement()
{
_Title = "Unknown";
_Artist = "Unknown";
_MusicFilePath = string.Empty;
_VideoFilePath = string.Empty;
_Cover = CCover.NoCover;
_SongNr = -1;
}
public string GetMusicFilePath()
{
return _MusicFilePath;
}
public string GetVideoFilePath()
{
return _VideoFilePath;
}
public string GetTitle()
{
return _Title;
}
public string GetArtist()
{
return _Artist;
}
public STexture GetCover()
{
return _Cover;
}
public float GetVideoGap()
{
return _VideoGap;
}
public int GetSongNr()
{
return _SongNr;
}
public bool IsDuet()
{
return _Duet;
}
}
+5
View File
@@ -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))
+7 -7
View File
@@ -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();
+37 -2
View File
@@ -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,17 @@ 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 TextCurrentSong = "TextCurrentSong";
public CPopupScreenPlayerControl()
{
@@ -36,7 +41,8 @@ namespace Vocaluxe.Screens
_ThemeName = "PopupScreenPlayerControl";
_ScreenVersion = ScreenVersion;
_ThemeStatics = new string[] { StaticBG, Cover };
_ThemeStatics = new string[] { StaticBG, StaticCover };
_ThemeTexts = new string[] { TextCurrentSong };
List<string> buttons = new List<string>();
buttons.Add(ButtonPlay);
@@ -44,6 +50,8 @@ namespace Vocaluxe.Screens
buttons.Add(ButtonPrevious);
buttons.Add(ButtonNext);
buttons.Add(ButtonRepeat);
buttons.Add(ButtonShowVideo);
buttons.Add(ButtonSing);
_ThemeButtons = buttons.ToArray();
}
@@ -81,6 +89,10 @@ namespace Vocaluxe.Screens
CBackgroundMusic.Pause();
if (Buttons[htButtons(ButtonRepeat)].Selected)
CBackgroundMusic.Repeat();
if (Buttons[htButtons(ButtonShowVideo)].Selected)
CBackgroundMusic.ToggleVideo();
if (Buttons[htButtons(ButtonSing)].Selected)
StartSong(CBackgroundMusic.GetSongNr(), CBackgroundMusic.IsDuet());
break;
}
}
@@ -103,6 +115,10 @@ namespace Vocaluxe.Screens
CBackgroundMusic.Pause();
if (Buttons[htButtons(ButtonRepeat)].Selected)
CBackgroundMusic.Repeat();
if (Buttons[htButtons(ButtonShowVideo)].Selected)
CBackgroundMusic.ToggleVideo();
if (Buttons[htButtons(ButtonSing)].Selected)
StartSong(CBackgroundMusic.GetSongNr(), CBackgroundMusic.IsDuet());
} else if (MouseEvent.LB)
{
CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
@@ -119,6 +135,8 @@ namespace Vocaluxe.Screens
{
Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.IsPlaying();
Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.IsPlaying();
Texts[htTexts(TextCurrentSong)].Text = CBackgroundMusic.GetSongArtistAndTitle();
Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.GetCover();
return true;
}
@@ -135,5 +153,22 @@ namespace Vocaluxe.Screens
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);
}
}
}
}