commit
db8fc40050
22 files changed
+408
-404
No files matched your search
@@ -69,13 +69,12 @@ int GstreamerAudioStream::Load(const wchar_t* Media)
|
||||
return -1;
|
||||
}
|
||||
Running = true;
|
||||
gst_element_set_state(Element, GST_STATE_NULL);
|
||||
g_object_set(Element, "uri", Media, NULL);
|
||||
g_object_set(Element, "audio-sink", SinkBin, NULL);
|
||||
g_object_set(Element, "flags", GST_PLAY_FLAG_AUDIO, NULL);
|
||||
|
||||
gst_element_set_state(Element, GST_STATE_PAUSED);
|
||||
//gst_bus_timed_pop_filtered(Bus, -1, GST_MESSAGE_ASYNC_DONE);
|
||||
RefreshDuration();
|
||||
|
||||
return ID;
|
||||
}
|
||||
@@ -84,8 +83,15 @@ int GstreamerAudioStream::Load(const wchar_t* Media)
|
||||
int GstreamerAudioStream::Load(const wchar_t* Media, bool Prescan)
|
||||
{
|
||||
Load(Media);
|
||||
if(Prescan)
|
||||
if(Prescan){
|
||||
gst_bus_timed_pop_filtered(Bus, -1, GST_MESSAGE_ASYNC_DONE);
|
||||
//Workaround: Waiting for the stream to be loaded (Length>0)
|
||||
for(int i=0;i<40;i++){
|
||||
if(GetLength()>0.f)
|
||||
break;
|
||||
Sleep(5);
|
||||
}
|
||||
}
|
||||
return ID;
|
||||
}
|
||||
|
||||
@@ -127,10 +133,7 @@ void GstreamerAudioStream::Play(void)
|
||||
{
|
||||
PauseStreamAfterFade = false;
|
||||
Running = true;
|
||||
GstStateChangeReturn ret;
|
||||
if(Element)
|
||||
ret = gst_element_set_state(Element, GST_STATE_PLAYING);
|
||||
if(ret == GST_STATE_CHANGE_ASYNC)
|
||||
if(gst_element_set_state(Element, GST_STATE_PLAYING) == GST_STATE_CHANGE_ASYNC)
|
||||
gst_bus_timed_pop_filtered(Bus, -1, GST_MESSAGE_ASYNC_DONE);
|
||||
SetStreamVolume(Volume * 100.0);
|
||||
}
|
||||
@@ -180,7 +183,7 @@ void GstreamerAudioStream::SetStreamVolumeMax(float MaxVolume)
|
||||
|
||||
float GstreamerAudioStream::GetLength()
|
||||
{
|
||||
if(Duration <= 0)
|
||||
if(Duration <= 0.f)
|
||||
RefreshDuration();
|
||||
return Duration;
|
||||
}
|
||||
@@ -191,7 +194,7 @@ void GstreamerAudioStream::RefreshDuration()
|
||||
{
|
||||
gint64 time = -1000;
|
||||
if(gst_element_query_duration(Element, GST_FORMAT_TIME, &time))
|
||||
Duration = (gfloat)((gdouble)(time/GST_SECOND));
|
||||
Duration = (gfloat)((gdouble)time/GST_SECOND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -675,7 +675,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
case ESongSource.TR_CATEGORY:
|
||||
CBase.Songs.SetCategory(_GameData.CategoryID);
|
||||
for (int i = 0; i < CBase.Songs.NumSongsInCategory(_GameData.CategoryID); i++)
|
||||
for (int i = 0; i < CBase.Songs.GetNumSongsVisible(); i++)
|
||||
{
|
||||
// ReSharper disable LoopCanBeConvertedToQuery
|
||||
foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
|
||||
|
||||
@@ -20,6 +20,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Songs;
|
||||
|
||||
namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
@@ -59,7 +60,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
|
||||
|
||||
_Data = new SDataFromScreen();
|
||||
SFromScreenConfig config = new SFromScreenConfig
|
||||
var config = new SFromScreenConfig
|
||||
{
|
||||
PlaylistID = 0,
|
||||
NumFields = 9,
|
||||
@@ -76,7 +77,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
try
|
||||
{
|
||||
SDataToScreenConfig config = (SDataToScreenConfig)receivedData;
|
||||
var config = (SDataToScreenConfig)receivedData;
|
||||
_Data.ScreenConfig.NumFields = config.NumFields;
|
||||
_Data.ScreenConfig.NumPlayerTeam1 = config.NumPlayerTeam1;
|
||||
_Data.ScreenConfig.NumPlayerTeam2 = config.NumPlayerTeam2;
|
||||
@@ -207,13 +208,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID;
|
||||
_SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
|
||||
|
||||
string[] categories = new string[CBase.Songs.GetNumCategories()];
|
||||
var categories = new string[CBase.Songs.GetNumCategories()];
|
||||
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
|
||||
categories[i] = CBase.Songs.GetCategory(i).Name;
|
||||
_SelectSlides[_SelectSlideCategory].Clear();
|
||||
for (int i = 0; i < categories.Length; i++)
|
||||
{
|
||||
string value = categories[i] + " (" + CBase.Songs.NumSongsInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
|
||||
string value = categories[i] + " (" + CBase.Songs.GetNumSongsNotSungInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
|
||||
_SelectSlides[_SelectSlideCategory].AddValue(value);
|
||||
}
|
||||
_SelectSlides[_SelectSlideCategory].Selection = _Data.ScreenConfig.CategoryID;
|
||||
@@ -240,7 +241,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_Data.ScreenConfig.CategoryID = _SelectSlides[_SelectSlideCategory].Selection;
|
||||
_Data.ScreenConfig.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection;
|
||||
|
||||
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
var gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
|
||||
switch (_Data.ScreenConfig.GameMode)
|
||||
{
|
||||
@@ -280,25 +281,22 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
if (_Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY)
|
||||
{
|
||||
if (CBase.Songs.GetNumCategories() > 0)
|
||||
{
|
||||
if (CBase.Songs.NumSongsInCategory(_Data.ScreenConfig.CategoryID) > 0)
|
||||
{
|
||||
CBase.Songs.SetCategory(_Data.ScreenConfig.CategoryID);
|
||||
_ConfigOk = false;
|
||||
for (int i = 0; i < CBase.Songs.NumSongsInCategory(_Data.ScreenConfig.CategoryID); i++)
|
||||
{
|
||||
_ConfigOk = CBase.Songs.GetVisibleSong(i).AvailableGameModes.Any(mode => mode == gm);
|
||||
if (_ConfigOk)
|
||||
break;
|
||||
}
|
||||
CBase.Songs.SetCategory(-1);
|
||||
}
|
||||
else
|
||||
_ConfigOk = false;
|
||||
}
|
||||
else
|
||||
if (CBase.Songs.GetNumCategories() == 0)
|
||||
_ConfigOk = false;
|
||||
else if (CBase.Songs.GetNumSongsNotSungInCategory(_Data.ScreenConfig.CategoryID) <= 0)
|
||||
_ConfigOk = false;
|
||||
else
|
||||
{
|
||||
CBase.Songs.SetCategory(_Data.ScreenConfig.CategoryID);
|
||||
_ConfigOk = false;
|
||||
foreach (CSong song in CBase.Songs.GetVisibleSongs())
|
||||
{
|
||||
_ConfigOk = song.AvailableGameModes.Any(mode => mode == gm);
|
||||
if (_ConfigOk)
|
||||
break;
|
||||
}
|
||||
CBase.Songs.SetCategory(-1);
|
||||
}
|
||||
}
|
||||
if (_Data.ScreenConfig.SongSource == ESongSource.TR_ALLSONGS)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,15 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
static class CConfig
|
||||
{
|
||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
||||
/// <summary>
|
||||
/// Uniform settings for writing XML files. ALWAYS use this!
|
||||
/// </summary>
|
||||
public static readonly XmlWriterSettings XMLSettings = new XmlWriterSettings
|
||||
{
|
||||
Indent = true,
|
||||
Encoding = Encoding.UTF8,
|
||||
ConformanceLevel = ConformanceLevel.Document
|
||||
};
|
||||
|
||||
// Debug
|
||||
public static EDebugLevel DebugLevel = EDebugLevel.TR_CONFIG_OFF;
|
||||
@@ -141,10 +149,6 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
_Settings.Indent = true;
|
||||
_Settings.Encoding = Encoding.UTF8;
|
||||
_Settings.ConformanceLevel = ConformanceLevel.Document;
|
||||
|
||||
SongFolder.Add(Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderSongs));
|
||||
|
||||
#if INSTALLER
|
||||
@@ -304,7 +308,7 @@ namespace Vocaluxe.Base
|
||||
XmlWriter writer = null;
|
||||
try
|
||||
{
|
||||
writer = XmlWriter.Create(Path.Combine(CSettings.DataPath, CSettings.FileConfig), _Settings);
|
||||
writer = XmlWriter.Create(Path.Combine(CSettings.DataPath, CSettings.FileConfig), XMLSettings);
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("root");
|
||||
|
||||
|
||||
+14
-6
@@ -19,6 +19,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Xml;
|
||||
using Vocaluxe.Base.Fonts;
|
||||
using VocaluxeLib;
|
||||
using VocaluxeLib.Game;
|
||||
@@ -144,6 +145,11 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
return CConfig.GetMaxNumMics();
|
||||
}
|
||||
|
||||
public XmlWriterSettings GetXMLSettings()
|
||||
{
|
||||
return CConfig.XMLSettings;
|
||||
}
|
||||
}
|
||||
|
||||
class CBsettings : ISettings
|
||||
@@ -606,9 +612,14 @@ namespace Vocaluxe.Base
|
||||
return CSongs.NumCategories;
|
||||
}
|
||||
|
||||
public int NumSongsInCategory(int categoryIndex)
|
||||
public int GetNumSongsInCategory(int categoryIndex)
|
||||
{
|
||||
return CSongs.NumSongsInCategory(categoryIndex);
|
||||
return CSongs.GetNumSongsInCategory(categoryIndex);
|
||||
}
|
||||
|
||||
public int GetNumSongsNotSungInCategory(int categoryIndex)
|
||||
{
|
||||
return CSongs.GetNumSongsNotSungInCategory(categoryIndex);
|
||||
}
|
||||
|
||||
public bool IsInCategory()
|
||||
@@ -663,10 +674,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public CCategory GetCategory(int index)
|
||||
{
|
||||
if (index >= CSongs.NumCategories)
|
||||
return null;
|
||||
|
||||
return new CCategory(CSongs.Categories[index]);
|
||||
return CSongs.GetCategoryByIndex(index);
|
||||
}
|
||||
|
||||
public void AddPartySongSung(int songID)
|
||||
|
||||
+33
-6
@@ -64,7 +64,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static int NumSongsVisible
|
||||
{
|
||||
get { return _CatIndex < 0 ? 0 : Categories[_CatIndex].Songs.Count(sp => !sp.IsSung); }
|
||||
get { return VisibleSongs.Count; }
|
||||
}
|
||||
|
||||
public static int NumCategories
|
||||
@@ -102,9 +102,19 @@ namespace Vocaluxe.Base
|
||||
/// </summary>
|
||||
/// <param name="catIndex">Category index</param>
|
||||
/// <returns></returns>
|
||||
public static int NumSongsInCategory(int catIndex)
|
||||
public static int GetNumSongsInCategory(int catIndex)
|
||||
{
|
||||
return _IsCatIndexValid(catIndex) ? Categories[catIndex].Songs.Count(sp => !sp.IsSung) : 0;
|
||||
return _IsCatIndexValid(catIndex) ? Categories[catIndex].Songs.Count : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of song that are not sung in the category specified with CatIndex
|
||||
/// </summary>
|
||||
/// <param name="catIndex">Category index</param>
|
||||
/// <returns>Number of visible songs in that category</returns>
|
||||
public static int GetNumSongsNotSungInCategory(int catIndex)
|
||||
{
|
||||
return _IsCatIndexValid(catIndex) ? Categories[catIndex].GetNumSongsNotSung() : 0;
|
||||
}
|
||||
|
||||
public static void NextCategory()
|
||||
@@ -157,9 +167,8 @@ namespace Vocaluxe.Base
|
||||
foreach (CSongPointer song in category.Songs.Where(song => song.SongID == songID))
|
||||
{
|
||||
song.IsSung = true;
|
||||
int catIndex = _GetCategoryNumber(category);
|
||||
if (NumSongsInCategory(catIndex) == 0)
|
||||
ResetPartySongSung(catIndex);
|
||||
if (category.GetNumSongsNotSung() == 0)
|
||||
ResetPartySongSung(_GetCategoryNumber(category));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -269,6 +278,24 @@ namespace Vocaluxe.Base
|
||||
get { return Categorizer.Categories.AsReadOnly(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets category with given index or null for invalid index
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns>category with given index or null for invalid index</returns>
|
||||
public static CCategory GetCategoryByIndex(int index)
|
||||
{
|
||||
if (!_IsCatIndexValid(index))
|
||||
return null;
|
||||
|
||||
return Categorizer.Categories[index];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets visible song with given index or null for invalid index or song not visible
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns>visible song with given index or null for invalid index or song not visible</returns>
|
||||
public static CSong GetVisibleSongByIndex(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
|
||||
@@ -105,7 +105,6 @@ namespace Vocaluxe.Base
|
||||
private const int _SkinSystemVersion = 3;
|
||||
|
||||
#region Vars
|
||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
||||
private static readonly List<STheme> _Themes = new List<STheme>();
|
||||
public static string[] ThemeNames
|
||||
{
|
||||
@@ -146,10 +145,6 @@ namespace Vocaluxe.Base
|
||||
#region Theme and Skin loading and writing
|
||||
public static void InitTheme()
|
||||
{
|
||||
_Settings.Indent = true;
|
||||
_Settings.Encoding = Encoding.UTF8;
|
||||
_Settings.ConformanceLevel = ConformanceLevel.Document;
|
||||
|
||||
_ListThemes();
|
||||
ListSkins();
|
||||
|
||||
@@ -289,7 +284,7 @@ namespace Vocaluxe.Base
|
||||
private static void _SaveTheme(int themeIndex)
|
||||
{
|
||||
#region ThemeMainFile
|
||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].FileName), _Settings))
|
||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].FileName), CConfig.XMLSettings))
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("root");
|
||||
@@ -331,7 +326,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
for (int skinIndex = 0; skinIndex < _Skins.Count; skinIndex++)
|
||||
{
|
||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName), _Settings))
|
||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName), CConfig.XMLSettings))
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("root");
|
||||
|
||||
@@ -29,33 +29,22 @@ namespace Vocaluxe.Lib.Playlist
|
||||
{
|
||||
public class CPlaylistFile
|
||||
{
|
||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
||||
|
||||
public string PlaylistName;
|
||||
public string PlaylistFile;
|
||||
public List<CPlaylistSong> Songs = new List<CPlaylistSong>();
|
||||
|
||||
public CPlaylistFile()
|
||||
{
|
||||
_Init();
|
||||
PlaylistName = string.Empty;
|
||||
PlaylistFile = string.Empty;
|
||||
}
|
||||
|
||||
public CPlaylistFile(string file)
|
||||
{
|
||||
_Init();
|
||||
PlaylistFile = file;
|
||||
_LoadPlaylist();
|
||||
}
|
||||
|
||||
private void _Init()
|
||||
{
|
||||
_Settings.Indent = true;
|
||||
_Settings.Encoding = Encoding.UTF8;
|
||||
_Settings.ConformanceLevel = ConformanceLevel.Document;
|
||||
}
|
||||
|
||||
public void SavePlaylist()
|
||||
{
|
||||
if (PlaylistFile == "")
|
||||
@@ -86,7 +75,7 @@ namespace Vocaluxe.Lib.Playlist
|
||||
XmlWriter writer;
|
||||
try
|
||||
{
|
||||
writer = XmlWriter.Create(PlaylistFile, _Settings);
|
||||
writer = XmlWriter.Create(PlaylistFile, CConfig.XMLSettings);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
||||
|
||||
private float _FrameDuration; // frame time in s
|
||||
private float _LastDecodedTime; // time of last decoded frame
|
||||
private float _LastShownTime; // current video position
|
||||
private float _LastShownTime; // time if the last shown frame in s
|
||||
|
||||
private float _Time;
|
||||
private float _Gap;
|
||||
@@ -123,12 +123,6 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
||||
|
||||
public bool GetFrame(ref CTexture frame, float time, out float videoTime)
|
||||
{
|
||||
if (_Paused)
|
||||
{
|
||||
videoTime = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Loop)
|
||||
{
|
||||
lock (_MutexSyncSignals)
|
||||
@@ -137,16 +131,16 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
||||
_LoopTimer.Restart();
|
||||
}
|
||||
}
|
||||
else if (Math.Abs(_SetTime - time) > float.Epsilon)
|
||||
else if (Math.Abs(_SetTime - time) >= 1f / 1000f) //Check 1 ms difference
|
||||
{
|
||||
lock (_MutexSyncSignals)
|
||||
{
|
||||
_SetTime = time;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (Math.Abs(_LastShownTime - time) < 1f / 1000 && frame != null) //Check 1 ms difference
|
||||
{
|
||||
videoTime = 0;
|
||||
videoTime = _LastShownTime;
|
||||
return true;
|
||||
}
|
||||
_UploadNewFrame(ref frame);
|
||||
@@ -185,11 +179,6 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
||||
}
|
||||
_LastDecodedTime = _SkipTime;
|
||||
|
||||
lock (_MutexSyncSignals)
|
||||
{
|
||||
_LastShownTime = _LastDecodedTime;
|
||||
}
|
||||
|
||||
lock (_MutexFramebuffer)
|
||||
{
|
||||
_Framebuffer.Clear();
|
||||
@@ -425,13 +414,15 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
||||
float now = _SetTime + _Gap;
|
||||
float maxEnd = now - _FrameDuration * 2; //Get only frames younger than 2
|
||||
CFrame frame;
|
||||
bool paused = _Paused;
|
||||
while ((frame = _Framebuffer.Get()) != null)
|
||||
{
|
||||
float frameEnd = frame.Time + _FrameDuration;
|
||||
//Don't show frames that are shown during or after now
|
||||
if (frameEnd >= now)
|
||||
break; //All following frames are after that one
|
||||
|
||||
if (paused) // Don't modify anything
|
||||
break;
|
||||
_Framebuffer.SetRead();
|
||||
//Get the last(newest) possible frame and skip the rest to force in-order showing
|
||||
if (frameEnd <= maxEnd)
|
||||
@@ -455,4 +446,4 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
||||
}
|
||||
#endregion Threading
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,31 +21,94 @@ namespace Vocaluxe.Lib.Video
|
||||
{
|
||||
interface IVideoDecoder
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes videodecoder. Got to be called before usage
|
||||
/// </summary>
|
||||
/// <returns>True on success, false if something went wrong.</returns>
|
||||
bool Init();
|
||||
|
||||
/// <summary>
|
||||
/// Close all video streams
|
||||
/// </summary>
|
||||
void CloseAll();
|
||||
|
||||
/// <summary>
|
||||
/// Loads the file with the given file path.
|
||||
/// </summary>
|
||||
/// <param name="videoFileName">Absolute file path of the video file</param>
|
||||
/// <returns>StreamID >=0 on success or -1 on failure</returns>
|
||||
int Load(string videoFileName);
|
||||
|
||||
/// <summary>
|
||||
/// Closes the stream with the given ID
|
||||
/// </summary>
|
||||
/// <param name="streamID">ID of the stream</param>
|
||||
/// <returns>true if stream was closed, false if stream doesn't exist or already closed</returns>
|
||||
bool Close(int streamID);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of streams currently active
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
int GetNumStreams();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the length of the video in s
|
||||
/// </summary>
|
||||
/// <param name="streamID">Id of the stream</param>
|
||||
/// <returns>Length of the video in s</returns>
|
||||
float GetLength(int streamID);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a frame of the video and sets the current video time
|
||||
/// </summary>
|
||||
/// <param name="streamID"></param>
|
||||
/// <param name="frame"></param>
|
||||
/// <param name="time"></param>
|
||||
/// <param name="videoTime"></param>
|
||||
/// <returns>True if frame is valid</returns>
|
||||
/// <param name="streamID">Id of the stream</param>
|
||||
/// <param name="frame">Reference to already initialized video texture (from previous calls). If null, one will be created.<br/>
|
||||
/// Returns the current video frame which might be outdated if time != current (internal) video position or unchanged (even null) if none is available.</param>
|
||||
/// <param name="time">The position in s of the video you want to get a frame of. If != current (internal) video position, it will seek to get to right position.<br/>
|
||||
/// <b>Note:</b>Will be ignored for looped playback!</param>
|
||||
/// <param name="videoTime">The actual position in s of the returned frame. Should be ~ time+VideoGap</param>
|
||||
/// <returns>True if frame is valid, false: frame and videoTime might be unchanged or invalid</returns>
|
||||
bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime);
|
||||
|
||||
/// <summary>
|
||||
/// Seeks to given position
|
||||
/// </summary>
|
||||
/// <param name="streamID">Id of the stream</param>
|
||||
/// <param name="start">Position to seek to</param>
|
||||
/// <param name="gap">New video gap -> Actual position will be start+gap</param>
|
||||
/// <returns>True on success</returns>
|
||||
bool Skip(int streamID, float start, float gap);
|
||||
|
||||
/// <summary>
|
||||
/// Set if the video should be looped
|
||||
/// </summary>
|
||||
/// <param name="streamID">Id of the stream</param>
|
||||
/// <param name="loop">True if it should be looped</param>
|
||||
void SetLoop(int streamID, bool loop);
|
||||
|
||||
/// <summary>
|
||||
/// Pauses the video (no new frames will be decoded)
|
||||
/// </summary>
|
||||
/// <param name="streamID">Id of the stream</param>
|
||||
void Pause(int streamID);
|
||||
|
||||
/// <summary>
|
||||
/// Resumes a paused video
|
||||
/// </summary>
|
||||
/// <param name="streamID">Id of the stream</param>
|
||||
void Resume(int streamID);
|
||||
|
||||
/// <summary>
|
||||
/// Check if the given video is finished
|
||||
/// </summary>
|
||||
/// <param name="streamID">Id of the stream</param>
|
||||
/// <returns>True if all frames are shown</returns>
|
||||
bool Finished(int streamID);
|
||||
|
||||
/// <summary>
|
||||
/// Do a step of the decoder in unthreaded decoders. Should be called once every frame.
|
||||
/// </summary>
|
||||
void Update();
|
||||
}
|
||||
}
|
||||
+31
-11
@@ -20,6 +20,8 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using System.Runtime.ExceptionServices;
|
||||
@@ -30,6 +32,12 @@ namespace Vocaluxe
|
||||
{
|
||||
static class CMainProgram
|
||||
{
|
||||
#if WIN
|
||||
[DllImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
#endif
|
||||
|
||||
private static CSplashScreen _SplashScreen;
|
||||
|
||||
[STAThread, HandleProcessCorruptedStateExceptions]
|
||||
@@ -39,6 +47,9 @@ namespace Vocaluxe
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
|
||||
AppDomain.CurrentDomain.AssemblyResolve += _AssemblyResolver;
|
||||
// Close program if there is another instance running
|
||||
if (!_EnsureSingleInstance())
|
||||
return;
|
||||
try
|
||||
{
|
||||
_Run(args);
|
||||
@@ -59,14 +70,6 @@ namespace Vocaluxe
|
||||
|
||||
private static void _Run(string[] args)
|
||||
{
|
||||
// Close program if there is another instance running
|
||||
if (!_EnsureSingleInstance())
|
||||
{
|
||||
//TODO: put it into language file
|
||||
MessageBox.Show("Another Instance of Vocaluxe is already runnning!");
|
||||
return;
|
||||
}
|
||||
|
||||
Application.DoEvents();
|
||||
|
||||
try
|
||||
@@ -304,12 +307,29 @@ namespace Vocaluxe
|
||||
return null;
|
||||
}
|
||||
|
||||
private static readonly Mutex _Mutex = new Mutex(false, Application.ProductName + "-SingleInstanceMutex");
|
||||
|
||||
private static bool _EnsureSingleInstance()
|
||||
{
|
||||
Process currentProcess = Process.GetCurrentProcess();
|
||||
Process[] processes = Process.GetProcesses();
|
||||
// wait a few seconds in case that the instance is just shutting down
|
||||
if (!_Mutex.WaitOne(TimeSpan.FromSeconds(2), false))
|
||||
{
|
||||
//TODO: put it into language file
|
||||
MessageBox.Show("Another Instance of Vocaluxe is already runnning!");
|
||||
#if WIN
|
||||
Process currentProcess = Process.GetCurrentProcess();
|
||||
Process[] processes = Process.GetProcessesByName(currentProcess.ProcessName);
|
||||
|
||||
return processes.All(t => t.Id == currentProcess.Id || currentProcess.ProcessName != t.ProcessName);
|
||||
foreach (var process in processes.Where(t => t.Id != currentProcess.Id))
|
||||
{
|
||||
var wnd = process.MainWindowHandle;
|
||||
if (wnd != IntPtr.Zero)
|
||||
SetForegroundWindow(wnd);
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,5 +49,5 @@ using System.Runtime.InteropServices;
|
||||
// Revision
|
||||
//
|
||||
|
||||
[assembly: AssemblyVersion("0.3.0.81")]
|
||||
[assembly: AssemblyFileVersion("0.3.0.81")]
|
||||
[assembly: AssemblyVersion("0.3.0.82")]
|
||||
[assembly: AssemblyFileVersion("0.3.0.82")]
|
||||
@@ -658,7 +658,7 @@ namespace Vocaluxe.Screens
|
||||
CBackgroundMusic.Disabled = false;
|
||||
|
||||
int song = _SongMenus[_SongMenu].GetActualSelection();
|
||||
if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Count)
|
||||
if ((CSongs.IsInCategory || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Count)
|
||||
_Texts[_TextSelection].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title;
|
||||
else if (!CSongs.IsInCategory && song >= 0 && song < CSongs.Categories.Count)
|
||||
_Texts[_TextSelection].Text = CSongs.Categories[song].Name;
|
||||
@@ -1011,7 +1011,7 @@ namespace Vocaluxe.Screens
|
||||
if (firstLevel && !secondSort)
|
||||
{
|
||||
//TODO: What's to do with multiple tags?
|
||||
//How can we get current letter? I think we have to save it - Or is there a better method?
|
||||
//Flamefire: What? We only sorted by one tag, sorting by multiple tags (e.g. Album) will be by e.g. the first entry. That can be used here too as otherwhise it will confuse users because it jumps randomly
|
||||
ReadOnlyCollection<CSong> songs = CSongs.VisibleSongs;
|
||||
int ct = songs.Count;
|
||||
int visibleID = -1;
|
||||
@@ -1024,7 +1024,6 @@ namespace Vocaluxe.Screens
|
||||
visibleID = _FindIndex(songs, start, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
break;
|
||||
|
||||
//TODO: Does this make sense? Maybe we should deactivate this for years? You could only jump between 1 and 2
|
||||
case ESongSorting.TR_CONFIG_YEAR:
|
||||
case ESongSorting.TR_CONFIG_DECADE:
|
||||
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Year.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||
@@ -1139,27 +1138,29 @@ namespace Vocaluxe.Screens
|
||||
_Statics[_StaticOptionsBG].Visible = false;
|
||||
_Buttons[_ButtonOpenOptions].Visible = true;
|
||||
|
||||
if (CSongs.VisibleSongs.Count > 0)
|
||||
{
|
||||
_SongOptionsActive = view != ESongOptionsView.None;
|
||||
if (view == ESongOptionsView.None)
|
||||
_SongOptionsActive = false;
|
||||
else if (CSongs.IsInCategory)
|
||||
_SongOptionsActive = CSongs.VisibleSongs.Count > 0;
|
||||
else
|
||||
_SongOptionsActive = CSongs.Categories.Count > 0;
|
||||
|
||||
if (_SongOptionsActive)
|
||||
{
|
||||
//Has to be done here otherwhise changed playlist names will not appear until OnShow is called!
|
||||
_UpdatePlaylistNames();
|
||||
if (!_SongOptionsActive)
|
||||
return;
|
||||
|
||||
_Texts[_TextOptionsTitle].Visible = true;
|
||||
_Buttons[_ButtonOptionsClose].Visible = true;
|
||||
_Statics[_StaticOptionsBG].Visible = true;
|
||||
_Buttons[_ButtonOpenOptions].Visible = false;
|
||||
if (view == ESongOptionsView.Song)
|
||||
_ShowSongOptionsSong();
|
||||
else if (view == ESongOptionsView.General)
|
||||
_ShowSongOptionsGeneral();
|
||||
else if (view == ESongOptionsView.Medley)
|
||||
_ShowSongOptionsMedley();
|
||||
}
|
||||
}
|
||||
//Has to be done here otherwhise changed playlist names will not appear until OnShow is called!
|
||||
_UpdatePlaylistNames();
|
||||
|
||||
_Texts[_TextOptionsTitle].Visible = true;
|
||||
_Buttons[_ButtonOptionsClose].Visible = true;
|
||||
_Statics[_StaticOptionsBG].Visible = true;
|
||||
_Buttons[_ButtonOpenOptions].Visible = false;
|
||||
if (view == ESongOptionsView.Song)
|
||||
_ShowSongOptionsSong();
|
||||
else if (view == ESongOptionsView.General)
|
||||
_ShowSongOptionsGeneral();
|
||||
else if (view == ESongOptionsView.Medley)
|
||||
_ShowSongOptionsMedley();
|
||||
}
|
||||
|
||||
private void _CheckAndAddGameMode(EGameMode gameMode)
|
||||
|
||||
@@ -140,6 +140,8 @@ namespace VocaluxeLib
|
||||
{
|
||||
var files = new List<string>();
|
||||
var dir = new DirectoryInfo(path);
|
||||
if (!dir.Exists)
|
||||
return files;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Xml;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Game;
|
||||
using VocaluxeLib.Menu;
|
||||
@@ -54,6 +55,11 @@ namespace VocaluxeLib
|
||||
|
||||
bool IsMicConfigured(int playerNr);
|
||||
int GetMaxNumMics();
|
||||
|
||||
/// <summary>
|
||||
/// Get the uniform settings for writing XML files. ALWAYS use this!
|
||||
/// </summary>
|
||||
XmlWriterSettings GetXMLSettings();
|
||||
}
|
||||
|
||||
public interface ISettings
|
||||
@@ -207,7 +213,8 @@ namespace VocaluxeLib
|
||||
int GetNumSongs();
|
||||
int GetNumSongsVisible();
|
||||
int GetNumCategories();
|
||||
int NumSongsInCategory(int categoryIndex);
|
||||
int GetNumSongsInCategory(int categoryIndex);
|
||||
int GetNumSongsNotSungInCategory(int categoryIndex);
|
||||
bool IsInCategory();
|
||||
|
||||
int GetCurrentCategoryIndex();
|
||||
|
||||
@@ -196,10 +196,9 @@ namespace VocaluxeLib.Menu
|
||||
if (_ThemePath == "")
|
||||
return;
|
||||
|
||||
var settings = new XmlWriterSettings {Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document};
|
||||
|
||||
string file = Path.Combine(_ThemePath, ThemeName + ".xml");
|
||||
using (XmlWriter writer = XmlWriter.Create(file, settings))
|
||||
using (XmlWriter writer = XmlWriter.Create(file, CBase.Config.GetXMLSettings()))
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("root");
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public SRectF Rect
|
||||
{
|
||||
get { return _SongMenu.GetRect(); }
|
||||
get { return _SongMenu.Rect; }
|
||||
}
|
||||
|
||||
#region ISongMenu
|
||||
@@ -156,11 +156,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_SongMenu.SetVisible(visible);
|
||||
}
|
||||
|
||||
public SRectF GetRect()
|
||||
{
|
||||
return _SongMenu.GetRect();
|
||||
}
|
||||
|
||||
public bool IsSmallView()
|
||||
{
|
||||
return _SongMenu.IsSmallView();
|
||||
|
||||
@@ -99,106 +99,40 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
protected SThemeSongMenu _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
private readonly Stopwatch _Timer = new Stopwatch();
|
||||
private readonly Stopwatch _VideoFadeTimer = new Stopwatch();
|
||||
private readonly List<int> _Streams = new List<int>();
|
||||
private int _ActSongId = -1;
|
||||
private int _Actsongstream = -1;
|
||||
protected CTexture _Vidtex;
|
||||
|
||||
protected bool _Initialized;
|
||||
protected int _LastKnownNumSongs;
|
||||
protected int _LastKnownCategory = -1;
|
||||
|
||||
protected SRectF _Rect;
|
||||
protected SColorF _Color;
|
||||
|
||||
private int _SelectedInternal = -1;
|
||||
private int _SelectedPending = -1;
|
||||
protected long _PendingTime = 500L;
|
||||
|
||||
private int _LockedInternal = -1;
|
||||
protected bool _Active;
|
||||
|
||||
protected float _MaxVolume = 100f;
|
||||
|
||||
protected int _PreviewSelected
|
||||
//the real selected song for singing
|
||||
protected int _Locked { get; set; }
|
||||
|
||||
private int _PreviewIdInternal = -1;
|
||||
protected virtual int _PreviewId
|
||||
{
|
||||
//for preview only
|
||||
get
|
||||
{
|
||||
if ((_SelectedInternal != _SelectedPending) && (_Timer.ElapsedMilliseconds >= _PendingTime))
|
||||
{
|
||||
_Timer.Stop();
|
||||
_Timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
return _SelectedInternal;
|
||||
}
|
||||
get { return _PreviewIdInternal; }
|
||||
set
|
||||
{
|
||||
if (value == -1)
|
||||
{
|
||||
_Timer.Stop();
|
||||
_Timer.Reset();
|
||||
|
||||
_SelectedInternal = -1;
|
||||
_SelectedPending = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((value != _SelectedInternal) && (value != _SelectedPending))
|
||||
{
|
||||
_Timer.Reset();
|
||||
_Timer.Start();
|
||||
|
||||
_SelectedPending = value;
|
||||
}
|
||||
|
||||
if ((value == _SelectedPending) && ((_Timer.ElapsedMilliseconds >= _PendingTime) || (_SelectedInternal == -1)))
|
||||
{
|
||||
_Timer.Stop();
|
||||
_Timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
//Do this first, otherwhise song will restart
|
||||
_PlaySong(value);
|
||||
_PreviewIdInternal = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected void _SetSelectedNow()
|
||||
{
|
||||
_Timer.Stop();
|
||||
_Timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
protected int _PreviewSongStream { get; private set; }
|
||||
|
||||
protected int _Locked
|
||||
{
|
||||
//the real selected song for singing
|
||||
get { return _LockedInternal; }
|
||||
set { _LockedInternal = value; }
|
||||
}
|
||||
protected int _PreviewVideoStream { get; private set; }
|
||||
|
||||
protected int _SongStream
|
||||
{
|
||||
get { return _Actsongstream; }
|
||||
}
|
||||
|
||||
protected int _Video { get; private set; }
|
||||
|
||||
protected int _ActSong
|
||||
{
|
||||
get { return _ActSongId; }
|
||||
}
|
||||
|
||||
public SRectF Rect
|
||||
{
|
||||
get { return _Rect; }
|
||||
}
|
||||
|
||||
public SRectF GetRect()
|
||||
{
|
||||
return _Rect;
|
||||
}
|
||||
public SRectF Rect { get; protected set; }
|
||||
|
||||
public SColorF Color
|
||||
{
|
||||
@@ -207,7 +141,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public virtual int GetActualSelection()
|
||||
{
|
||||
return _ActSongId;
|
||||
return -1;
|
||||
}
|
||||
|
||||
private bool _Selected;
|
||||
@@ -237,7 +171,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
protected CSongMenuFramework(int partyModeID)
|
||||
{
|
||||
_PartyModeID = partyModeID;
|
||||
_Video = -1;
|
||||
_PreviewVideoStream = -1;
|
||||
_PreviewSongStream = -1;
|
||||
_Locked = -1;
|
||||
_Theme = new SThemeSongMenu
|
||||
{
|
||||
SongMenuTileBoard =
|
||||
@@ -426,7 +362,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public void UpdateRect(SRectF rect)
|
||||
{
|
||||
_Rect = rect;
|
||||
Rect = rect;
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -435,23 +371,20 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (!_Initialized)
|
||||
return;
|
||||
|
||||
if (_ActSongId != _PreviewSelected)
|
||||
_SelectSong(_PreviewSelected);
|
||||
|
||||
if (_Streams.Count <= 0 || _Video == -1)
|
||||
if (_Streams.Count <= 0 || _PreviewVideoStream == -1)
|
||||
return;
|
||||
|
||||
if (CBase.Video.IsFinished(_Video) || CBase.Sound.IsFinished(_Actsongstream))
|
||||
if (CBase.Video.IsFinished(_PreviewVideoStream) || CBase.Sound.IsFinished(_PreviewSongStream))
|
||||
{
|
||||
CBase.Video.Close(_Video);
|
||||
_Video = -1;
|
||||
CBase.Video.Close(_PreviewVideoStream);
|
||||
_PreviewVideoStream = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
float time = CBase.Sound.GetPosition(_Actsongstream);
|
||||
float time = CBase.Sound.GetPosition(_PreviewSongStream);
|
||||
|
||||
float vtime;
|
||||
if (CBase.Video.GetFrame(_Video, ref _Vidtex, time, out vtime))
|
||||
if (CBase.Video.GetFrame(_PreviewVideoStream, ref _Vidtex, time, out vtime))
|
||||
{
|
||||
if (_Vidtex != null)
|
||||
{
|
||||
@@ -468,25 +401,14 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public virtual void OnShow()
|
||||
{
|
||||
_Actsongstream = -1;
|
||||
_PreviewSongStream = -1;
|
||||
_Vidtex = null;
|
||||
ApplyVolume(CBase.Config.GetPreviewMusicVolume());
|
||||
}
|
||||
|
||||
public virtual void OnHide()
|
||||
{
|
||||
foreach (int stream in _Streams)
|
||||
CBase.Sound.FadeAndStop(stream, 0f, 0.75f);
|
||||
_Streams.Clear();
|
||||
|
||||
CBase.Video.Close(_Video);
|
||||
_Video = -1;
|
||||
|
||||
CBase.Drawing.RemoveTexture(ref _Vidtex);
|
||||
|
||||
_Timer.Stop();
|
||||
_Timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
_Reset();
|
||||
}
|
||||
|
||||
public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) {}
|
||||
@@ -498,7 +420,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (!_Initialized || !_Visible)
|
||||
return;
|
||||
|
||||
if (_Video != -1)
|
||||
if (_PreviewVideoStream != -1)
|
||||
CBase.Drawing.DrawTexture(_Vidtex, new SRectF(0, 0, 1280, 720, 0));
|
||||
}
|
||||
|
||||
@@ -571,9 +493,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (!_Initialized)
|
||||
return false;
|
||||
if (CBase.Songs.IsInCategory() || _PreviewSelected < 0 || _PreviewSelected >= CBase.Songs.GetNumCategories())
|
||||
if (CBase.Songs.IsInCategory() || _PreviewId < 0 || _PreviewId >= CBase.Songs.GetNumCategories())
|
||||
return false;
|
||||
_EnterCategory(_PreviewSelected);
|
||||
_EnterCategory(_PreviewId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -601,53 +523,44 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
CBase.Songs.SetCategory(-1);
|
||||
}
|
||||
|
||||
public void ApplyVolume()
|
||||
private void _PlaySong(int nr)
|
||||
{
|
||||
CBase.Sound.SetStreamVolume(_Actsongstream, CBase.Config.GetPreviewMusicVolume());
|
||||
}
|
||||
|
||||
protected void _SelectSong(int nr)
|
||||
{
|
||||
if (CBase.Songs.IsInCategory() && (CBase.Songs.GetNumSongsVisible() > 0) && (nr >= 0) && ((_ActSongId != nr) || (_Streams.Count == 0)))
|
||||
if (CBase.Songs.IsInCategory() && (_PreviewId != nr || _Streams.Count == 0))
|
||||
{
|
||||
_Streams.ForEach(soundStream => CBase.Sound.FadeAndStop(soundStream, 0f, 1f));
|
||||
_Streams.Clear();
|
||||
_Reset();
|
||||
|
||||
CBase.Video.Close(_Video);
|
||||
_Video = -1;
|
||||
CSong song = CBase.Songs.GetVisibleSong(nr);
|
||||
if (song == null)
|
||||
return;
|
||||
|
||||
CBase.Drawing.RemoveTexture(ref _Vidtex);
|
||||
|
||||
_ActSongId = nr;
|
||||
if (_ActSongId >= CBase.Songs.GetNumSongsVisible())
|
||||
_ActSongId = 0;
|
||||
|
||||
|
||||
CSong actSong = CBase.Songs.GetVisibleSong(_ActSongId);
|
||||
int stream = CBase.Sound.Load(Path.Combine(actSong.Folder, actSong.MP3FileName), true);
|
||||
int stream = CBase.Sound.Load(Path.Combine(song.Folder, song.MP3FileName), true);
|
||||
CBase.Sound.SetStreamVolumeMax(stream, _MaxVolume);
|
||||
CBase.Sound.SetStreamVolume(stream, 0f);
|
||||
|
||||
float startposition = actSong.Preview.StartTime;
|
||||
float startposition = song.Preview.StartTime;
|
||||
float length = CBase.Sound.GetLength(stream);
|
||||
|
||||
if (actSong.Preview.Source == EDataSource.None)
|
||||
startposition = CBase.Sound.GetLength(stream) / 4f;
|
||||
if (song.Preview.Source == EDataSource.None)
|
||||
startposition = length / 4f;
|
||||
else if (startposition > length - 5f)
|
||||
startposition = Math.Max(0f, Math.Min(length / 4f, length - 5f));
|
||||
|
||||
if (startposition >= 0.5f)
|
||||
startposition -= 0.5f;
|
||||
|
||||
CBase.Sound.SetPosition(stream, startposition);
|
||||
CBase.Sound.Play(stream);
|
||||
CBase.Sound.SetStreamVolumeMax(stream, CBase.Config.GetPreviewMusicVolume());
|
||||
CBase.Sound.Fade(stream, 100f, 3f);
|
||||
_Streams.Add(stream);
|
||||
_Actsongstream = stream;
|
||||
_PreviewSongStream = stream;
|
||||
|
||||
if (actSong.VideoFileName != "" && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
|
||||
if (song.VideoFileName != "" && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
_Video = CBase.Video.Load(Path.Combine(actSong.Folder, actSong.VideoFileName));
|
||||
if (_Video == -1)
|
||||
_PreviewVideoStream = CBase.Video.Load(Path.Combine(song.Folder, song.VideoFileName));
|
||||
if (_PreviewVideoStream == -1)
|
||||
return;
|
||||
CBase.Video.Skip(_Video, startposition, actSong.VideoGap);
|
||||
CBase.Video.Skip(_PreviewVideoStream, startposition, song.VideoGap);
|
||||
_VideoFadeTimer.Stop();
|
||||
_VideoFadeTimer.Reset();
|
||||
_VideoFadeTimer.Start();
|
||||
@@ -661,14 +574,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
CBase.Sound.FadeAndStop(stream, 0f, 0.75f);
|
||||
_Streams.Clear();
|
||||
|
||||
CBase.Video.Close(_Video);
|
||||
_Video = -1;
|
||||
CBase.Video.Close(_PreviewVideoStream);
|
||||
_PreviewVideoStream = -1;
|
||||
|
||||
CBase.Drawing.RemoveTexture(ref _Vidtex);
|
||||
|
||||
_Timer.Stop();
|
||||
_Timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
|
||||
@@ -61,6 +61,15 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public CSongMenuTileBoard(int partyModeID)
|
||||
: base(partyModeID) {}
|
||||
|
||||
protected override int _PreviewId
|
||||
{
|
||||
set
|
||||
{
|
||||
base._PreviewId = value;
|
||||
_UpdatePreview();
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetActualSelection()
|
||||
{
|
||||
return _ActualSelection;
|
||||
@@ -70,15 +79,13 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_Rect = _Theme.SongMenuTileBoard.TileRect;
|
||||
Rect = _Theme.SongMenuTileBoard.TileRect;
|
||||
|
||||
_NumW = _Theme.SongMenuTileBoard.NumW;
|
||||
_NumH = _Theme.SongMenuTileBoard.NumH;
|
||||
_SpaceW = _Theme.SongMenuTileBoard.SpaceW;
|
||||
_SpaceH = _Theme.SongMenuTileBoard.SpaceH;
|
||||
|
||||
_PendingTime = 100L;
|
||||
|
||||
_TileW = (int)((_Theme.SongMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
|
||||
_TileH = (int)((_Theme.SongMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);
|
||||
|
||||
@@ -91,7 +98,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
for (int j = 0; j < _NumW; j++)
|
||||
{
|
||||
var rect = new SRectF(_Theme.SongMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
|
||||
_Theme.SongMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
_Theme.SongMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z);
|
||||
var tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
|
||||
_Tiles.Add(tile);
|
||||
}
|
||||
@@ -99,9 +106,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
_ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Theme.SongMenuTileBoard.TileRect.Z);
|
||||
|
||||
_PreviewSelected = -1;
|
||||
_Offset = 0;
|
||||
|
||||
_CoverBig = _Theme.SongMenuTileBoard.StaticCoverBig;
|
||||
_TextBG = _Theme.SongMenuTileBoard.StaticTextBG;
|
||||
_DuetIcon = _Theme.SongMenuTileBoard.StaticDuetIcon;
|
||||
@@ -112,6 +116,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Artist = _Theme.SongMenuTileBoard.TextArtist;
|
||||
_Title = _Theme.SongMenuTileBoard.TextTitle;
|
||||
_SongLength = _Theme.SongMenuTileBoard.TextSongLength;
|
||||
|
||||
_PreviewId = -1;
|
||||
_Offset = 0;
|
||||
}
|
||||
|
||||
public override void Update(SScreenSongOptions songOptions)
|
||||
@@ -120,52 +127,98 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
if (songOptions.Selection.RandomOnly)
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
_ActualSelection = _PreviewSelected;
|
||||
_Locked = _PreviewId;
|
||||
_ActualSelection = _PreviewId;
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
_Tiles[i].Selected = _Locked == i + _Offset;
|
||||
}
|
||||
}
|
||||
|
||||
private void _UpdatePreview()
|
||||
{
|
||||
//First hide everything so we just have to set what we actually want
|
||||
_CoverBig.Texture = _CoverBigTexture;
|
||||
_Artist.Text = String.Empty;
|
||||
_Title.Text = String.Empty;
|
||||
_SongLength.Text = String.Empty;
|
||||
_DuetIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
|
||||
//Check if nothing is selected (for preview)
|
||||
if (_PreviewId < 0)
|
||||
return;
|
||||
|
||||
if (CBase.Songs.IsInCategory())
|
||||
{
|
||||
CSong song = CBase.Songs.GetVisibleSong(_PreviewId);
|
||||
//Check if we have a valid song (song still visible, index >=0 etc is checked by framework)
|
||||
if (song == null)
|
||||
{
|
||||
//Display at least the category
|
||||
CCategory category = CBase.Songs.GetCategory(CBase.Songs.GetCurrentCategoryIndex());
|
||||
//Check if we have a valid category
|
||||
if (category == null)
|
||||
return;
|
||||
_CoverBig.Texture = category.CoverTextureBig;
|
||||
_Artist.Text = category.Name;
|
||||
return;
|
||||
}
|
||||
_CoverBig.Texture = song.CoverTextureBig;
|
||||
_Artist.Text = song.Artist;
|
||||
_Title.Text = song.Title;
|
||||
_DuetIcon.Visible = song.IsDuet;
|
||||
_VideoIcon.Visible = song.VideoFileName != "";
|
||||
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
|
||||
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
|
||||
|
||||
float time = CBase.Sound.GetLength(_PreviewSongStream);
|
||||
if (Math.Abs(song.Finish) > 0.001)
|
||||
time = song.Finish;
|
||||
|
||||
time -= song.Start;
|
||||
var min = (int)Math.Floor(time / 60f);
|
||||
var sec = (int)(time - min * 60f);
|
||||
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
|
||||
}
|
||||
else
|
||||
{
|
||||
CCategory category = CBase.Songs.GetCategory(_PreviewId);
|
||||
//Check if we have a valid category
|
||||
if (category == null)
|
||||
return;
|
||||
_CoverBig.Texture = category.CoverTextureBig;
|
||||
_Artist.Text = category.Name;
|
||||
|
||||
int num = category.GetNumSongsNotSung();
|
||||
String songOrSongs = (num == 1) ? "TR_SCREENSONG_NUMSONG" : "TR_SCREENSONG_NUMSONGS";
|
||||
_Title.Text = CBase.Language.Translate(songOrSongs).Replace("%v", num.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && !CBase.Songs.IsInCategory())
|
||||
_EnterCategory(0);
|
||||
_ActualSelection = -1;
|
||||
_Locked = -1;
|
||||
_PreviewSelected = -1;
|
||||
_PreviewId = -1;
|
||||
_UpdateList(0, true);
|
||||
//AfterCategoryChange();
|
||||
SetSelectedSong(_ActSong);
|
||||
SetSelectedSong(_PreviewId);
|
||||
_AfterCategoryChange();
|
||||
|
||||
int actcat = _PreviewSelected;
|
||||
if ((CBase.Songs.GetNumCategories() > 0) && (actcat < 0))
|
||||
if (_PreviewId < 0)
|
||||
{
|
||||
_CoverBig.Texture = CBase.Songs.GetCategory(0).CoverTextureBig;
|
||||
_Artist.Text = CBase.Songs.GetCategory(0).Name;
|
||||
_Title.Text = String.Empty;
|
||||
_SongLength.Text = String.Empty;
|
||||
_PreviewSelected = 0;
|
||||
_PreviewId = 0;
|
||||
_Locked = 0;
|
||||
_DuetIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
}
|
||||
|
||||
if (CBase.Songs.GetNumSongsVisible() == 0 && CBase.Songs.GetSearchFilter() != "")
|
||||
{
|
||||
_CoverBig.Texture = _CoverBigTexture;
|
||||
_Artist.Text = String.Empty;
|
||||
_Title.Text = String.Empty;
|
||||
_SongLength.Text = String.Empty;
|
||||
_PreviewSelected = -1;
|
||||
_PreviewId = -1;
|
||||
_Locked = -1;
|
||||
_DuetIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,14 +238,13 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if ((_Locked == -1 || !sel) &&
|
||||
(keyEvent.Key != Keys.Escape && keyEvent.Key != Keys.Back && keyEvent.Key != Keys.PageUp && keyEvent.Key != Keys.PageDown))
|
||||
{
|
||||
if (_PreviewSelected > -1)
|
||||
_Locked = _PreviewSelected;
|
||||
if (_PreviewId > -1)
|
||||
_Locked = _PreviewId;
|
||||
else
|
||||
{
|
||||
_Locked = 0;
|
||||
_ActualSelection = 0;
|
||||
_PreviewSelected = 0;
|
||||
_SetSelectedNow();
|
||||
_PreviewId = 0;
|
||||
_UpdateList(0, true);
|
||||
}
|
||||
}
|
||||
@@ -203,10 +255,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
case Keys.Enter:
|
||||
if (!CBase.Songs.IsInCategory())
|
||||
{
|
||||
_EnterCategory(_PreviewSelected);
|
||||
_EnterCategory(_PreviewId);
|
||||
keyEvent.Handled = true;
|
||||
}
|
||||
else if (_ActualSelection > -1 && _PreviewSelected >= 0)
|
||||
else if (_ActualSelection > -1 && _PreviewId >= 0)
|
||||
_Locked = _ActualSelection;
|
||||
break;
|
||||
|
||||
@@ -301,7 +353,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
if (!keyEvent.Handled)
|
||||
{
|
||||
_PreviewSelected = _Locked;
|
||||
_PreviewId = _Locked;
|
||||
_ActualSelection = _Locked;
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
@@ -318,7 +370,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
bool sel = false;
|
||||
int lastselection = _ActualSelection;
|
||||
|
||||
if (!songOptions.Selection.RandomOnly || !CBase.Songs.IsInCategory() && songOptions.Selection.CategoryChangeAllowed)
|
||||
if (!songOptions.Selection.RandomOnly || (!CBase.Songs.IsInCategory() && songOptions.Selection.CategoryChangeAllowed))
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
@@ -326,11 +378,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (mouseEvent.LB || !CBase.Songs.IsInCategory())
|
||||
{
|
||||
if (_PreviewSelected == i + _Offset)
|
||||
_Locked = _PreviewSelected;
|
||||
if (_PreviewId == i + _Offset)
|
||||
_Locked = _PreviewId;
|
||||
else
|
||||
{
|
||||
_PreviewSelected = i + _Offset;
|
||||
_PreviewId = i + _Offset;
|
||||
_Locked = -1;
|
||||
}
|
||||
}
|
||||
@@ -361,10 +413,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
if (mouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode)
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenMain);
|
||||
else if (_PreviewSelected != -1 && mouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !songOptions.Selection.PartyMode)
|
||||
else if (_PreviewId != -1 && mouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !songOptions.Selection.PartyMode)
|
||||
{
|
||||
if (CHelper.IsInBounds(_CoverBig.Rect, mouseEvent) || CHelper.IsInBounds(_TextBG.Rect, mouseEvent))
|
||||
_Locked = _PreviewSelected;
|
||||
_Locked = _PreviewId;
|
||||
}
|
||||
else if (mouseEvent.LB && (!CBase.Songs.IsInCategory()))
|
||||
{
|
||||
@@ -372,7 +424,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (tile.Texture != _CoverTexture && CHelper.IsInBounds(tile.Rect, mouseEvent))
|
||||
{
|
||||
_EnterCategory(_PreviewSelected);
|
||||
_EnterCategory(_PreviewId);
|
||||
mouseEvent.Handled = true;
|
||||
return;
|
||||
}
|
||||
@@ -392,67 +444,14 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop);
|
||||
else
|
||||
{
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (tile.Texture != _CoverTexture)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
tile.Draw(1f, tile.Rect.Z, EAspect.Crop);
|
||||
else
|
||||
tile.Draw(1f, tile.Rect.Z, EAspect.Stretch);
|
||||
}
|
||||
}
|
||||
|
||||
if (CBase.Songs.IsInCategory())
|
||||
{
|
||||
int actsong = _PreviewSelected;
|
||||
if ((CBase.Songs.GetNumSongsVisible() > actsong) && (actsong >= 0))
|
||||
{
|
||||
CSong song = CBase.Songs.GetVisibleSong(actsong);
|
||||
|
||||
_CoverBig.Texture = song.CoverTextureBig;
|
||||
_Artist.Text = song.Artist;
|
||||
_Title.Text = song.Title;
|
||||
_DuetIcon.Visible = song.IsDuet;
|
||||
_VideoIcon.Visible = song.VideoFileName != "";
|
||||
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
|
||||
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
|
||||
|
||||
float time = CBase.Sound.GetLength(_SongStream);
|
||||
if (Math.Abs(song.Finish) > 0.001)
|
||||
time = song.Finish;
|
||||
|
||||
time -= song.Start;
|
||||
var min = (int)Math.Floor(time / 60f);
|
||||
var sec = (int)(time - min * 60f);
|
||||
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int actcat = _PreviewSelected;
|
||||
if ((CBase.Songs.GetNumCategories() > actcat) && (actcat >= 0))
|
||||
{
|
||||
_CoverBig.Texture = CBase.Songs.GetCategory(actcat).CoverTextureBig;
|
||||
_Artist.Text = CBase.Songs.GetCategory(actcat).Name;
|
||||
|
||||
int num = CBase.Songs.NumSongsInCategory(actcat);
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (num != 1)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString());
|
||||
else
|
||||
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString());
|
||||
|
||||
_SongLength.Text = String.Empty;
|
||||
_DuetIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
EAspect aspect = (tile.Texture != _CoverTexture) ? EAspect.Crop : EAspect.Stretch;
|
||||
tile.Draw(1f, tile.Rect.Z, aspect);
|
||||
}
|
||||
}
|
||||
|
||||
_TextBG.Draw();
|
||||
|
||||
if (_Vidtex != null && _Video != -1)
|
||||
if (_Vidtex != null && _PreviewVideoStream != -1)
|
||||
{
|
||||
if (_Vidtex.Color.A < 1)
|
||||
_CoverBig.Draw(1f, EAspect.Crop);
|
||||
@@ -508,14 +507,13 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
if (_Locked == -1 || !sel)
|
||||
{
|
||||
if (_PreviewSelected > -1)
|
||||
_Locked = _PreviewSelected;
|
||||
if (_PreviewId > -1)
|
||||
_Locked = _PreviewId;
|
||||
else
|
||||
{
|
||||
_Locked = 0;
|
||||
_ActualSelection = 0;
|
||||
_PreviewSelected = 0;
|
||||
_SetSelectedNow();
|
||||
_PreviewId = 0;
|
||||
_UpdateList(0, true);
|
||||
}
|
||||
}
|
||||
@@ -523,13 +521,12 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
foreach (CStatic tile in _Tiles)
|
||||
tile.Selected = false;
|
||||
|
||||
_PreviewSelected = itemNr;
|
||||
_SetSelectedNow();
|
||||
_PreviewId = itemNr;
|
||||
_Locked = itemNr;
|
||||
|
||||
_UpdateList(true);
|
||||
|
||||
_PreviewSelected = _Locked;
|
||||
_PreviewId = _Locked;
|
||||
_ActualSelection = _Locked;
|
||||
|
||||
if (_Locked - _Offset >= 0)
|
||||
@@ -556,7 +553,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
base._EnterCategory(cat);
|
||||
|
||||
_PreviewSelected = 0;
|
||||
_PreviewId = 0;
|
||||
_Locked = -1;
|
||||
_ActualSelection = 0;
|
||||
_AfterCategoryChange();
|
||||
@@ -567,7 +564,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
base._ShowCategories();
|
||||
|
||||
_PreviewSelected = 0;
|
||||
_PreviewId = 0;
|
||||
_Locked = -1;
|
||||
_ActualSelection = 0;
|
||||
_AfterCategoryChange();
|
||||
@@ -594,9 +591,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
private void _AfterCategoryChange()
|
||||
{
|
||||
_SetSelectedNow();
|
||||
_SelectSong(_PreviewSelected);
|
||||
|
||||
foreach (CStatic tile in _Tiles)
|
||||
tile.Selected = false;
|
||||
|
||||
@@ -657,17 +651,17 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
_NumH = _Theme.SongMenuTileBoard.NumHsmall;
|
||||
_NumW = _Theme.SongMenuTileBoard.NumWsmall;
|
||||
_Rect = _Theme.SongMenuTileBoard.TileRectSmall;
|
||||
Rect = _Theme.SongMenuTileBoard.TileRectSmall;
|
||||
}
|
||||
else
|
||||
{
|
||||
_NumH = _Theme.SongMenuTileBoard.NumH;
|
||||
_NumW = _Theme.SongMenuTileBoard.NumW;
|
||||
_Rect = _Theme.SongMenuTileBoard.TileRect;
|
||||
Rect = _Theme.SongMenuTileBoard.TileRect;
|
||||
}
|
||||
|
||||
_TileW = (int)((_Rect.W - _SpaceW * (_NumW - 1)) / _NumW);
|
||||
_TileH = (int)((_Rect.H - _SpaceH * (_NumH - 1)) / _NumH);
|
||||
_TileW = (int)((Rect.W - _SpaceW * (_NumW - 1)) / _NumW);
|
||||
_TileH = (int)((Rect.H - _SpaceH * (_NumH - 1)) / _NumH);
|
||||
|
||||
_CoverTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBackgroundName, _PartyModeID);
|
||||
_CoverBigTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName, _PartyModeID);
|
||||
@@ -677,13 +671,13 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
for (int j = 0; j < _NumW; j++)
|
||||
{
|
||||
var rect = new SRectF(_Rect.X + j * (_TileW + _SpaceW), _Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
var rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z);
|
||||
var tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
|
||||
_Tiles.Add(tile);
|
||||
}
|
||||
}
|
||||
|
||||
_ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Rect.Z);
|
||||
_ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), Rect.Z);
|
||||
_UpdateList(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
bool IsSmallView();
|
||||
void SetSmallView(bool smallView);
|
||||
|
||||
SRectF GetRect();
|
||||
SRectF Rect { get; }
|
||||
}
|
||||
}
|
||||
@@ -24,13 +24,6 @@ namespace VocaluxeLib.Profile
|
||||
{
|
||||
public class CProfile
|
||||
{
|
||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings
|
||||
{
|
||||
Indent = true,
|
||||
Encoding = Encoding.UTF8,
|
||||
ConformanceLevel = ConformanceLevel.Document
|
||||
};
|
||||
|
||||
public int ID;
|
||||
|
||||
public string PlayerName;
|
||||
@@ -137,7 +130,7 @@ namespace VocaluxeLib.Profile
|
||||
XmlWriter writer;
|
||||
try
|
||||
{
|
||||
writer = XmlWriter.Create(Path.Combine(FilePath, FileName), _Settings);
|
||||
writer = XmlWriter.Create(Path.Combine(FilePath, FileName), CBase.Config.GetXMLSettings());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using VocaluxeLib.Draw;
|
||||
using System.Linq;
|
||||
|
||||
namespace VocaluxeLib.Songs
|
||||
{
|
||||
@@ -50,6 +51,11 @@ namespace VocaluxeLib.Songs
|
||||
}
|
||||
}
|
||||
|
||||
public int GetNumSongsNotSung()
|
||||
{
|
||||
return Songs.Count(sp => !sp.IsSung);
|
||||
}
|
||||
|
||||
public CCategory(string name, CTexture coverSmall, CTexture coverBig)
|
||||
{
|
||||
Name = name;
|
||||
|
||||
Reference in new issue
Block a user