Fixed EAspect.Letterbox

Removed "Vd" prefixes on IVideo functions
This commit is contained in:
Flamefire committed 2013-05-03 19:09:26 +02:00
1 parent c89b9dc8be
commit 2018f3a16b
10 files changed
+100 -116

No files matched your search

+17 -17
View File
@@ -155,7 +155,7 @@ namespace Vocaluxe.Base
CSound.Fade(_CurrentMusicStream, 100f, CSettings.BackgroundMusicFadeTime); CSound.Fade(_CurrentMusicStream, 100f, CSettings.BackgroundMusicFadeTime);
CSound.Play(_CurrentMusicStream); CSound.Play(_CurrentMusicStream);
if (_VideoEnabled && _Video != -1) if (_VideoEnabled && _Video != -1)
CVideo.VdResume(_Video); CVideo.Resume(_Video);
IsPlaying = true; IsPlaying = true;
} }
else else
@@ -173,7 +173,7 @@ namespace Vocaluxe.Base
if (_VideoEnabled && _Video != -1) if (_VideoEnabled && _Video != -1)
{ {
CVideo.VdClose(_Video); CVideo.Close(_Video);
CDraw.RemoveTexture(ref _CurrentVideoTexture); CDraw.RemoveTexture(ref _CurrentVideoTexture);
_Video = -1; _Video = -1;
} }
@@ -191,8 +191,8 @@ namespace Vocaluxe.Base
if (_VideoEnabled && _Video != -1) if (_VideoEnabled && _Video != -1)
{ {
CVideo.VdPause(_Video); CVideo.Pause(_Video);
CVideo.VdSkip(_Video, CSound.GetPosition(_CurrentMusicStream) + CSettings.BackgroundMusicFadeTime, _CurrentPlaylistElement.VideoGap); CVideo.Skip(_Video, CSound.GetPosition(_CurrentMusicStream) + CSettings.BackgroundMusicFadeTime, _CurrentPlaylistElement.VideoGap);
} }
CSound.FadeAndPause(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime); CSound.FadeAndPause(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime);
IsPlaying = false; IsPlaying = false;
@@ -221,9 +221,9 @@ namespace Vocaluxe.Base
if (_VideoEnabled && _Video != -1) if (_VideoEnabled && _Video != -1)
{ {
if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); CVideo.Skip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap);
else else
CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); CVideo.Skip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
} }
} }
else else
@@ -287,9 +287,9 @@ namespace Vocaluxe.Base
if (_VideoEnabled && _Video != -1) if (_VideoEnabled && _Video != -1)
{ {
if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); CVideo.Skip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap);
else else
CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); CVideo.Skip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
} }
} }
else else
@@ -319,9 +319,9 @@ namespace Vocaluxe.Base
if (_VideoEnabled && _Video != -1) if (_VideoEnabled && _Video != -1)
{ {
if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); CVideo.Skip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap);
else else
CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); CVideo.Skip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
} }
} }
} }
@@ -441,14 +441,14 @@ namespace Vocaluxe.Base
if (_VideoEnabled) if (_VideoEnabled)
{ {
_VideoEnabled = false; _VideoEnabled = false;
CVideo.VdClose(_Video); CVideo.Close(_Video);
_Video = -1; _Video = -1;
CDraw.RemoveTexture(ref _CurrentVideoTexture); CDraw.RemoveTexture(ref _CurrentVideoTexture);
return; return;
} }
if (CVideo.VdFinished(_Video)) if (CVideo.Finished(_Video))
{ {
CVideo.VdClose(_Video); CVideo.Close(_Video);
CDraw.RemoveTexture(ref _CurrentVideoTexture); CDraw.RemoveTexture(ref _CurrentVideoTexture);
_Video = -1; _Video = -1;
} }
@@ -462,7 +462,7 @@ namespace Vocaluxe.Base
if (_Video != -1) if (_Video != -1)
{ {
float vtime; float vtime;
CVideo.VdGetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), out vtime); CVideo.GetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), out vtime);
if (_FadeTimer.ElapsedMilliseconds <= 3000L) if (_FadeTimer.ElapsedMilliseconds <= 3000L)
_CurrentVideoTexture.Color.A = _FadeTimer.ElapsedMilliseconds / 3000f; _CurrentVideoTexture.Color.A = _FadeTimer.ElapsedMilliseconds / 3000f;
else else
@@ -484,11 +484,11 @@ namespace Vocaluxe.Base
{ {
if (_Video == -1) if (_Video == -1)
{ {
_Video = CVideo.VdLoad(_CurrentPlaylistElement.VideoFilePath); _Video = CVideo.Load(_CurrentPlaylistElement.VideoFilePath);
if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); CVideo.Skip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap);
else else
CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); CVideo.Skip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
_VideoEnabled = true; _VideoEnabled = true;
_FadeTimer.Reset(); _FadeTimer.Reset();
_FadeTimer.Start(); _FadeTimer.Start();
+2 -2
View File
@@ -200,9 +200,9 @@ namespace Vocaluxe.Base
return; return;
RectangleF bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H); 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); RectangleF rect;
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, aspect); CHelper.SetRect(bounds, out rect, texture.Width / texture.Height, aspect);
DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z), 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)); texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f));
} }
+5 -5
View File
@@ -672,27 +672,27 @@ namespace Vocaluxe.Base
{ {
public int Load(string videoFileName) public int Load(string videoFileName)
{ {
return CVideo.VdLoad(videoFileName); return CVideo.Load(videoFileName);
} }
public bool Skip(int videoStream, float startPosition, float videoGap) public bool Skip(int videoStream, float startPosition, float videoGap)
{ {
return CVideo.VdSkip(videoStream, startPosition, videoGap); return CVideo.Skip(videoStream, startPosition, videoGap);
} }
public bool GetFrame(int videoStream, ref STexture videoTexture, float time, out float videoTime) public bool GetFrame(int videoStream, ref STexture videoTexture, float time, out float videoTime)
{ {
return CVideo.VdGetFrame(videoStream, ref videoTexture, time, out videoTime); return CVideo.GetFrame(videoStream, ref videoTexture, time, out videoTime);
} }
public bool IsFinished(int videoStream) public bool IsFinished(int videoStream)
{ {
return CVideo.VdFinished(videoStream); return CVideo.Finished(videoStream);
} }
public bool Close(int videoStream) public bool Close(int videoStream)
{ {
return CVideo.VdClose(videoStream); return CVideo.Close(videoStream);
} }
} }
+13 -13
View File
@@ -199,9 +199,9 @@ namespace Vocaluxe.Base
{ {
xmlReader.GetValue("//root/Videos/" + _Skins[skinIndex].VideoList[i].Name, out value, String.Empty); xmlReader.GetValue("//root/Videos/" + _Skins[skinIndex].VideoList[i].Name, out value, String.Empty);
SSkinElement sk = new SSkinElement {Name = _Skins[skinIndex].VideoList[i].Name, Value = value}; SSkinElement sk = new SSkinElement {Name = _Skins[skinIndex].VideoList[i].Name, Value = value};
sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[skinIndex].Path, sk.Value)); sk.VideoIndex = CVideo.Load(Path.Combine(_Skins[skinIndex].Path, sk.Value));
CVideo.VdSetLoop(sk.VideoIndex, true); CVideo.SetLoop(sk.VideoIndex, true);
CVideo.VdPause(sk.VideoIndex); CVideo.Pause(sk.VideoIndex);
sk.Texture = new STexture(-1); sk.Texture = new STexture(-1);
_Skins[skinIndex].VideoList[i] = sk; _Skins[skinIndex].VideoList[i] = sk;
} }
@@ -230,7 +230,7 @@ namespace Vocaluxe.Base
for (int j = 0; j < _Skins[i].VideoList.Count; j++) for (int j = 0; j < _Skins[i].VideoList.Count; j++)
{ {
CVideo.VdClose(_Skins[i].VideoList[j].VideoIndex); CVideo.Close(_Skins[i].VideoList[j].VideoIndex);
STexture videoTexture = _Skins[i].VideoList[j].Texture; STexture videoTexture = _Skins[i].VideoList[j].Texture;
CDraw.RemoveTexture(ref videoTexture); CDraw.RemoveTexture(ref videoTexture);
} }
@@ -617,10 +617,10 @@ namespace Vocaluxe.Base
float time = 0f; float time = 0f;
if (sk.VideoIndex == -1) if (sk.VideoIndex == -1)
{ {
sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, partyModeID)); sk.VideoIndex = CVideo.Load(GetVideoFilePath(sk.Name, partyModeID));
CVideo.VdSetLoop(sk.VideoIndex, true); CVideo.SetLoop(sk.VideoIndex, true);
} }
CVideo.VdGetFrame(sk.VideoIndex, ref sk.Texture, time, out time); CVideo.GetFrame(sk.VideoIndex, ref sk.Texture, time, out time);
_Skins[skinIndex].VideoList[i] = sk; _Skins[skinIndex].VideoList[i] = sk;
return sk.Texture; return sk.Texture;
} }
@@ -641,10 +641,10 @@ namespace Vocaluxe.Base
{ {
if (sk.VideoIndex == -1) if (sk.VideoIndex == -1)
{ {
sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, partyModeID)); sk.VideoIndex = CVideo.Load(GetVideoFilePath(sk.Name, partyModeID));
CVideo.VdSetLoop(sk.VideoIndex, true); CVideo.SetLoop(sk.VideoIndex, true);
} }
CVideo.VdPause(sk.VideoIndex); CVideo.Pause(sk.VideoIndex);
_Skins[skinIndex].VideoList[i] = sk; _Skins[skinIndex].VideoList[i] = sk;
return; return;
} }
@@ -664,10 +664,10 @@ namespace Vocaluxe.Base
{ {
if (sk.VideoIndex == -1) if (sk.VideoIndex == -1)
{ {
sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, partyModeID)); sk.VideoIndex = CVideo.Load(GetVideoFilePath(sk.Name, partyModeID));
CVideo.VdSetLoop(sk.VideoIndex, true); CVideo.SetLoop(sk.VideoIndex, true);
} }
CVideo.VdResume(sk.VideoIndex); CVideo.Resume(sk.VideoIndex);
_Skins[skinIndex].VideoList[i] = sk; _Skins[skinIndex].VideoList[i] = sk;
return; return;
} }
+18 -23
View File
@@ -50,12 +50,7 @@ namespace Vocaluxe.Base
#endregion Init #endregion Init
#region Interface #region Interface
public static bool VdInit() public static void CloseAll()
{
return _VideoDecoder.Init();
}
public static void VdCloseAll()
{ {
_VideoDecoder.CloseAll(); _VideoDecoder.CloseAll();
} }
@@ -65,47 +60,47 @@ namespace Vocaluxe.Base
return _VideoDecoder.GetNumStreams(); return _VideoDecoder.GetNumStreams();
} }
public static int VdLoad(string videoFileName) public static int Load(string videoFileName)
{ {
return _VideoDecoder.Load(videoFileName); return _VideoDecoder.Load(videoFileName);
} }
public static bool VdClose(int streamID) public static bool Close(int streamID)
{ {
return _VideoDecoder.Close(streamID); return _VideoDecoder.Close(streamID);
} }
public static float VdGetLength(int streamID) public static float GetLength(int streamID)
{ {
return _VideoDecoder.GetLength(streamID); return _VideoDecoder.GetLength(streamID);
} }
public static bool VdGetFrame(int streamID, ref STexture frame, float time, out float videoTime) public static bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime)
{ {
return _VideoDecoder.GetFrame(streamID, ref frame, time, out videoTime); return _VideoDecoder.GetFrame(streamID, ref frame, time, out videoTime);
} }
public static bool VdSkip(int streamID, float start, float gap) public static bool Skip(int streamID, float start, float gap)
{ {
return _VideoDecoder.Skip(streamID, start, gap); return _VideoDecoder.Skip(streamID, start, gap);
} }
public static void VdSetLoop(int streamID, bool loop) public static void SetLoop(int streamID, bool loop)
{ {
_VideoDecoder.SetLoop(streamID, loop); _VideoDecoder.SetLoop(streamID, loop);
} }
public static void VdPause(int streamID) public static void Pause(int streamID)
{ {
_VideoDecoder.Pause(streamID); _VideoDecoder.Pause(streamID);
} }
public static void VdResume(int streamID) public static void Resume(int streamID)
{ {
_VideoDecoder.Resume(streamID); _VideoDecoder.Resume(streamID);
} }
public static bool VdFinished(int streamID) public static bool Finished(int streamID)
{ {
return _VideoDecoder.Finished(streamID); return _VideoDecoder.Finished(streamID);
} }
@@ -134,7 +129,7 @@ namespace Vocaluxe.Base
public bool Loop public bool Loop
{ {
set { CVideo.VdSetLoop(_VideoStream, value); } set { CVideo.SetLoop(_VideoStream, value); }
} }
public CVideoPlayer() public CVideoPlayer()
@@ -147,7 +142,7 @@ namespace Vocaluxe.Base
public void Load(string videoName) public void Load(string videoName)
{ {
_VideoStream = CVideo.VdLoad(CTheme.GetVideoFilePath(videoName, -1)); _VideoStream = CVideo.Load(CTheme.GetVideoFilePath(videoName, -1));
_Loaded = true; _Loaded = true;
} }
@@ -174,10 +169,10 @@ namespace Vocaluxe.Base
if (!_Finished) if (!_Finished)
{ {
float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f; float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f;
_Finished = CVideo.VdFinished(_VideoStream); _Finished = CVideo.Finished(_VideoStream);
STexture tex = new STexture(-1) {Height = 0f}; STexture tex = new STexture(-1) {Height = 0f};
CVideo.VdGetFrame(_VideoStream, ref tex, videoTime, out videoTime); CVideo.GetFrame(_VideoStream, ref tex, videoTime, out videoTime);
if (tex.Height > 0) if (tex.Height > 0)
{ {
@@ -186,8 +181,8 @@ namespace Vocaluxe.Base
} }
} }
RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH); RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH);
RectangleF rect = new RectangleF(0f, 0f, _VideoTexture.Width, _VideoTexture.Height); RectangleF rect;
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, _VideoTexture.Width / _VideoTexture.Height, EAspect.Crop);
CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4)); CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4));
} }
@@ -198,14 +193,14 @@ namespace Vocaluxe.Base
while (_VideoTexture.Index == -1 && videoTime < 1f) while (_VideoTexture.Index == -1 && videoTime < 1f)
{ {
float dummy; float dummy;
CVideo.VdGetFrame(_VideoStream, ref _VideoTexture, 0, out dummy); CVideo.GetFrame(_VideoStream, ref _VideoTexture, 0, out dummy);
videoTime += 0.05f; videoTime += 0.05f;
} }
} }
public void Close() public void Close()
{ {
CVideo.VdClose(_VideoStream); CVideo.Close(_VideoStream);
CDraw.RemoveTexture(ref _VideoTexture); CDraw.RemoveTexture(ref _VideoTexture);
_Loaded = false; _Loaded = false;
_Finished = false; _Finished = false;
+1 -1
View File
@@ -223,7 +223,7 @@ namespace Vocaluxe
CController.Close(); CController.Close();
CSound.RecordCloseAll(); CSound.RecordCloseAll();
CSound.CloseAllStreams(); CSound.CloseAllStreams();
CVideo.VdCloseAll(); CVideo.CloseAll();
CDraw.Unload(); CDraw.Unload();
CDataBase.CloseConnections(); CDataBase.CloseConnections();
CWebcam.Close(); CWebcam.Close();
+18 -26
View File
@@ -395,7 +395,7 @@ namespace Vocaluxe.Screens
if (_CurrentVideo != -1 && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON) if (_CurrentVideo != -1 && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON)
{ {
float vtime; float vtime;
CVideo.VdGetFrame(_CurrentVideo, ref _CurrentVideoTexture, _CurrentTime, out vtime); CVideo.GetFrame(_CurrentVideo, ref _CurrentVideoTexture, _CurrentTime, out vtime);
} }
if (_Webcam) if (_Webcam)
@@ -453,34 +453,26 @@ namespace Vocaluxe.Screens
{ {
if (_Active) if (_Active)
{ {
STexture background;
EAspect aspect = EAspect.Crop;
if (_CurrentVideo != -1 && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam) if (_CurrentVideo != -1 && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam)
{ {
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); background = _CurrentVideoTexture;
RectangleF rect = new RectangleF(0f, 0f, _CurrentVideoTexture.Width, _CurrentVideoTexture.Height); aspect = _VideoAspect;
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, _VideoAspect);
CDraw.DrawTexture(_CurrentVideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f),
_CurrentVideoTexture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
} }
else if (_Webcam) else if (_Webcam)
{ {
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); background = _CurrentWebcamFrameTexture;
RectangleF rect = new RectangleF(0f, 0f, _CurrentWebcamFrameTexture.Width, _CurrentWebcamFrameTexture.Height); aspect = _VideoAspect;
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, _VideoAspect);
CDraw.DrawTexture(_CurrentWebcamFrameTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f),
_CurrentVideoTexture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
} }
else else
{ background = _Background;
// Draw Background RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH);
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); RectangleF rect;
RectangleF rect = new RectangleF(0f, 0f, _Background.Width, _Background.Height); CHelper.SetRect(bounds, out rect, background.Width / background.Height, aspect);
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
CDraw.DrawTexture(_Background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), CDraw.DrawTexture(_Background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f),
_Background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); _Background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f));
}
} }
_DrawBG(); _DrawBG();
@@ -556,7 +548,7 @@ namespace Vocaluxe.Screens
CSound.RecordStop(); CSound.RecordStop();
if (_CurrentVideo != -1) if (_CurrentVideo != -1)
{ {
CVideo.VdClose(_CurrentVideo); CVideo.Close(_CurrentVideo);
_CurrentVideo = -1; _CurrentVideo = -1;
CDraw.RemoveTexture(ref _CurrentVideoTexture); CDraw.RemoveTexture(ref _CurrentVideoTexture);
} }
@@ -621,8 +613,8 @@ namespace Vocaluxe.Screens
if (song.VideoFileName != "") if (song.VideoFileName != "")
{ {
_CurrentVideo = CVideo.VdLoad(Path.Combine(song.Folder, song.VideoFileName)); _CurrentVideo = CVideo.Load(Path.Combine(song.Folder, song.VideoFileName));
CVideo.VdSkip(_CurrentVideo, song.Start, song.VideoGap); CVideo.Skip(_CurrentVideo, song.Start, song.VideoGap);
_VideoAspect = song.VideoAspect; _VideoAspect = song.VideoAspect;
} }
@@ -692,8 +684,8 @@ namespace Vocaluxe.Screens
else else
{ {
bool lyricsOnTop = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP bool lyricsOnTop = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP
|| CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH || CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
|| (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && (CGame.NumPlayer > 2 && CGame.NumPlayer != 4)); || (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && (CGame.NumPlayer > 2 && CGame.NumPlayer != 4));
_Lyrics[_LyricMainTop].Visible = lyricsOnTop; _Lyrics[_LyricMainTop].Visible = lyricsOnTop;
_Lyrics[_LyricSubTop].Visible = lyricsOnTop; _Lyrics[_LyricSubTop].Visible = lyricsOnTop;
_Statics[_StaticLyricsTop].Visible = lyricsOnTop; _Statics[_StaticLyricsTop].Visible = lyricsOnTop;
+6 -6
View File
@@ -206,8 +206,8 @@ namespace VocaluxeLib.Menu
if (texture.Height > 0) if (texture.Height > 0)
{ {
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect = new RectangleF(0f, 0f, texture.Width, texture.Height); RectangleF rect;
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, texture.Width / texture.Height, EAspect.Crop);
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true; return true;
@@ -221,8 +221,8 @@ namespace VocaluxeLib.Menu
if (videoTexture.Height > 0) if (videoTexture.Height > 0)
{ {
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height); RectangleF rect;
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, videoTexture.Width / videoTexture.Height, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true; return true;
@@ -236,8 +236,8 @@ namespace VocaluxeLib.Menu
if (videoTexture.Height > 0) if (videoTexture.Height > 0)
{ {
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height); RectangleF rect;
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, videoTexture.Width / videoTexture.Height, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true; return true;
+18 -21
View File
@@ -91,9 +91,9 @@ namespace VocaluxeLib.Menu
public static void SetRect(RectangleF bounds, out RectangleF rect, float rectAspect, EAspect aspect) public static void SetRect(RectangleF bounds, out RectangleF rect, float rectAspect, EAspect aspect)
{ {
float rW = bounds.Right - bounds.Left; float boundsW = bounds.Width;
float rH = bounds.Bottom - bounds.Top; float boundsH = bounds.Height;
float rA = rW / rH; float boundsAspect = boundsW / boundsH;
float scaledWidth; float scaledWidth;
float scaledHeight; float scaledHeight;
@@ -101,42 +101,39 @@ namespace VocaluxeLib.Menu
switch (aspect) switch (aspect)
{ {
case EAspect.Crop: case EAspect.Crop:
if (rA >= rectAspect) if (boundsAspect >= rectAspect)
{ {
scaledWidth = rW; scaledWidth = boundsW;
scaledHeight = rH * rA / rectAspect; scaledHeight = boundsW / rectAspect;
} }
else else
{ {
scaledHeight = rH; scaledHeight = boundsH;
scaledWidth = rW * rectAspect / rA; scaledWidth = boundsH * rectAspect;
} }
break; break;
case EAspect.LetterBox: case EAspect.LetterBox:
if (rectAspect >= 1) if (boundsAspect <= rectAspect)
{ {
scaledWidth = rW; scaledWidth = boundsW;
scaledHeight = rH * rA / rectAspect; scaledHeight = boundsW / rectAspect;
} }
else else
{ {
scaledHeight = rH; scaledHeight = boundsH;
scaledWidth = rW * rectAspect / rA; scaledWidth = boundsH * rectAspect;
} }
break; break;
default: default:
scaledWidth = rW; scaledWidth = boundsW;
scaledHeight = rH; scaledHeight = boundsH;
break; break;
} }
float left = (rW - scaledWidth) / 2 + bounds.Left; float left = (boundsW - scaledWidth) / 2 + bounds.Left;
float rigth = left + scaledWidth; float upper = (boundsH - scaledHeight) / 2 + bounds.Top;
float upper = (rH - scaledHeight) / 2 + bounds.Top; rect = new RectangleF(left, upper, scaledWidth, scaledHeight);
float lower = upper + scaledHeight;
rect = new RectangleF(left, upper, rigth - left, lower - upper);
} }
public static List<string> ListFiles(string path, string cast, bool recursive = false, bool fullpath = false) public static List<string> ListFiles(string path, string cast, bool recursive = false, bool fullpath = false)
@@ -458,8 +458,8 @@ namespace VocaluxeLib.Menu.SongMenu
if (_Vidtex.Color.A < 1) if (_Vidtex.Color.A < 1)
_CoverBig.Draw(1f, EAspect.Crop); _CoverBig.Draw(1f, EAspect.Crop);
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
RectangleF rect = new RectangleF(0f, 0f, _Vidtex.Width, _Vidtex.Height); RectangleF rect;
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, _Vidtex.Width / _Vidtex.Height, EAspect.Crop);
SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z); SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f); SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);