Use Properties instead of Methods
This commit is contained in:
1 parent
5e88cbc60c
commit
0bcb8804b7
7 files changed
+267
-226
No files matched your search
+246
-205
@@ -23,16 +23,94 @@ namespace Vocaluxe.Base
|
|||||||
private static List<PlaylistElement> _NotPlayedFileNames = new List<PlaylistElement>();
|
private static List<PlaylistElement> _NotPlayedFileNames = new List<PlaylistElement>();
|
||||||
private static List<PlaylistElement> _BGMusicFileNames = new List<PlaylistElement>();
|
private static List<PlaylistElement> _BGMusicFileNames = new List<PlaylistElement>();
|
||||||
private static List<PlaylistElement> _PreviousFileNames = 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 bool _VideoEnabled;
|
|
||||||
private static bool _Disabled;
|
|
||||||
|
|
||||||
private static int _Video = -1;
|
private static int _Video = -1;
|
||||||
private static STexture _CurrentVideoTexture = new STexture(-1);
|
private static STexture _CurrentVideoTexture = new STexture(-1);
|
||||||
private static Stopwatch _FadeTimer = new Stopwatch();
|
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
|
||||||
|
{
|
||||||
|
_VideoEnabled = value;
|
||||||
|
if (!_VideoEnabled)
|
||||||
|
ToggleVideo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
public static void Init()
|
||||||
{
|
{
|
||||||
@@ -51,7 +129,7 @@ namespace Vocaluxe.Base
|
|||||||
if(CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
|
if(CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
|
||||||
AddBackgroundMusic();
|
AddBackgroundMusic();
|
||||||
if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON)
|
if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON)
|
||||||
EnableVideo();
|
VideoEnabled = true;
|
||||||
|
|
||||||
_Playing = false;
|
_Playing = false;
|
||||||
}
|
}
|
||||||
@@ -66,7 +144,7 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CSettings.BackgroundMusicFadeTime);
|
CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CSettings.BackgroundMusicFadeTime);
|
||||||
CSound.Play(_CurrentMusicStream);
|
CSound.Play(_CurrentMusicStream);
|
||||||
if (_VideoEnabled && _Video != -1)
|
if (VideoEnabled && _Video != -1)
|
||||||
CVideo.VdResume(_Video);
|
CVideo.VdResume(_Video);
|
||||||
_Playing = true;
|
_Playing = true;
|
||||||
}
|
}
|
||||||
@@ -78,7 +156,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void Stop()
|
public static void Stop()
|
||||||
{
|
{
|
||||||
if (_VideoEnabled && _Video != -1)
|
if (VideoEnabled && _Video != -1)
|
||||||
{
|
{
|
||||||
CVideo.VdClose(_Video);
|
CVideo.VdClose(_Video);
|
||||||
CDraw.RemoveTexture(ref _CurrentVideoTexture);
|
CDraw.RemoveTexture(ref _CurrentVideoTexture);
|
||||||
@@ -92,10 +170,10 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void Pause()
|
public static void Pause()
|
||||||
{
|
{
|
||||||
if (_VideoEnabled && _Video != -1)
|
if (VideoEnabled && _Video != -1)
|
||||||
{
|
{
|
||||||
CVideo.VdPause(_Video);
|
CVideo.VdPause(_Video);
|
||||||
CVideo.VdSkip(_Video, CSound.GetPosition(_CurrentMusicStream) + CSettings.BackgroundMusicFadeTime, _CurrentPlaylistElement.GetVideoGap());
|
CVideo.VdSkip(_Video, CSound.GetPosition(_CurrentMusicStream) + CSettings.BackgroundMusicFadeTime, _CurrentPlaylistElement.VideoGap);
|
||||||
}
|
}
|
||||||
CSound.FadeAndPause(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime);
|
CSound.FadeAndPause(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime);
|
||||||
_Playing = false;
|
_Playing = false;
|
||||||
@@ -135,8 +213,8 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
_CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
|
_CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
|
||||||
}
|
}
|
||||||
_CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.GetMusicFilePath());
|
_CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath);
|
||||||
if (_VideoEnabled)
|
if (VideoEnabled)
|
||||||
LoadVideo();
|
LoadVideo();
|
||||||
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
|
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
|
||||||
Play();
|
Play();
|
||||||
@@ -157,8 +235,8 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
_CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
|
_CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
|
||||||
|
|
||||||
_CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.GetMusicFilePath());
|
_CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath);
|
||||||
if (_VideoEnabled)
|
if (VideoEnabled)
|
||||||
LoadVideo();
|
LoadVideo();
|
||||||
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
|
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
|
||||||
Play();
|
Play();
|
||||||
@@ -170,8 +248,8 @@ namespace Vocaluxe.Base
|
|||||||
if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1)
|
if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1)
|
||||||
{
|
{
|
||||||
CSound.SetPosition(_CurrentMusicStream, 0);
|
CSound.SetPosition(_CurrentMusicStream, 0);
|
||||||
if (_VideoEnabled && _Video != -1)
|
if (VideoEnabled && _Video != -1)
|
||||||
CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.GetVideoGap());
|
CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +282,7 @@ namespace Vocaluxe.Base
|
|||||||
_NotPlayedFileNames.AddRange(_BGMusicFileNames);
|
_NotPlayedFileNames.AddRange(_BGMusicFileNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPlaying() && !IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
|
if (Playing && !IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
|
||||||
Next();
|
Next();
|
||||||
|
|
||||||
_OwnMusicAdded = false;
|
_OwnMusicAdded = false;
|
||||||
@@ -229,7 +307,7 @@ namespace Vocaluxe.Base
|
|||||||
AddOwnMusic();
|
AddOwnMusic();
|
||||||
_BackgroundMusicAdded = false;
|
_BackgroundMusicAdded = false;
|
||||||
|
|
||||||
if (IsPlaying() && IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
|
if (Playing && IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
|
||||||
Next();
|
Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -283,28 +361,13 @@ namespace Vocaluxe.Base
|
|||||||
CConfig.SaveConfig();
|
CConfig.SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsPlaying()
|
|
||||||
{
|
|
||||||
return CSound.IsPlaying(_CurrentMusicStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetSongArtistAndTitle()
|
|
||||||
{
|
|
||||||
return _CurrentPlaylistElement.GetArtist() +" - " + _CurrentPlaylistElement.GetTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static STexture GetCover()
|
|
||||||
{
|
|
||||||
return _CurrentPlaylistElement.GetCover();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ToggleVideo()
|
public static void ToggleVideo()
|
||||||
{
|
{
|
||||||
if (_Video != -1)
|
if (_Video != -1)
|
||||||
{
|
{
|
||||||
if (_VideoEnabled)
|
if (VideoEnabled)
|
||||||
{
|
{
|
||||||
_VideoEnabled = false;
|
VideoEnabled = false;
|
||||||
CVideo.VdClose(_Video);
|
CVideo.VdClose(_Video);
|
||||||
_Video = -1;
|
_Video = -1;
|
||||||
CDraw.RemoveTexture(ref _CurrentVideoTexture);
|
CDraw.RemoveTexture(ref _CurrentVideoTexture);
|
||||||
@@ -342,31 +405,11 @@ namespace Vocaluxe.Base
|
|||||||
return new STexture(-1);
|
return new STexture(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetSongNr()
|
|
||||||
{
|
|
||||||
return _CurrentPlaylistElement.GetSongNr();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsDuet()
|
|
||||||
{
|
|
||||||
return _CurrentPlaylistElement.IsDuet();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsVideoEnabled()
|
|
||||||
{
|
|
||||||
return _VideoEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool HasVideo()
|
|
||||||
{
|
|
||||||
return File.Exists(_CurrentPlaylistElement.GetVideoFilePath());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsBackgroundFile(PlaylistElement element)
|
private static bool IsBackgroundFile(PlaylistElement element)
|
||||||
{
|
{
|
||||||
foreach (PlaylistElement elements in _BGMusicFileNames)
|
foreach (PlaylistElement elements in _BGMusicFileNames)
|
||||||
{
|
{
|
||||||
if (elements.GetMusicFilePath() == element.GetMusicFilePath())
|
if (elements.MusicFilePath == element.MusicFilePath)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -376,176 +419,174 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
if (_Video == -1)
|
if (_Video == -1)
|
||||||
{
|
{
|
||||||
_Video = CVideo.VdLoad(_CurrentPlaylistElement.GetVideoFilePath());
|
_Video = CVideo.VdLoad(_CurrentPlaylistElement.VideoFilePath);
|
||||||
CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.GetVideoGap());
|
CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
|
||||||
_VideoEnabled = true;
|
VideoEnabled = true;
|
||||||
_FadeTimer.Reset();
|
_FadeTimer.Reset();
|
||||||
_FadeTimer.Start();
|
_FadeTimer.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EnableVideo()
|
|
||||||
{
|
|
||||||
if (!_VideoEnabled)
|
|
||||||
ToggleVideo();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Disable()
|
|
||||||
{
|
|
||||||
Pause();
|
|
||||||
_Disabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Enable()
|
|
||||||
{
|
|
||||||
Play();
|
|
||||||
_Disabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsEnabled()
|
|
||||||
{
|
|
||||||
return !_Disabled;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PlaylistElement
|
class PlaylistElement
|
||||||
{
|
{
|
||||||
string _MusicFilePath;
|
public int _SongID;
|
||||||
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)
|
public PlaylistElement(CSong song)
|
||||||
{
|
{
|
||||||
_MusicFilePath = string.Empty;
|
//MusicFilePath = string.Empty;
|
||||||
_SongID = song.ID;
|
_SongID = song.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlaylistElement(string FilePath)
|
public PlaylistElement(string FilePath)
|
||||||
{
|
{
|
||||||
_MusicFilePath = FilePath;
|
//MusicFilePath = FilePath;
|
||||||
_SongID = -1;
|
_SongID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlaylistElement()
|
public PlaylistElement()
|
||||||
{
|
{
|
||||||
_MusicFilePath = string.Empty;
|
//MusicFilePath = string.Empty;
|
||||||
_SongID = -1;
|
_SongID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetMusicFilePath()
|
|
||||||
{
|
|
||||||
if (_SongID >= 0)
|
|
||||||
{
|
|
||||||
CSong song = CSongs.GetSong(_SongID);
|
|
||||||
if (song != null)
|
|
||||||
return song.GetMP3();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_SongID = -1;
|
|
||||||
CLog.LogError("Song not found");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _MusicFilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetVideoFilePath()
|
|
||||||
{
|
|
||||||
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 GetTitle()
|
|
||||||
{
|
|
||||||
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 GetArtist()
|
|
||||||
{
|
|
||||||
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 GetCover()
|
|
||||||
{
|
|
||||||
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 GetVideoGap()
|
|
||||||
{
|
|
||||||
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 int GetSongNr()
|
|
||||||
{
|
|
||||||
return _SongID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsDuet()
|
|
||||||
{
|
|
||||||
if (_SongID >= 0)
|
|
||||||
{
|
|
||||||
CSong song = CSongs.GetSong(_SongID);
|
|
||||||
if (song != null)
|
|
||||||
return song.IsDuet;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_SongID = -1;
|
|
||||||
CLog.LogError("Song not found");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ namespace Vocaluxe.Menu
|
|||||||
public bool Draw()
|
public bool Draw()
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
if (_Theme.Type == EBackgroundTypes.Video && CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON && CBackgroundMusic.IsPlaying() && CBackgroundMusic.HasVideo() && CBackgroundMusic.IsVideoEnabled() && CBackgroundMusic.IsEnabled())
|
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();
|
Pause();
|
||||||
ok = DrawBackgroundMusicVideo();
|
ok = DrawBackgroundMusicVideo();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Vocaluxe.Screens
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CConfig.VideosToBackground = EOffOn.TR_CONFIG_ON;
|
CConfig.VideosToBackground = EOffOn.TR_CONFIG_ON;
|
||||||
CBackgroundMusic.EnableVideo();
|
CBackgroundMusic.VideoEnabled = true;
|
||||||
}
|
}
|
||||||
CConfig.SaveConfig();
|
CConfig.SaveConfig();
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ namespace Vocaluxe.Screens
|
|||||||
if (Buttons[htButtons(ButtonShowVideo)].Selected)
|
if (Buttons[htButtons(ButtonShowVideo)].Selected)
|
||||||
TogglePreviewVideo();
|
TogglePreviewVideo();
|
||||||
if (Buttons[htButtons(ButtonSing)].Selected)
|
if (Buttons[htButtons(ButtonSing)].Selected)
|
||||||
StartSong(CBackgroundMusic.GetSongNr(), CBackgroundMusic.IsDuet());
|
StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet);
|
||||||
if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected)
|
if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected)
|
||||||
ToggleBackgroundVideo();
|
ToggleBackgroundVideo();
|
||||||
break;
|
break;
|
||||||
@@ -146,7 +146,7 @@ namespace Vocaluxe.Screens
|
|||||||
if (Buttons[htButtons(ButtonShowVideo)].Selected)
|
if (Buttons[htButtons(ButtonShowVideo)].Selected)
|
||||||
TogglePreviewVideo();
|
TogglePreviewVideo();
|
||||||
if (Buttons[htButtons(ButtonSing)].Selected)
|
if (Buttons[htButtons(ButtonSing)].Selected)
|
||||||
StartSong(CBackgroundMusic.GetSongNr(), CBackgroundMusic.IsDuet());
|
StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet);
|
||||||
if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected)
|
if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected)
|
||||||
ToggleBackgroundVideo();
|
ToggleBackgroundVideo();
|
||||||
} else if (MouseEvent.LB)
|
} else if (MouseEvent.LB)
|
||||||
@@ -178,13 +178,13 @@ namespace Vocaluxe.Screens
|
|||||||
{
|
{
|
||||||
if (!_Active)
|
if (!_Active)
|
||||||
return false;
|
return false;
|
||||||
Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.GetCover();
|
Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.Cover;
|
||||||
if (CBackgroundMusic.IsVideoEnabled() && CBackgroundMusic.HasVideo())
|
if (CBackgroundMusic.VideoEnabled && CBackgroundMusic.SongHasVideo)
|
||||||
CDraw.DrawTexture(Statics[htStatics(StaticCover)], CBackgroundMusic.GetVideoTexture(), EAspect.Crop);
|
CDraw.DrawTexture(Statics[htStatics(StaticCover)], CBackgroundMusic.GetVideoTexture(), EAspect.Crop);
|
||||||
Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.IsPlaying();
|
Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.Playing;
|
||||||
Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.IsPlaying();
|
Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.Playing;
|
||||||
Texts[htTexts(TextCurrentSong)].Text = CBackgroundMusic.GetSongArtistAndTitle();
|
Texts[htTexts(TextCurrentSong)].Text = CBackgroundMusic.ArtistAndTitle;
|
||||||
if (CBackgroundMusic.IsVideoEnabled())
|
if (CBackgroundMusic.VideoEnabled)
|
||||||
Buttons[htButtons(ButtonShowVideo)].SColor = CTheme.GetColor("ButtonSColor");
|
Buttons[htButtons(ButtonShowVideo)].SColor = CTheme.GetColor("ButtonSColor");
|
||||||
|
|
||||||
return base.Draw();
|
return base.Draw();
|
||||||
@@ -218,7 +218,7 @@ namespace Vocaluxe.Screens
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CConfig.VideosToBackground = EOffOn.TR_CONFIG_ON;
|
CConfig.VideosToBackground = EOffOn.TR_CONFIG_ON;
|
||||||
CBackgroundMusic.EnableVideo();
|
CBackgroundMusic.VideoEnabled = true;
|
||||||
}
|
}
|
||||||
CConfig.SaveConfig();
|
CConfig.SaveConfig();
|
||||||
}
|
}
|
||||||
@@ -229,7 +229,7 @@ namespace Vocaluxe.Screens
|
|||||||
if (!_VideoPreview && !_VideoBackground)
|
if (!_VideoPreview && !_VideoBackground)
|
||||||
CBackgroundMusic.ToggleVideo();
|
CBackgroundMusic.ToggleVideo();
|
||||||
else
|
else
|
||||||
CBackgroundMusic.EnableVideo();
|
CBackgroundMusic.VideoEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ namespace Vocaluxe.Screens
|
|||||||
_SongLoaderThread.Start();
|
_SongLoaderThread.Start();
|
||||||
_timer.Start();
|
_timer.Start();
|
||||||
|
|
||||||
if (!CBackgroundMusic.IsPlaying())
|
if (!CBackgroundMusic.Playing)
|
||||||
CBackgroundMusic.Next();
|
CBackgroundMusic.Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ namespace Vocaluxe.Screens
|
|||||||
{
|
{
|
||||||
CBackgroundMusic.AddOwnMusic();
|
CBackgroundMusic.AddOwnMusic();
|
||||||
|
|
||||||
if (!CBackgroundMusic.IsPlaying())
|
if (!CBackgroundMusic.Playing)
|
||||||
CBackgroundMusic.Next();
|
CBackgroundMusic.Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ namespace Vocaluxe.Screens
|
|||||||
CConfig.VideoPreview = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideoPreview)].Selection;
|
CConfig.VideoPreview = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideoPreview)].Selection;
|
||||||
CConfig.VideosInSongs = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideosInSongs)].Selection;
|
CConfig.VideosInSongs = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideosInSongs)].Selection;
|
||||||
CConfig.VideosToBackground = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideosToBackground)].Selection;
|
CConfig.VideosToBackground = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideosToBackground)].Selection;
|
||||||
CBackgroundMusic.EnableVideo();
|
CBackgroundMusic.VideoEnabled = true;
|
||||||
|
|
||||||
CConfig.SaveConfig();
|
CConfig.SaveConfig();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ namespace Vocaluxe.Screens
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetVisuability();
|
SetVisuability();
|
||||||
CBackgroundMusic.Disable();
|
CBackgroundMusic.Disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnShowFinish()
|
public override void OnShowFinish()
|
||||||
@@ -335,7 +335,7 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
CGame.Start();
|
CGame.Start();
|
||||||
LoadNextSong();
|
LoadNextSong();
|
||||||
CBackgroundMusic.Disable();
|
CBackgroundMusic.Disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Draw()
|
public override bool Draw()
|
||||||
@@ -418,7 +418,7 @@ namespace Vocaluxe.Screens
|
|||||||
public override void OnClose()
|
public override void OnClose()
|
||||||
{
|
{
|
||||||
base.OnClose();
|
base.OnClose();
|
||||||
CBackgroundMusic.Enable();
|
CBackgroundMusic.Disabled = false;
|
||||||
CloseSong();
|
CloseSong();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,12 +173,12 @@ namespace Vocaluxe.Screens
|
|||||||
if ((CSongs.Category >= 0) && (song >= 0) && song < CSongs.VisibleSongs.Length)
|
if ((CSongs.Category >= 0) && (song >= 0) && song < CSongs.VisibleSongs.Length)
|
||||||
{
|
{
|
||||||
Texts[htTexts(TextSelection)].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title;
|
Texts[htTexts(TextSelection)].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title;
|
||||||
CBackgroundMusic.Disable();
|
CBackgroundMusic.Disabled = true;
|
||||||
}
|
}
|
||||||
else if ((CSongs.Category == -1) && (song >= 0) && song < CSongs.Categories.Length)
|
else if ((CSongs.Category == -1) && (song >= 0) && song < CSongs.Categories.Length)
|
||||||
{
|
{
|
||||||
Texts[htTexts(TextSelection)].Text = CSongs.Categories[song].Name;
|
Texts[htTexts(TextSelection)].Text = CSongs.Categories[song].Name;
|
||||||
CBackgroundMusic.Enable();
|
CBackgroundMusic.Disabled = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Texts[htTexts(TextSelection)].Text = String.Empty;
|
Texts[htTexts(TextSelection)].Text = String.Empty;
|
||||||
@@ -213,7 +213,7 @@ namespace Vocaluxe.Screens
|
|||||||
public override void OnClose()
|
public override void OnClose()
|
||||||
{
|
{
|
||||||
base.OnClose();
|
base.OnClose();
|
||||||
CBackgroundMusic.Enable();
|
CBackgroundMusic.Disabled = false;
|
||||||
SongMenus[htSongMenus(SongMenu)].OnHide();
|
SongMenus[htSongMenus(SongMenu)].OnHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user