Change preview-player. Now it's part of bg-music.
This commit is contained in:
1 parent
0a7006db43
commit
c6e8854dda
12 files changed
+155
-189
No files matched your search
@@ -38,12 +38,10 @@ namespace VocaluxeLib
|
||||
public static IDataBase DataBase;
|
||||
public static IControllers Controller;
|
||||
public static IPlaylist Playlist;
|
||||
public static IPreviewPlayer PreviewPlayer;
|
||||
|
||||
public static void Assign(IConfig config, ISettings settings, ITheme theme, ILog log, IBackgroundMusic backgroundMusic,
|
||||
IDrawing draw, IGraphics graphics, IFonts fonts, ILanguage language, IGame game, IProfiles profiles, IRecording record,
|
||||
ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IControllers controller, IPlaylist playlist,
|
||||
IPreviewPlayer previewPlayer)
|
||||
ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IControllers controller, IPlaylist playlist)
|
||||
{
|
||||
Config = config;
|
||||
Settings = settings;
|
||||
@@ -64,7 +62,6 @@ namespace VocaluxeLib
|
||||
DataBase = dataBase;
|
||||
Controller = controller;
|
||||
Playlist = playlist;
|
||||
PreviewPlayer = previewPlayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,16 +119,23 @@ namespace VocaluxeLib
|
||||
{
|
||||
bool IsDisabled();
|
||||
bool IsPlaying();
|
||||
bool IsPlayingPreview();
|
||||
bool SongHasVideo();
|
||||
bool VideoEnabled();
|
||||
float GetLength();
|
||||
|
||||
void SetDisabled(bool disabled);
|
||||
void Next();
|
||||
void Previous();
|
||||
void Pause();
|
||||
void Play();
|
||||
void Stop();
|
||||
|
||||
CTexture GetVideoTexture();
|
||||
|
||||
void LoadPreview(CSong song, float start = 0f);
|
||||
void PlayPreview(float start = -1f);
|
||||
|
||||
}
|
||||
|
||||
public interface IDrawing
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
else if (value >= CBase.Songs.GetNumCategories())
|
||||
{
|
||||
value = -1;
|
||||
CBase.PreviewPlayer.Stop();
|
||||
CBase.BackgroundMusic.Stop();
|
||||
}
|
||||
|
||||
_PreviewNrInternal = value;
|
||||
@@ -395,8 +395,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (!_Initialized || !Visible)
|
||||
return;
|
||||
|
||||
if (CBase.PreviewPlayer.IsPlaying())
|
||||
CBase.Drawing.DrawTexture(CBase.PreviewPlayer.GetVideoTexture(), new SRectF(0, 0, 1280, 720, 0));
|
||||
if (CBase.BackgroundMusic.IsPlaying())
|
||||
CBase.Drawing.DrawTexture(CBase.BackgroundMusic.GetVideoTexture(), new SRectF(0, 0, 1280, 720, 0));
|
||||
}
|
||||
|
||||
public bool IsMouseOverSelectedSong(SMouseEvent mEvent)
|
||||
@@ -506,23 +506,23 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (song == null)
|
||||
return;
|
||||
|
||||
CBase.PreviewPlayer.Load(song);
|
||||
CBase.BackgroundMusic.LoadPreview(song);
|
||||
|
||||
float startposition = song.Preview.StartTime;
|
||||
|
||||
float length = CBase.PreviewPlayer.GetLength();
|
||||
float length = CBase.BackgroundMusic.GetLength();
|
||||
|
||||
if (song.Preview.Source == EDataSource.None)
|
||||
startposition = length / 4f;
|
||||
else if (startposition > length - 5f)
|
||||
startposition = Math.Max(0f, Math.Min(length / 4f, length - 5f));
|
||||
|
||||
CBase.PreviewPlayer.Play(startposition);
|
||||
CBase.BackgroundMusic.PlayPreview(startposition);
|
||||
}
|
||||
|
||||
protected void _ResetPreview()
|
||||
{
|
||||
CBase.PreviewPlayer.Stop();
|
||||
CBase.BackgroundMusic.Stop();
|
||||
|
||||
//Make sure we don't have a preview here otherwise a change won't be recognized
|
||||
//(e.g. leave a category with one song and set preview to 0 --> previewOld=previewNew=0 --> No change --> Old data shown
|
||||
|
||||
@@ -111,8 +111,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (value == base._PreviewNr)
|
||||
{
|
||||
if (!CBase.PreviewPlayer.IsPlaying())
|
||||
CBase.PreviewPlayer.Play();
|
||||
if (!CBase.BackgroundMusic.IsPlaying())
|
||||
CBase.BackgroundMusic.PlayPreview();
|
||||
return;
|
||||
}
|
||||
base._PreviewNr = value;
|
||||
@@ -183,7 +183,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (songOptions.Selection.RandomOnly)
|
||||
_PreviewNr = _SelectionNr;
|
||||
|
||||
if (_Length < 0 && CBase.Songs.IsInCategory() && CBase.PreviewPlayer.GetLength() > 0)
|
||||
if (_Length < 0 && CBase.Songs.IsInCategory() && CBase.BackgroundMusic.GetLength() > 0)
|
||||
_UpdateLength(CBase.Songs.GetVisibleSong(_PreviewNr));
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (song == null)
|
||||
return;
|
||||
float time = CBase.PreviewPlayer.GetLength();
|
||||
float time = CBase.BackgroundMusic.GetLength();
|
||||
if (Math.Abs(song.Finish) > 0.001)
|
||||
time = song.Finish;
|
||||
|
||||
@@ -467,7 +467,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
_TextBG.Draw();
|
||||
|
||||
CTexture vidtex = CBase.PreviewPlayer.GetVideoTexture();
|
||||
CTexture vidtex = CBase.BackgroundMusic.GetVideoTexture();
|
||||
|
||||
if (vidtex != null)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user