a little performance patch for bg music

This commit is contained in:
Alexander Eckart committed 2012-06-24 18:26:43 +02:00
1 parent 00998a9fd0
commit b82b30aea4
1 file changed
+33 -80
+33 -80
View File
@@ -88,7 +88,7 @@ namespace Vocaluxe.Base
{ {
get get
{ {
return _CurrentPlaylistElement._SongID; return _CurrentPlaylistElement.SongID;
} }
} }
@@ -465,24 +465,23 @@ namespace Vocaluxe.Base
class PlaylistElement class PlaylistElement
{ {
public int _SongID; private CSong _Song = null;
private string _MusicFilePath;
private int _SongID;
public int SongID
{
get { return _SongID; }
}
private string _MusicFilePath = String.Empty;
public string MusicFilePath public string MusicFilePath
{ {
get get
{ {
if (_SongID >= 0) if (_Song != null)
{ return _Song.GetMP3();
CSong song = CSongs.GetSong(_SongID);
if (song != null)
return song.GetMP3();
else
{
_SongID = -1;
CLog.LogError("Song not found");
}
}
return _MusicFilePath; return _MusicFilePath;
} }
@@ -496,17 +495,9 @@ class PlaylistElement
{ {
get get
{ {
if (_SongID >= 0) if (_Song != null)
{ return _Song.GetVideo();
CSong song = CSongs.GetSong(_SongID);
if (song != null)
return song.GetVideo();
else
{
_SongID = -1;
CLog.LogError("Song not found");
}
}
return string.Empty; return string.Empty;
} }
} }
@@ -515,17 +506,9 @@ class PlaylistElement
{ {
get get
{ {
if (_SongID >= 0) if (_Song != null)
{ return _Song.Title;
CSong song = CSongs.GetSong(_SongID);
if (song != null)
return song.Title;
else
{
_SongID = -1;
CLog.LogError("Song not found");
}
}
return "Unknown"; return "Unknown";
} }
} }
@@ -534,17 +517,9 @@ class PlaylistElement
{ {
get get
{ {
if (_SongID >= 0) if (_Song != null)
{ return _Song.Artist;
CSong song = CSongs.GetSong(_SongID);
if (song != null)
return song.Artist;
else
{
_SongID = -1;
CLog.LogError("Song not found");
}
}
return "Unknown"; return "Unknown";
} }
} }
@@ -553,17 +528,9 @@ class PlaylistElement
{ {
get get
{ {
if (_SongID >= 0) if (_Song != null)
{ return _Song.CoverTextureSmall;
CSong song = CSongs.GetSong(_SongID);
if (song != null)
return song.CoverTextureSmall;
else
{
_SongID = -1;
CLog.LogError("Song not found");
}
}
return CCover.NoCover; return CCover.NoCover;
} }
} }
@@ -572,17 +539,9 @@ class PlaylistElement
{ {
get get
{ {
if (_SongID >= 0) if (_Song != null)
{ return _Song.VideoGap;
CSong song = CSongs.GetSong(_SongID);
if (song != null)
return song.VideoGap;
else
{
_SongID = -1;
CLog.LogError("Song not found");
}
}
return 0; return 0;
} }
} }
@@ -591,17 +550,9 @@ class PlaylistElement
{ {
get get
{ {
if (_SongID >= 0) if (_Song != null)
{ return _Song.IsDuet;
CSong song = CSongs.GetSong(_SongID);
if (song != null)
return song.IsDuet;
else
{
_SongID = -1;
CLog.LogError("Song not found");
}
}
return false; return false;
} }
} }
@@ -610,6 +561,8 @@ class PlaylistElement
{ {
MusicFilePath = string.Empty; MusicFilePath = string.Empty;
_SongID = song.ID; _SongID = song.ID;
_Song = song;
} }
public PlaylistElement(string FilePath) public PlaylistElement(string FilePath)