Merge branch 'develop' of github.com:Flamefire/Vocaluxe into sound-player

Conflicts:
	VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs
This commit is contained in:
Florian Küpper committed 2014-08-09 20:04:41 +02:00
commit 8722844646
48 files changed
+399 -521

No files matched your search

+1 -1
View File
@@ -188,7 +188,7 @@ namespace Vocaluxe.Base
if (xmlReader != null)
{
_Covers.Clear();
List<string> cover = xmlReader.GetValues("Cover");
List<string> cover = xmlReader.GetNames("//root/Cover/*");
foreach (string coverName in cover)
{
string name;
+1 -2
View File
@@ -353,8 +353,7 @@ namespace Vocaluxe.Base
if (!eventsAvailable)
keyEvent = inputKeyEvent;
if (keyEvent.Key == Keys.Left || keyEvent.Key == Keys.Right || keyEvent.Key == Keys.Up || keyEvent.Key == Keys.Down || keyEvent.Key == Keys.NumPad0 ||
keyEvent.Key == Keys.D0)
if (keyEvent.IsArrowKey() || keyEvent.Key == Keys.NumPad0 || keyEvent.Key == Keys.D0)
{
_Cursor.Deactivate();
+1 -1
View File
@@ -168,7 +168,7 @@ namespace Vocaluxe.Base
private static bool _LoadLanguageEntries(CXMLReader xmlReader, out Dictionary<string, string> texts)
{
texts = new Dictionary<string, string>();
IEnumerable<string> names = xmlReader.GetAttributes("resources", "name");
IEnumerable<string> names = xmlReader.GetAttributes("//resources/string", "name");
foreach (string name in names)
{
string value;
+1 -1
View File
@@ -246,10 +246,10 @@ namespace Vocaluxe.Base
loaded &= xmlReader.GetValue("//root/Info/Author", out pm.Author, "ERROR Author");
loaded &= xmlReader.GetValue("//root/Info/Folder", out pm.Folder, "ERROR Folder");
loaded &= xmlReader.GetValue("//root/Info/PartyModeFile", out pm.PartyModeFile, "ERROR PartyModeFile");
loaded &= xmlReader.GetInnerValues("PartyScreens", ref pm.ScreenFiles);
loaded &= xmlReader.TryGetIntValue("//root/Info/PartyModeVersionMajor", ref pm.PartyModeVersionMajor);
loaded &= xmlReader.TryGetIntValue("//root/Info/PartyModeVersionMinor", ref pm.PartyModeVersionMinor);
loaded &= xmlReader.GetValue("//root/Info/TargetAudience", out pm.TargetAudience, "ERROR TargetAudience");
loaded &= xmlReader.GetValues("//root/PartyScreens/*", ref pm.ScreenFiles);
if (!loaded)
{
+1 -1
View File
@@ -71,7 +71,7 @@ namespace Vocaluxe.Base
{
if (songPointer.SortString != "")
{
if (lastCategory == null || songPointer.SortString != lastCategory.Name)
if (lastCategory == null || String.Compare(songPointer.SortString, lastCategory.Name, StringComparison.CurrentCultureIgnoreCase) != 0)
{
lastCategory = new CCategory(songPointer.SortString);
_Categories.Add(lastCategory);
+1 -1
View File
@@ -155,7 +155,7 @@ namespace Vocaluxe.Base
list.Add(new CSongPointer(song.ID, value));
else
{
if (list.Count == 0)
if (values.Count == 0)
list.Add(new CSongPointer(song.ID, ""));
else
list.AddRange(values.Select(val => new CSongPointer(song.ID, val)));
+3 -3
View File
@@ -485,12 +485,12 @@ namespace Vocaluxe.Base
skin.PartyModeID = theme.PartyModeID;
skin.SkinList = new Dictionary<string, CSkinElement>();
List<string> names = xmlReader.GetValues("Skins");
List<string> names = xmlReader.GetNames("//root/Skins/*");
foreach (string str in names)
skin.SkinList[str] = new CSkinElement();
skin.VideoList = new Dictionary<string, CVideoSkinElement>();
names = xmlReader.GetValues("Videos");
names = xmlReader.GetNames("//root/Videos/*");
foreach (string str in names)
skin.VideoList[str] = new CVideoSkinElement();
_Skins.Add(skin);
@@ -665,7 +665,7 @@ namespace Vocaluxe.Base
}
var colorScheme = new List<SColorScheme>();
List<string> names = xmlReader.GetValues("ColorSchemes");
List<string> names = xmlReader.GetNames("//root/ColorSchemes/*");
foreach (string str in names)
{
var scheme = new SColorScheme {Name = str};
-92
View File
@@ -15,8 +15,6 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System.Diagnostics;
using System.Drawing;
using Vocaluxe.Lib.Video;
using VocaluxeLib;
using VocaluxeLib.Draw;
@@ -115,94 +113,4 @@ namespace Vocaluxe.Base
#endregion VideoDecoder
}
class CVideoPlayer
{
private CTexture _VideoTexture;
private int _VideoStream;
private readonly Stopwatch _VideoTimer = new Stopwatch();
private bool _Finished;
private bool _Loaded;
public bool IsFinished
{
get { return _Finished || !_Loaded; }
}
public bool Loop
{
set { CVideo.SetLoop(_VideoStream, value); }
}
public void Load(string videoName)
{
_VideoStream = CVideo.Load(CTheme.GetVideoFilePath(videoName, -1));
_Loaded = true;
CVideo.Pause(_VideoStream);
}
public void Start()
{
_VideoTimer.Reset();
_Finished = false;
//CVideo.VdSkip(_VideoStream, 0f, 0f);
_VideoTimer.Start();
CVideo.Resume(_VideoStream);
}
public void Pause()
{
CVideo.Pause(_VideoStream);
_VideoTimer.Stop();
}
public void Resume()
{
CVideo.Resume(_VideoStream);
_VideoTimer.Start();
}
public void Draw()
{
if (!_Finished)
{
float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f;
_Finished = CVideo.Finished(_VideoStream);
CVideo.GetFrame(_VideoStream, ref _VideoTexture, videoTime, out videoTime);
}
if (_VideoTexture == null)
return;
var bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH);
RectangleF rect;
CHelper.SetRect(bounds, out rect, _VideoTexture.OrigAspect, EAspect.Crop);
CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4));
}
public void PreLoad()
{
bool paused = _VideoTimer.IsRunning;
if (paused)
CVideo.Resume(_VideoStream);
float videoTime = 0f;
while (_VideoTexture == null && videoTime < 1f)
{
float dummy;
CVideo.GetFrame(_VideoStream, ref _VideoTexture, 0, out dummy);
videoTime += 0.05f;
}
if (paused)
CVideo.Pause(_VideoStream);
}
public void Close()
{
CVideo.Close(_VideoStream);
CDraw.RemoveTexture(ref _VideoTexture);
_Loaded = false;
_Finished = false;
_VideoTimer.Reset();
}
}
}
+97
View File
@@ -0,0 +1,97 @@
using System.Diagnostics;
using System.Drawing;
using VocaluxeLib;
using VocaluxeLib.Draw;
namespace Vocaluxe.Base
{
class CVideoPlayer
{
private CTexture _VideoTexture;
private int _VideoStream;
private readonly Stopwatch _VideoTimer = new Stopwatch();
private bool _Finished;
private bool _Loaded;
public bool IsFinished
{
get { return _Finished || !_Loaded; }
}
public bool Loop
{
set { CVideo.SetLoop(_VideoStream, value); }
}
public void Load(string videoName)
{
_VideoStream = CVideo.Load(CTheme.GetVideoFilePath(videoName, -1));
_Loaded = true;
CVideo.Pause(_VideoStream);
}
public void Start()
{
_VideoTimer.Reset();
_Finished = false;
//CVideo.VdSkip(_VideoStream, 0f, 0f);
_VideoTimer.Start();
CVideo.Resume(_VideoStream);
}
public void Pause()
{
CVideo.Pause(_VideoStream);
_VideoTimer.Stop();
}
public void Resume()
{
CVideo.Resume(_VideoStream);
_VideoTimer.Start();
}
public void Draw()
{
if (!_Finished)
{
float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f;
_Finished = CVideo.Finished(_VideoStream);
CVideo.GetFrame(_VideoStream, ref _VideoTexture, videoTime, out videoTime);
}
if (_VideoTexture == null)
return;
var bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH);
RectangleF rect;
CHelper.SetRect(bounds, out rect, _VideoTexture.OrigAspect, EAspect.Crop);
CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4));
}
public void PreLoad()
{
bool paused = _VideoTimer.IsRunning;
if (paused)
CVideo.Resume(_VideoStream);
float videoTime = 0f;
while (_VideoTexture == null && videoTime < 1f)
{
float dummy;
CVideo.GetFrame(_VideoStream, ref _VideoTexture, 0, out dummy);
videoTime += 0.05f;
}
if (paused)
CVideo.Pause(_VideoStream);
}
public void Close()
{
CVideo.Close(_VideoStream);
CDraw.RemoveTexture(ref _VideoTexture);
_Loaded = false;
_Finished = false;
_VideoTimer.Reset();
}
}
}
+1 -1
View File
@@ -122,7 +122,7 @@ namespace Vocaluxe.Lib.Playlist
Songs = new List<CPlaylistSong>();
List<string> songs = xmlReader.GetValues("Songs");
List<string> songs = xmlReader.GetNames("//root/Songs/*");
foreach (string songEntry in songs)
{
+14 -1
View File
@@ -15,6 +15,7 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Base.Server;
using VocaluxeLib;
@@ -75,7 +76,7 @@ namespace Vocaluxe.Screens
public override bool HandleMouse(SMouseEvent mouseEvent)
{
if (mouseEvent.LB)
if (mouseEvent.LB || mouseEvent.RB)
{
CGraphics.HidePopup(EPopupScreens.PopupServerQR);
return true;
@@ -83,6 +84,18 @@ namespace Vocaluxe.Screens
return false;
}
public override bool HandleInput(SKeyEvent keyEvent)
{
switch (keyEvent.Key)
{
case Keys.Escape:
case Keys.Back:
CGraphics.HidePopup(EPopupScreens.PopupServerQR);
return true;
}
return base.HandleInput(keyEvent);
}
public override bool UpdateGame()
{
return true;
+1 -1
View File
@@ -284,7 +284,7 @@ namespace Vocaluxe.Screens
else
{
_Pos += num;
_Pos = _Pos.Clamp(0, _Scores[_Round].Count - 1);
_Pos = _Pos.Clamp(0, _Scores[_Round].Count - 1, true);
}
}
-4
View File
@@ -399,12 +399,8 @@ namespace Vocaluxe.Screens
private void _ChangeRound(int num)
{
if (_Points.NumRounds < 1)
return;
_Round += num;
_Round = _Round.Clamp(-1, _Points.NumRounds - 1);
if (_Round >= _Points.NumRounds)
_Round = _Points.NumRounds - 1;
_UpdateRatings();
}
+1
View File
@@ -219,6 +219,7 @@
<Compile Include="Base\CPlaylistElement.cs" />
<Compile Include="Base\CPreviewPlayer.cs" />
<Compile Include="Base\CRecord.cs" />
<Compile Include="Base\CVideoPlayer.cs" />
<Compile Include="COSFunctions.cs" />
<Compile Include="Lib\Database\CCoverDB.cs" />
<Compile Include="Lib\Database\CDatabaseBase.cs" />