Make config serializable

This commit is contained in:
Flamefire committed 2014-10-26 14:03:12 +01:00
1 parent 99b7989c48
commit 7ce9a10126
40 files changed
+553 -765

No files matched your search

+13 -13
View File
@@ -67,10 +67,9 @@ namespace Vocaluxe.Base
{ {
if (_PlaysPreview) if (_PlaysPreview)
return false; return false;
else if (_BGMusicFiles.Contains(_CurrentPlaylistElement)) if (_BGMusicFiles.Contains(_CurrentPlaylistElement))
return false; return false;
else return true;
return true;
} }
} }
@@ -118,8 +117,7 @@ namespace Vocaluxe.Base
{ {
if (_PlaysPreview) if (_PlaysPreview)
return _PreviewPlayer.ArtistAndTitle; return _PreviewPlayer.ArtistAndTitle;
else return _BGMusicFiles.Contains(_CurrentPlaylistElement) ? Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath) : _SongPlayer.ArtistAndTitle;
return _BGMusicFiles.Contains(_CurrentPlaylistElement) ? Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath) : _SongPlayer.ArtistAndTitle;
} }
} }
@@ -169,15 +167,17 @@ namespace Vocaluxe.Base
_PreviewPlayer.Volume = CConfig.PreviewMusicVolume; _PreviewPlayer.Volume = CConfig.PreviewMusicVolume;
_PreviewPlayer.RepeatSong = true; _PreviewPlayer.RepeatSong = true;
_VideoEnabled = (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON); _VideoEnabled = (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON);
SetMusicSource(CConfig.BackgroundMusicSource); SetMusicSource(CConfig.Config.Sound.BackgroundMusicSource);
_Initialized = true; _Initialized = true;
} }
public static void Close() public static void Close()
{ {
_SongPlayer.Stop(); if (_SongPlayer != null)
_PreviewPlayer.Stop(); _SongPlayer.Stop();
if (_PreviewPlayer != null)
_PreviewPlayer.Stop();
_BGMusicFiles.Clear(); _BGMusicFiles.Clear();
_NotPlayedFiles.Clear(); _NotPlayedFiles.Clear();
@@ -188,12 +188,12 @@ namespace Vocaluxe.Base
public static void Play() public static void Play()
{ {
if (IsPlaying || (CConfig.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_ON && !_PlaysPreview)) if (IsPlaying || (CConfig.Config.Sound.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_ON && !_PlaysPreview))
return; return;
if (_PlaysPreview) if (_PlaysPreview)
_PreviewPlayer.Play(); _PreviewPlayer.Play();
else if (CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) else if (CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
{ {
if (_SongPlayer.SongLoaded) if (_SongPlayer.SongLoaded)
//Resume //Resume
@@ -229,7 +229,7 @@ namespace Vocaluxe.Base
return; return;
_PreviewPlayer.TogglePause(); _PreviewPlayer.TogglePause();
} }
else if (CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) else if (CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
{ {
if (!_SongPlayer.SongLoaded) if (!_SongPlayer.SongLoaded)
Next(); Next();
@@ -395,7 +395,7 @@ namespace Vocaluxe.Base
{ {
//Seek to #Start-Tag, if found //Seek to #Start-Tag, if found
float start = 0f; float start = 0f;
if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) if (_CurrentPlaylistElement.Start > 0.001 && CConfig.Config.Sound.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
start = _CurrentPlaylistElement.Start; start = _CurrentPlaylistElement.Start;
_SongPlayer.Load(CBase.Songs.GetSongByID(_CurrentPlaylistElement.SongID), start, true); _SongPlayer.Load(CBase.Songs.GetSongByID(_CurrentPlaylistElement.SongID), start, true);
} }
+295 -509
View File
@@ -18,12 +18,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
using System.Xml.Serialization;
using Vocaluxe.Lib.Sound.Record; using Vocaluxe.Lib.Sound.Record;
using Vocaluxe.Lib.Webcam; using Vocaluxe.Lib.Webcam;
using VocaluxeLib; using VocaluxeLib;
@@ -51,62 +53,143 @@ namespace Vocaluxe.Base
public static string FileHighscoreDB = Path.Combine(CSettings.DataFolder, "HighscoreDB.sqlite"); public static string FileHighscoreDB = Path.Combine(CSettings.DataFolder, "HighscoreDB.sqlite");
private static string _FileConfig = Path.Combine(CSettings.DataFolder, "Config.xml"); private static string _FileConfig = Path.Combine(CSettings.DataFolder, "Config.xml");
// Debug // ReSharper disable UnassignedField.Global
public static EDebugLevel DebugLevel = EDebugLevel.TR_CONFIG_OFF; #pragma warning disable 649
public static EOffOn SaveModifiedSongs = EOffOn.TR_CONFIG_OFF; public struct SConfigInfo
{
// ReSharper disable NotAccessedField.Global
public string Version;
public string Time;
public string Platform;
public string OSVersion;
public int ProcessorCount;
public int Screens;
public string PrimaryScreenResolution;
public string Directory;
// ReSharper restore NotAccessedField.Global
}
// Graphics public struct SConfigDebug
{
[DefaultValue(EDebugLevel.TR_CONFIG_OFF)] public EDebugLevel DebugLevel;
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn SaveModifiedSongs;
}
public struct SConfigGraphics
{
#if WIN #if WIN
public static ERenderer Renderer = ERenderer.TR_CONFIG_DIRECT3D; [DefaultValue(ERenderer.TR_CONFIG_DIRECT3D)] public ERenderer Renderer;
#else #else
public static ERenderer Renderer = ERenderer.TR_CONFIG_OPENGL; [DefaultValue(ERenderer.TR_CONFIG_OPENGL)] public ERenderer Renderer;
#endif #endif
public static ETextureQuality TextureQuality = ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM; [DefaultValue(ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM)] public ETextureQuality TextureQuality;
public static float MaxFPS = 60f; [XmlRanged(32, 1024), DefaultValue(128)] public int CoverSize;
public static int ScreenW = 1024; [DefaultValue(1024)] public int ScreenW;
public static int ScreenH = 576; [DefaultValue(576)] public int ScreenH;
[DefaultValue(EGeneralAlignment.Middle)] public EGeneralAlignment ScreenAlignment;
[DefaultValue(0)] public int BorderLeft;
[DefaultValue(0)] public int BorderRight;
[DefaultValue(0)] public int BorderTop;
[DefaultValue(0)] public int BorderBottom;
[DefaultValue(EAntiAliasingModes.X0)] public EAntiAliasingModes AAMode;
[DefaultValue(60f)] public float MaxFPS;
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VSync;
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn FullScreen;
[DefaultValue(0.4f)] public float FadeTime;
}
public static int BorderLeft; public struct SConfigTheme
public static int BorderRight; {
public static int BorderTop; [XmlElement("Name"), DefaultValue("Ambient")] public string Theme;
public static int BorderBottom; [DefaultValue("Blue")] public string Skin;
[XmlElement("Cover"), DefaultValue("Blue")] public string CoverTheme;
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn DrawNoteLines;
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn DrawToneHelper;
[DefaultValue(ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED)] public ETimerLook TimerLook;
[DefaultValue(EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH)] public EPlayerInfo PlayerInfo;
[DefaultValue(EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_OFF)] public EFadePlayerInfo FadePlayerInfo;
[DefaultValue(ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC)] public ECoverLoading CoverLoading;
[DefaultValue(ELyricStyle.Slide)] public ELyricStyle LyricStyle;
}
public static EGeneralAlignment ScreenAlignment = EGeneralAlignment.Middle; public struct SConfigSound
{
[DefaultValue(EPlaybackLib.GstreamerSharp)] public EPlaybackLib PlayBackLib;
[DefaultValue(ERecordLib.PortAudio)] public ERecordLib RecordLib;
[DefaultValue(EBufferSize.B2048)] public EBufferSize AudioBufferSize;
[XmlRanged(-500, 500)] public int AudioLatency;
// ReSharper disable MemberHidesStaticFromOuterClass
[DefaultValue(EBackgroundMusicOffOn.TR_CONFIG_ON)] public EBackgroundMusicOffOn BackgroundMusic;
[XmlRanged(0, 100), DefaultValue(30)] public int BackgroundMusicVolume;
[DefaultValue(EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC)] public EBackgroundMusicSource BackgroundMusicSource;
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn BackgroundMusicUseStart;
[XmlRanged(0, 100), DefaultValue(50)] public int PreviewMusicVolume;
[XmlRanged(0, 100), DefaultValue(80)] public int GameMusicVolume;
// ReSharper restore MemberHidesStaticFromOuterClass
}
public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0; public struct SConfigGame
{
[DefaultValue(CSettings.FallbackLanguage)] public string Language;
public string[] SongFolder;
[DefaultValue(ESongMenu.TR_CONFIG_TILE_BOARD)] public ESongMenu SongMenu;
[DefaultValue(ESongSorting.TR_CONFIG_ARTIST)] public ESongSorting SongSorting;
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn IgnoreArticles;
[DefaultValue(10)] public float ScoreAnimationTime;
[DefaultValue(ETimerMode.TR_CONFIG_TIMERMODE_REMAINING)] public ETimerMode TimerMode;
[XmlAltName("NumPlayer"), DefaultValue(2)] public int NumPlayers;
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn Tabs;
[DefaultValue(ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM)] public ELyricsPosition LyricsPosition;
[DefaultValue(0.1f)] public float MinLineBreakTime; //Minimum time to show the text before it is (to be) sung (if possible)
[XmlArrayItem("Player"), XmlArray] public string[] Players;
}
public static EOffOn VSync = EOffOn.TR_CONFIG_ON; public struct SConfigVideo
public static EOffOn FullScreen = EOffOn.TR_CONFIG_ON; {
[DefaultValue(EVideoDecoder.FFmpeg)] public EVideoDecoder VideoDecoder;
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideoBackgrounds;
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideoPreview;
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideosInSongs;
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn VideosToBackground;
[DefaultValue(EWebcamLib.OpenCV)] public EWebcamLib WebcamLib;
public SWebcamConfig? WebcamConfig;
}
public static float FadeTime = 0.4f; public struct SConfigRecord
public static int CoverSize = 128; {
public SMicConfig[] MicConfig;
[DefaultValue(200)] public int MicDelay; //[ms]
}
// Theme public struct SConfigServer
public static string Theme = "Ambient"; {
public static string Skin = "Blue"; [DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn ServerActive;
public static string CoverTheme = "Blue"; [DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn ServerEncryption;
public static EOffOn DrawNoteLines = EOffOn.TR_CONFIG_ON; [DefaultValue(3000)] public int ServerPort;
public static EOffOn DrawToneHelper = EOffOn.TR_CONFIG_ON; }
public static ETimerLook TimerLook = ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED; #pragma warning restore 649
public static EPlayerInfo PlayerInfo = EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH; // ReSharper restore UnassignedField.Global
public static EFadePlayerInfo FadePlayerInfo = EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_OFF;
public static ECoverLoading CoverLoading = ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC; public struct SConfig
public static ELyricStyle LyricStyle = ELyricStyle.Slide; {
// ReSharper disable NotAccessedField.Global
public SConfigInfo? Info;
// ReSharper restore NotAccessedField.Global
public SConfigDebug Debug;
public SConfigGraphics Graphics;
public SConfigTheme Theme;
public SConfigSound Sound;
public SConfigGame Game;
public SConfigVideo Video;
public SConfigRecord Record;
public SConfigServer Server;
}
public static SConfig Config;
public static bool LoadOldThemeFiles; public static bool LoadOldThemeFiles;
// Sound
public static EPlaybackLib PlayBackLib = EPlaybackLib.GstreamerSharp;
public static EBufferSize AudioBufferSize = EBufferSize.B2048;
public static int AudioLatency;
private static int _BackgroundMusicVolume = 30;
public static EBackgroundMusicOffOn BackgroundMusic = EBackgroundMusicOffOn.TR_CONFIG_ON;
public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC;
public static EOffOn BackgroundMusicUseStart = EOffOn.TR_CONFIG_ON;
private static int _PreviewMusicVolume = 50;
private static int _GameMusicVolume = 80;
//Folders //Folders
public static readonly List<string> SongFolders = new List<string> public static readonly List<string> SongFolders = new List<string>
{ {
@@ -128,72 +211,36 @@ namespace Vocaluxe.Base
Path.Combine(CSettings.DataFolder, CSettings.FolderNameProfiles) Path.Combine(CSettings.DataFolder, CSettings.FolderNameProfiles)
}; };
// Game
public static ESongMenu SongMenu = ESongMenu.TR_CONFIG_TILE_BOARD;
public static ESongSorting SongSorting = ESongSorting.TR_CONFIG_ARTIST;
public static EOffOn IgnoreArticles = EOffOn.TR_CONFIG_ON;
public static float ScoreAnimationTime = 10;
public static ETimerMode TimerMode = ETimerMode.TR_CONFIG_TIMERMODE_REMAINING;
public static int NumPlayers = 2;
public static EOffOn Tabs = EOffOn.TR_CONFIG_OFF;
public static string Language = CSettings.FallbackLanguage;
public static ELyricsPosition LyricsPosition = ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM;
public static readonly string[] Players = new string[CSettings.MaxNumPlayer];
public static float MinLineBreakTime = 0.1f; //Minimum time to show the text before it is (to be) sung (if possible)
// Video
public static EVideoDecoder VideoDecoder = EVideoDecoder.FFmpeg;
public static EOffOn VideoBackgrounds = EOffOn.TR_CONFIG_ON;
public static EOffOn VideoPreview = EOffOn.TR_CONFIG_ON;
public static EOffOn VideosInSongs = EOffOn.TR_CONFIG_ON;
public static EOffOn VideosToBackground = EOffOn.TR_CONFIG_OFF;
// Record
public static ERecordLib RecordLib = ERecordLib.PortAudio;
public static readonly SMicConfig[] MicConfig = new SMicConfig[CSettings.MaxNumPlayer];
public static int MicDelay = 200; //[ms]
// Webcam
public static EWebcamLib WebcamLib = EWebcamLib.OpenCV;
public static SWebcamConfig WebcamConfig;
// Server
public static EOffOn ServerActive = EOffOn.TR_CONFIG_OFF;
public static EOffOn ServerEncryption = EOffOn.TR_CONFIG_OFF;
public static int ServerPort = 3000;
//public static string ServerPassword = "vocaluxe";
//Lists to save parameters and values //Lists to save parameters and values
private static readonly List<string> _Params = new List<string>(); private static readonly List<string> _Params = new List<string>();
private static readonly List<string> _Values = new List<string>(); private static readonly List<string> _Values = new List<string>();
public static int BackgroundMusicVolume public static int BackgroundMusicVolume
{ {
get { return _BackgroundMusicVolume; } get { return Config.Sound.BackgroundMusicVolume; }
set set
{ {
_BackgroundMusicVolume = value.Clamp(0, 100); Config.Sound.BackgroundMusicVolume = value.Clamp(0, 100);
SaveConfig(); SaveConfig();
} }
} }
public static int GameMusicVolume public static int GameMusicVolume
{ {
get { return _GameMusicVolume; } get { return Config.Sound.GameMusicVolume; }
set set
{ {
_GameMusicVolume = value.Clamp(0, 100); Config.Sound.GameMusicVolume = value.Clamp(0, 100);
SaveConfig(); SaveConfig();
} }
} }
public static int PreviewMusicVolume public static int PreviewMusicVolume
{ {
get { return _PreviewMusicVolume; } get { return Config.Sound.PreviewMusicVolume; }
set set
{ {
_PreviewMusicVolume = value.Clamp(0, 100); Config.Sound.PreviewMusicVolume = value.Clamp(0, 100);
SaveConfig(); SaveConfig();
} }
} }
@@ -214,434 +261,171 @@ namespace Vocaluxe.Base
private static void _LoadConfig() private static void _LoadConfig()
{ {
CXMLReader xmlReader = CXMLReader.OpenFile(_FileConfig); var xml = new CXmlSerializer();
if (xmlReader == null) Config = xml.Deserialize<SConfig>(_FileConfig);
return;
xmlReader.TryGetEnumValue("//root/Debug/DebugLevel", ref DebugLevel); if (Config.Game.SongFolder.Length > 0)
xmlReader.TryGetEnumValue("//root/Debug/SaveModifiedSongs", ref SaveModifiedSongs);
#region Graphics
xmlReader.TryGetEnumValue("//root/Graphics/Renderer", ref Renderer);
xmlReader.TryGetEnumValue("//root/Graphics/TextureQuality", ref TextureQuality);
xmlReader.TryGetIntValueRange("//root/Graphics/CoverSize", ref CoverSize, 32, 1024);
xmlReader.TryGetIntValue("//root/Graphics/ScreenW", ref ScreenW);
xmlReader.TryGetIntValue("//root/Graphics/ScreenH", ref ScreenH);
xmlReader.TryGetEnumValue("//root/Graphics/ScreenAlignment", ref ScreenAlignment);
xmlReader.TryGetIntValue("//root/Graphics/BorderLeft", ref BorderLeft);
xmlReader.TryGetIntValue("//root/Graphics/BorderRight", ref BorderRight);
xmlReader.TryGetIntValue("//root/Graphics/BorderTop", ref BorderTop);
xmlReader.TryGetIntValue("//root/Graphics/BorderBottom", ref BorderBottom);
xmlReader.TryGetEnumValue("//root/Graphics/AAMode", ref AAMode);
xmlReader.TryGetFloatValue("//root/Graphics/MaxFPS", ref MaxFPS);
xmlReader.TryGetEnumValue("//root/Graphics/VSync", ref VSync);
xmlReader.TryGetEnumValue("//root/Graphics/FullScreen", ref FullScreen);
xmlReader.TryGetFloatValue("//root/Graphics/FadeTime", ref FadeTime);
#endregion Graphics
#region Theme
xmlReader.GetValue("//root/Theme/Name", out Theme, Theme);
xmlReader.GetValue("//root/Theme/Skin", out Skin, Skin);
xmlReader.GetValue("//root/Theme/Cover", out CoverTheme, CoverTheme);
xmlReader.TryGetEnumValue("//root/Theme/DrawNoteLines", ref DrawNoteLines);
xmlReader.TryGetEnumValue("//root/Theme/DrawToneHelper", ref DrawToneHelper);
xmlReader.TryGetEnumValue("//root/Theme/TimerLook", ref TimerLook);
xmlReader.TryGetEnumValue("//root/Theme/PlayerInfo", ref PlayerInfo);
xmlReader.TryGetEnumValue("//root/Theme/FadePlayerInfo", ref FadePlayerInfo);
xmlReader.TryGetEnumValue("//root/Theme/CoverLoading", ref CoverLoading);
xmlReader.TryGetEnumValue("//root/Theme/LyricStyle", ref LyricStyle);
#endregion Theme
#region Sound
xmlReader.TryGetEnumValue("//root/Sound/PlayBackLib", ref PlayBackLib);
xmlReader.TryGetEnumValue("//root/Sound/RecordLib", ref RecordLib);
xmlReader.TryGetEnumValue("//root/Sound/AudioBufferSize", ref AudioBufferSize);
xmlReader.TryGetIntValueRange("//root/Sound/AudioLatency", ref AudioLatency, -500, 500);
xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusic", ref BackgroundMusic);
xmlReader.TryGetIntValueRange("//root/Sound/BackgroundMusicVolume", ref _BackgroundMusicVolume);
xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusicSource", ref BackgroundMusicSource);
xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusicUseStart", ref BackgroundMusicUseStart);
xmlReader.TryGetIntValueRange("//root/Sound/PreviewMusicVolume", ref _PreviewMusicVolume);
xmlReader.TryGetIntValueRange("//root/Sound/GameMusicVolume", ref _GameMusicVolume);
#endregion Sound
#region Game
// Songfolder
string value = String.Empty;
int i = 1;
while (xmlReader.GetValue("//root/Game/SongFolder" + i, out value, value))
{ {
if (i == 1) SongFolders.Clear();
SongFolders.Clear(); SongFolders.AddRange(Config.Game.SongFolder);
SongFolders.Add(value);
value = String.Empty;
i++;
} }
if ((Config.Game.ScoreAnimationTime > 0 && Config.Game.ScoreAnimationTime < 1) || Config.Game.ScoreAnimationTime < 0)
Config.Game.ScoreAnimationTime = 1;
xmlReader.TryGetEnumValue("//root/Game/SongMenu", ref SongMenu); if (Config.Game.MinLineBreakTime < 0)
xmlReader.TryGetEnumValue("//root/Game/SongSorting", ref SongSorting); Config.Game.MinLineBreakTime = 0.1f;
xmlReader.TryGetEnumValue("//root/Game/IgnoreArticles", ref IgnoreArticles);
xmlReader.TryGetFloatValue("//root/Game/ScoreAnimationTime", ref ScoreAnimationTime);
xmlReader.TryGetEnumValue("//root/Game/TimerMode", ref TimerMode);
xmlReader.TryGetIntValue("//root/Game/NumPlayer", ref NumPlayers);
xmlReader.TryGetEnumValue("//root/Game/Tabs", ref Tabs);
xmlReader.GetValue("//root/Game/Language", out Language, Language);
xmlReader.TryGetEnumValue("//root/Game/LyricsPosition", ref LyricsPosition);
xmlReader.TryGetFloatValue("//root/Game/MinLineBreakTime", ref MinLineBreakTime);
if ((ScoreAnimationTime > 0 && ScoreAnimationTime < 1) || ScoreAnimationTime < 0) if (Config.Game.NumPlayers < 1 || Config.Game.NumPlayers > CSettings.MaxNumPlayer)
ScoreAnimationTime = 1; Config.Game.NumPlayers = 2;
Array.Resize(ref Config.Game.Players, CSettings.MaxNumPlayer);
if (MinLineBreakTime < 0) bool langExists = CLanguage.SetLanguage(Config.Game.Language);
MinLineBreakTime = 0.1f;
if (NumPlayers < 1 || NumPlayers > CSettings.MaxNumPlayer)
NumPlayers = 2;
bool langExists = CLanguage.SetLanguage(Language);
if (langExists == false) if (langExists == false)
{ {
Language = CSettings.FallbackLanguage; Config.Game.Language = CSettings.FallbackLanguage;
CLanguage.SetLanguage(Language); CLanguage.SetLanguage(Config.Game.Language);
} }
//Read players from config Config.Record.MicDelay = (int)(20 * Math.Round(Config.Record.MicDelay / 20.0));
for (i = 1; i <= CSettings.MaxNumPlayer; i++)
xmlReader.GetValue("//root/Game/Players/Player" + i, out Players[i - 1], String.Empty);
#endregion Game
#region Video if (Config.Server.ServerPort < 1 || Config.Server.ServerPort > 65535)
xmlReader.TryGetEnumValue("//root/Video/VideoDecoder", ref VideoDecoder); Config.Server.ServerPort = 3000;
xmlReader.TryGetEnumValue("//root/Video/VideoBackgrounds", ref VideoBackgrounds);
xmlReader.TryGetEnumValue("//root/Video/VideoPreview", ref VideoPreview);
xmlReader.TryGetEnumValue("//root/Video/VideosInSongs", ref VideosInSongs);
xmlReader.TryGetEnumValue("//root/Video/VideosToBackground", ref VideosToBackground);
xmlReader.TryGetEnumValue("//root/Video/WebcamLib", ref WebcamLib); Config.Info = new SConfigInfo
WebcamConfig = new SWebcamConfig(); {
xmlReader.GetValue("//root/Video/WebcamConfig/MonikerString", out WebcamConfig.MonikerString, String.Empty); Version = CSettings.GetFullVersionText(),
xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Framerate", ref WebcamConfig.Framerate); Time = DateTime.Now.ToString(),
xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Width", ref WebcamConfig.Width); Platform = Environment.OSVersion.Platform.ToString(),
xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Height", ref WebcamConfig.Height); OSVersion = Environment.OSVersion.ToString(),
#endregion Video ProcessorCount = Environment.ProcessorCount,
Screens = Screen.AllScreens.Length,
#region Record PrimaryScreenResolution = Screen.PrimaryScreen.Bounds.Size.ToString(),
for (int p = 1; p <= CSettings.MaxNumPlayer; p++) Directory = CSettings.ProgramFolder
{ };
MicConfig[p - 1] = new SMicConfig(0);
xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceName", out MicConfig[p - 1].DeviceName, String.Empty);
xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceDriver", out MicConfig[p - 1].DeviceDriver, String.Empty);
xmlReader.TryGetIntValue("//root/Record/MicConfig" + p + "/Channel", ref MicConfig[p - 1].Channel);
}
xmlReader.TryGetIntValueRange("//root/Record/MicDelay", ref MicDelay, 0, 500);
MicDelay = (int)(20 * Math.Round(MicDelay / 20.0));
#endregion Record
#region Server
xmlReader.TryGetEnumValue("//root/Server/ServerActive", ref ServerActive);
xmlReader.TryGetEnumValue("//root/Server/ServerEncryption", ref ServerEncryption);
xmlReader.TryGetIntValue("//root/Server/ServerPort", ref ServerPort);
if (ServerPort < 1 || ServerPort > 65535)
ServerPort = 3000;
//xmlReader.GetValue("//root/Server/ServerPassword", out ServerPassword, ServerPassword);
#endregion Server
} }
public static bool SaveConfig() private static string _GetComment(string elName)
{ {
XmlWriter writer = null; switch (elName)
try
{ {
writer = XmlWriter.Create(_FileConfig, XMLSettings); case "DebugLevel":
writer.WriteStartDocument(); return "DebugLevel: " + CHelper.ListStrings(Enum.GetNames(typeof(EDebugLevel)));
writer.WriteStartElement("root"); case "SaveModifiedSongs":
return "SaveModifiedSongs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
case "Renderer":
writer.WriteStartElement("Info"); return "Renderer: " + CHelper.ListStrings(Enum.GetNames(typeof(ERenderer)));
case "TextureQuality":
writer.WriteElementString("Version", CSettings.GetFullVersionText()); return "TextureQuality: " + CHelper.ListStrings(Enum.GetNames(typeof(ETextureQuality)));
writer.WriteElementString("Time", DateTime.Now.ToString()); case "CoverSize":
writer.WriteElementString("Platform", Environment.OSVersion.Platform.ToString()); return "CoverSize (pixels): 32, 64, 128, 256, 512, 1024 (default: 128)";
writer.WriteElementString("OSVersion", Environment.OSVersion.ToString()); case "ScreenW":
writer.WriteElementString("ProcessorCount", Environment.ProcessorCount.ToString()); return "Screen width and height (pixels)";
case "BorderLeft":
writer.WriteElementString("Screens", Screen.AllScreens.Length.ToString()); return "Screen borders (pixels)";
writer.WriteElementString("PrimaryScreenResolution", Screen.PrimaryScreen.Bounds.Size.ToString()); case "AAMode":
return "AAMode: " + CHelper.ListStrings(Enum.GetNames(typeof(EAntiAliasingModes)));
writer.WriteElementString("Directory", CSettings.ProgramFolder); case "MaxFPS":
return "MaxFPS should be between 1..200";
writer.WriteEndElement(); case "VSync":
return "VSync: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
#region Debug case "FullScreen":
writer.WriteStartElement("Debug"); return "FullScreen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
case "FadeTime":
writer.WriteComment("DebugLevel: " + CHelper.ListStrings(Enum.GetNames(typeof(EDebugLevel)))); return "FadeTime should be between 0..3 Seconds";
writer.WriteElementString("DebugLevel", Enum.GetName(typeof(EDebugLevel), DebugLevel)); case "Theme":
return "Theme name";
writer.WriteComment("SaveModifiedSongs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); case "Skin":
writer.WriteElementString("SaveModifiedSongs", Enum.GetName(typeof(EOffOn), SaveModifiedSongs)); return "Skin name";
case "Cover":
writer.WriteEndElement(); return "Name of cover-theme";
#endregion Debug case "DrawNoteLines":
return "Draw note-lines: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
#region Graphics case "DrawToneHelper":
writer.WriteStartElement("Graphics"); return "Draw tone-helper: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
case "TimerLook":
writer.WriteComment("Renderer: " + CHelper.ListStrings(Enum.GetNames(typeof(ERenderer)))); return "Look of timer: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerLook)));
writer.WriteElementString("Renderer", Enum.GetName(typeof(ERenderer), Renderer)); case "PlayerInfo":
return "Information about players on SingScreen: " + CHelper.ListStrings(Enum.GetNames(typeof(EPlayerInfo)));
writer.WriteComment("TextureQuality: " + CHelper.ListStrings(Enum.GetNames(typeof(ETextureQuality)))); case "FadePlayerInfo":
writer.WriteElementString("TextureQuality", Enum.GetName(typeof(ETextureQuality), TextureQuality)); return "Fade player-information with lyrics and notebars: " + CHelper.ListStrings(Enum.GetNames(typeof(EFadePlayerInfo)));
case "CoverLoading":
writer.WriteComment("CoverSize (pixels): 32, 64, 128, 256, 512, 1024 (default: 128)"); return "Cover Loading: " + CHelper.ListStrings(Enum.GetNames(typeof(ECoverLoading)));
writer.WriteElementString("CoverSize", CoverSize.ToString()); case "LyricStyle":
return "Lyric Style: " + CHelper.ListStrings(Enum.GetNames(typeof(ELyricStyle)));
writer.WriteComment("Screen width and height (pixels)"); case "PlayBackLib":
writer.WriteElementString("ScreenW", ScreenW.ToString()); return "PlayBackLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EPlaybackLib)));
writer.WriteElementString("ScreenH", ScreenH.ToString()); case "RecordLib":
return "RecordLib: " + CHelper.ListStrings(Enum.GetNames(typeof(ERecordLib)));
writer.WriteElementString("ScreenAlignment", Enum.GetName(typeof(EGeneralAlignment), ScreenAlignment)); case "AudioBufferSize":
return "AudioBufferSize: " + CHelper.ListStrings(Enum.GetNames(typeof(EBufferSize)));
writer.WriteComment("Screen borders (pixels)"); case "AudioLatency":
writer.WriteElementString("BorderLeft", BorderLeft.ToString()); return "AudioLatency from -500 to 500 ms";
writer.WriteElementString("BorderRight", BorderRight.ToString()); case "BackgroundMusic":
writer.WriteElementString("BorderTop", BorderTop.ToString()); return "Background Music: " + CHelper.ListStrings(Enum.GetNames(typeof(EBackgroundMusicOffOn)));
writer.WriteElementString("BorderBottom", BorderBottom.ToString()); case "BackgroundMusicVolume":
return "Background Music Volume from 0 to 100";
writer.WriteComment("AAMode: " + CHelper.ListStrings(Enum.GetNames(typeof(EAntiAliasingModes)))); case "BackgroundMusicSource":
writer.WriteElementString("AAMode", Enum.GetName(typeof(EAntiAliasingModes), AAMode)); return "Background Music Source: " + CHelper.ListStrings(Enum.GetNames(typeof(EBackgroundMusicSource)));
case "BackgroundMusicUseStart":
writer.WriteComment("MaxFPS should be between 1..200"); return "Background Music use start-tag of songs " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
writer.WriteElementString("MaxFPS", MaxFPS.ToString("#")); case "PreviewMusicVolume":
return "Preview Volume from 0 to 100";
writer.WriteComment("VSync: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); case "GameMusicVolume":
writer.WriteElementString("VSync", Enum.GetName(typeof(EOffOn), VSync)); return "Game Volume from 0 to 100";
case "Language":
writer.WriteComment("FullScreen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); return "Game-Language";
writer.WriteElementString("FullScreen", Enum.GetName(typeof(EOffOn), FullScreen)); case "SongFolder":
return "SongFolder: SongFolder1, SongFolder2, SongFolder3, ...";
writer.WriteComment("FadeTime should be between 0..3 Seconds"); case "SongMenu":
writer.WriteElementString("FadeTime", FadeTime.ToString("#0.00")); return "SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu)));
case "SongSorting":
writer.WriteEndElement(); return "SongSorting: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongSorting)));
#endregion Graphics case "IgnoreArticles":
return "Ignore articles on song-sorting: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
#region Theme case "ScoreAnimationTime":
writer.WriteStartElement("Theme"); return "ScoreAnimationTime: Values >= 1 or 0 for no animation. Time is in seconds.";
case "TimerMode":
writer.WriteComment("Theme name"); return "TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode)));
writer.WriteElementString("Name", Theme); case "NumPlayers":
return "NumPlayers: 1.." + CSettings.MaxNumPlayer;
writer.WriteComment("Skin name"); case "Tabs":
writer.WriteElementString("Skin", Skin); return "Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
case "LyricsPosition":
writer.WriteComment("Name of cover-theme"); return "Position if lyrics on screen: " + CHelper.ListStrings(Enum.GetNames(typeof(ELyricsPosition)));
writer.WriteElementString("Cover", CoverTheme); case "MinLineBreakTime":
return "MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung";
writer.WriteComment("Draw note-lines: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); case "Players":
writer.WriteElementString("DrawNoteLines", Enum.GetName(typeof(EOffOn), DrawNoteLines)); return "Default profile for players 1..." + CSettings.MaxNumPlayer + ":";
case "VideoDecoder":
writer.WriteComment("Draw tone-helper: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); return "VideoDecoder: " + CHelper.ListStrings(Enum.GetNames(typeof(EVideoDecoder)));
writer.WriteElementString("DrawToneHelper", Enum.GetName(typeof(EOffOn), DrawToneHelper)); case "VideoBackgrounds":
return "VideoBackgrounds: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
writer.WriteComment("Look of timer: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerLook)))); case "VideoPreview":
writer.WriteElementString("TimerLook", Enum.GetName(typeof(ETimerLook), TimerLook)); return "VideoPreview: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
case "VideosInSongs":
writer.WriteComment("Information about players on SingScreen: " + CHelper.ListStrings(Enum.GetNames(typeof(EPlayerInfo)))); return "Show Videos while singing: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
writer.WriteElementString("PlayerInfo", Enum.GetName(typeof(EPlayerInfo), PlayerInfo)); case "VideosToBackground":
return "Show backgroundmusic videos as background: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
writer.WriteComment("Fade player-information with lyrics and notebars: " + CHelper.ListStrings(Enum.GetNames(typeof(EFadePlayerInfo)))); case "WebcamLib":
writer.WriteElementString("FadePlayerInfo", Enum.GetName(typeof(EFadePlayerInfo), FadePlayerInfo)); return "WebcamLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EWebcamLib)));
case "MicDelay":
writer.WriteComment("Cover Loading: " + CHelper.ListStrings(Enum.GetNames(typeof(ECoverLoading)))); return "Mic delay in ms. 0, 20, 40, 60 ... 500";
writer.WriteElementString("CoverLoading", Enum.GetName(typeof(ECoverLoading), CoverLoading)); case "ServerActive":
return "Server On/Off: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
writer.WriteComment("Lyric Style: " + CHelper.ListStrings(Enum.GetNames(typeof(ELyricStyle)))); case "ServerEncryption":
writer.WriteElementString("LyricStyle", Enum.GetName(typeof(ELyricStyle), LyricStyle)); return "Server Encryption On/Off: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
case "ServerPort":
writer.WriteEndElement(); return "Server Port (default: 3000) [1..65535]";
#endregion Theme default:
return null;
#region Sound
writer.WriteStartElement("Sound");
writer.WriteComment("PlayBackLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EPlaybackLib))));
writer.WriteElementString("PlayBackLib", Enum.GetName(typeof(EPlaybackLib), PlayBackLib));
writer.WriteComment("RecordLib: " + CHelper.ListStrings(Enum.GetNames(typeof(ERecordLib))));
writer.WriteElementString("RecordLib", Enum.GetName(typeof(ERecordLib), RecordLib));
writer.WriteComment("AudioBufferSize: " + CHelper.ListStrings(Enum.GetNames(typeof(EBufferSize))));
writer.WriteElementString("AudioBufferSize", Enum.GetName(typeof(EBufferSize), AudioBufferSize));
writer.WriteComment("AudioLatency from -500 to 500 ms");
writer.WriteElementString("AudioLatency", AudioLatency.ToString());
writer.WriteComment("Background Music: " + CHelper.ListStrings(Enum.GetNames(typeof(EBackgroundMusicOffOn))));
writer.WriteElementString("BackgroundMusic", Enum.GetName(typeof(EBackgroundMusicOffOn), BackgroundMusic));
writer.WriteComment("Background Music Volume from 0 to 100");
writer.WriteElementString("BackgroundMusicVolume", BackgroundMusicVolume.ToString());
writer.WriteComment("Background Music Source: " + CHelper.ListStrings(Enum.GetNames(typeof(EBackgroundMusicSource))));
writer.WriteElementString("BackgroundMusicSource", Enum.GetName(typeof(EBackgroundMusicSource), BackgroundMusicSource));
writer.WriteComment("Background Music use start-tag of songs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("BackgroundMusicUseStart", Enum.GetName(typeof(EOffOn), BackgroundMusicUseStart));
writer.WriteComment("Preview Volume from 0 to 100");
writer.WriteElementString("PreviewMusicVolume", PreviewMusicVolume.ToString());
writer.WriteComment("Game Volume from 0 to 100");
writer.WriteElementString("GameMusicVolume", GameMusicVolume.ToString());
writer.WriteEndElement();
#endregion Sound
#region Game
writer.WriteStartElement("Game");
writer.WriteComment("Game-Language:");
writer.WriteElementString("Language", Language);
// SongFolder
writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ...");
for (int i = 0; i < SongFolders.Count; i++)
writer.WriteElementString("SongFolder" + (i + 1), SongFolders[i]);
writer.WriteComment("SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu))));
writer.WriteElementString("SongMenu", Enum.GetName(typeof(ESongMenu), SongMenu));
writer.WriteComment("SongSorting: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongSorting))));
writer.WriteElementString("SongSorting", Enum.GetName(typeof(ESongSorting), SongSorting));
writer.WriteComment("Ignore articles on song-sorting: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("IgnoreArticles", Enum.GetName(typeof(EOffOn), IgnoreArticles));
writer.WriteComment("ScoreAnimationTime: Values >= 1 or 0 for no animation. Time is in seconds.");
writer.WriteElementString("ScoreAnimationTime", ScoreAnimationTime.ToString());
writer.WriteComment("TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode))));
writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode));
writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer);
writer.WriteElementString("NumPlayer", NumPlayers.ToString());
writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("Tabs", Enum.GetName(typeof(EOffOn), Tabs));
writer.WriteComment("Position if lyrics on screen: " + CHelper.ListStrings(Enum.GetNames(typeof(ELyricsPosition))));
writer.WriteElementString("LyricsPosition", Enum.GetName(typeof(ELyricsPosition), LyricsPosition));
writer.WriteComment("MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung");
writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString());
writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer + ":");
writer.WriteStartElement("Players");
for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
writer.WriteElementString("Player" + i, Path.GetFileName(Players[i - 1]));
writer.WriteEndElement();
writer.WriteEndElement();
#endregion Game
#region Video
writer.WriteStartElement("Video");
writer.WriteComment("VideoDecoder: " + CHelper.ListStrings(Enum.GetNames(typeof(EVideoDecoder))));
writer.WriteElementString("VideoDecoder", Enum.GetName(typeof(EVideoDecoder), VideoDecoder));
writer.WriteComment("VideoBackgrounds: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideoBackgrounds", Enum.GetName(typeof(EOffOn), VideoBackgrounds));
writer.WriteComment("VideoPreview: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideoPreview", Enum.GetName(typeof(EOffOn), VideoPreview));
writer.WriteComment("Show Videos while singing: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideosInSongs", Enum.GetName(typeof(EOffOn), VideosInSongs));
writer.WriteComment("Show backgroundmusic videos as background: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideosToBackground", Enum.GetName(typeof(EOffOn), VideosToBackground));
writer.WriteComment("WebcamLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EWebcamLib))));
writer.WriteElementString("WebcamLib", Enum.GetName(typeof(EWebcamLib), WebcamLib));
writer.WriteStartElement("WebcamConfig");
writer.WriteElementString("MonikerString", WebcamConfig.MonikerString);
writer.WriteElementString("Framerate", WebcamConfig.Framerate.ToString());
writer.WriteElementString("Width", WebcamConfig.Width.ToString());
writer.WriteElementString("Height", WebcamConfig.Height.ToString());
writer.WriteEndElement();
writer.WriteEndElement();
#endregion Video
#region Record
writer.WriteStartElement("Record");
for (int p = 1; p <= CSettings.MaxNumPlayer; p++)
{
if (MicConfig[p - 1].DeviceName != "" && MicConfig[p - 1].Channel > 0)
{
writer.WriteStartElement("MicConfig" + p);
writer.WriteElementString("DeviceName", MicConfig[p - 1].DeviceName);
writer.WriteElementString("DeviceDriver", MicConfig[p - 1].DeviceDriver);
writer.WriteElementString("Channel", MicConfig[p - 1].Channel.ToString());
writer.WriteEndElement();
}
}
writer.WriteComment("Mic delay in ms. 0, 20, 40, 60 ... 500");
writer.WriteElementString("MicDelay", MicDelay.ToString());
writer.WriteEndElement();
#endregion Record
#region Server
writer.WriteStartElement("Server");
writer.WriteComment("Server On/Off: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("ServerActive", Enum.GetName(typeof(EOffOn), ServerActive));
writer.WriteComment("Server Encryption On/Off: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("ServerEncryption", Enum.GetName(typeof(EOffOn), ServerEncryption));
writer.WriteComment("Server Port (default: 3000) [1..65535]");
writer.WriteElementString("ServerPort", ServerPort.ToString());
//writer.WriteComment("Server Password (default: vocaluxe)");
//writer.WriteElementString("ServerPassword", ServerPassword);
writer.WriteEndElement();
#endregion Server
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
writer = null;
} }
catch (Exception) }
{
if (writer != null) public static void SaveConfig()
writer.Close(); {
return false; var xml = new CXmlSerializer(true, _GetComment);
} xml.Serialize(_FileConfig, Config);
return true;
} }
/// <summary> /// <summary>
@@ -649,7 +433,7 @@ namespace Vocaluxe.Base
/// </summary> /// </summary>
public static float CalcCycleTime() public static float CalcCycleTime()
{ {
return (1f / MaxFPS) * 1000f; return (1f / Config.Graphics.MaxFPS) * 1000f;
} }
/// <summary> /// <summary>
@@ -711,14 +495,16 @@ namespace Vocaluxe.Base
//Check if there is one or more channels //Check if there is one or more channels
if (device.Channels >= 2) if (device.Channels >= 2)
{ {
if (Config.Record.MicConfig.Length < 2)
Config.Record.MicConfig = new SMicConfig[2];
//Set this device to player 1 //Set this device to player 1
MicConfig[0].DeviceName = device.Name; Config.Record.MicConfig[0].DeviceName = device.Name;
MicConfig[0].DeviceDriver = device.Driver; Config.Record.MicConfig[0].DeviceDriver = device.Driver;
MicConfig[0].Channel = 1; Config.Record.MicConfig[0].Channel = 1;
//Set this device to player 2 //Set this device to player 2
MicConfig[1].DeviceName = device.Name; Config.Record.MicConfig[1].DeviceName = device.Name;
MicConfig[1].DeviceDriver = device.Driver; Config.Record.MicConfig[1].DeviceDriver = device.Driver;
MicConfig[1].Channel = 2; Config.Record.MicConfig[1].Channel = 2;
return true; return true;
} }
@@ -734,16 +520,16 @@ namespace Vocaluxe.Base
if (device.Channels >= 1) if (device.Channels >= 1)
{ {
//Set this device to player 1 //Set this device to player 1
MicConfig[0].DeviceName = device.Name; Config.Record.MicConfig[0].DeviceName = device.Name;
MicConfig[0].DeviceDriver = device.Driver; Config.Record.MicConfig[0].DeviceDriver = device.Driver;
MicConfig[0].Channel = 1; Config.Record.MicConfig[0].Channel = 1;
if (device.Channels >= 2) if (device.Channels >= 2)
{ {
//Set this device to player 2 //Set this device to player 2
MicConfig[1].DeviceName = device.Name; Config.Record.MicConfig[1].DeviceName = device.Name;
MicConfig[1].DeviceDriver = device.Driver; Config.Record.MicConfig[1].DeviceDriver = device.Driver;
MicConfig[1].Channel = 2; Config.Record.MicConfig[1].Channel = 2;
return true; return true;
} }
@@ -901,12 +687,12 @@ namespace Vocaluxe.Base
for (int j = 0; j < CSettings.MaxNumPlayer; j++) for (int j = 0; j < CSettings.MaxNumPlayer; j++)
{ {
CGame.Players[j].ProfileID = -1; CGame.Players[j].ProfileID = -1;
if (Players[j] == "") if (string.IsNullOrEmpty(Config.Game.Players[j]))
continue; continue;
foreach (CProfile profile in profiles) foreach (CProfile profile in profiles)
{ {
if (Path.GetFileName(profile.FileName) == Players[j] && profile.Active == EOffOn.TR_CONFIG_ON) if (Path.GetFileName(profile.FileName) == Config.Game.Players[j] && profile.Active == EOffOn.TR_CONFIG_ON)
{ {
//Update Game-infos with player //Update Game-infos with player
CGame.Players[j].ProfileID = profile.ID; CGame.Players[j].ProfileID = profile.ID;
+8 -11
View File
@@ -46,7 +46,7 @@ namespace Vocaluxe.Base
public static void Init() public static void Init()
{ {
_LoadCoverThemes(); _LoadCoverThemes();
_LoadCovers(CConfig.CoverTheme); _LoadCovers(CConfig.Config.Theme.CoverTheme);
} }
public static void Close() public static void Close()
@@ -79,7 +79,7 @@ namespace Vocaluxe.Base
{ {
for (int i = 0; i < _CoverThemes.Count; i++) for (int i = 0; i < _CoverThemes.Count; i++)
{ {
if (_CoverThemes[i].Name == CConfig.CoverTheme) if (_CoverThemes[i].Name == CConfig.Config.Theme.CoverTheme)
return i; return i;
} }
return -1; return -1;
@@ -137,7 +137,7 @@ namespace Vocaluxe.Base
public static void ReloadCovers() public static void ReloadCovers()
{ {
_UnloadCovers(); _UnloadCovers();
_LoadCovers(CConfig.CoverTheme); _LoadCovers(CConfig.Config.Theme.CoverTheme);
} }
private static void _UnloadCovers() private static void _UnloadCovers()
@@ -178,21 +178,18 @@ namespace Vocaluxe.Base
private static void _TestNewLoad(string path) private static void _TestNewLoad(string path)
{ {
SThemeCover themeCover; SThemeCover themeCover;
using (var stream = new FileStream(path, FileMode.Open)) var xml = new CXmlSerializer();
themeCover = CXmlSerializer.Deserialize<SThemeCover>(stream); themeCover = xml.Deserialize<SThemeCover>(path);
CXmlSerializer.Serialize(path + "2", themeCover); xml.Serialize(path + "2", themeCover);
string cover = themeCover.Info.Author; string cover = themeCover.Info.Author;
STheme theme = new STheme(); STheme theme = new STheme();
STheme theme2 = new STheme(); STheme theme2 = new STheme();
Stopwatch watch = new Stopwatch(); Stopwatch watch = new Stopwatch();
watch.Start(); watch.Start();
for (int i = 0; i < 1; i++) for (int i = 0; i < 1; i++)
{ theme = xml.Deserialize<STheme>(Path.Combine(CBase.Themes.GetThemeScreensPath(-1), "ScreenMain.xml"));
using (var stream = new StreamReader(Path.Combine(CBase.Themes.GetThemeScreensPath(-1), "ScreenMain.xml")))
theme = CXmlSerializer.Deserialize<STheme>(stream);
}
watch.Stop(); watch.Stop();
CXmlSerializer.Serialize(Path.Combine(CBase.Themes.GetThemeScreensPath(-1), "ScreenMain2.xml"),theme); xml.Serialize(Path.Combine(CBase.Themes.GetThemeScreensPath(-1), "ScreenMain2.xml"), theme);
return; return;
Stopwatch watch2 = new Stopwatch(); Stopwatch watch2 = new Stopwatch();
watch2.Start(); watch2.Start();
+1 -1
View File
@@ -35,7 +35,7 @@ namespace Vocaluxe.Base
{ {
if (_Draw != null) if (_Draw != null)
return false; return false;
switch (CConfig.Renderer) switch (CConfig.Config.Graphics.Renderer)
{ {
case ERenderer.TR_CONFIG_SOFTWARE: case ERenderer.TR_CONFIG_SOFTWARE:
_Draw = new CDrawWinForm(); _Draw = new CDrawWinForm();
+2 -2
View File
@@ -30,7 +30,7 @@ namespace Vocaluxe.Base
static class CGame static class CGame
{ {
private static ISongQueue _SongQueue; private static ISongQueue _SongQueue;
private static int _NumPlayers = CConfig.NumPlayers; private static int _NumPlayers = CConfig.Config.Game.NumPlayers;
/// <summary> /// <summary>
/// Last beat that has been evaluated /// Last beat that has been evaluated
@@ -222,7 +222,7 @@ namespace Vocaluxe.Base
CurrentBeatF = b; CurrentBeatF = b;
MidRecordedBeat = -0.5f + GetBeatFromTime(time, song.BPM, song.Gap + CConfig.MicDelay / 1000f); MidRecordedBeat = -0.5f + GetBeatFromTime(time, song.BPM, song.Gap + CConfig.Config.Record.MicDelay / 1000f);
for (int p = 0; p < _NumPlayers; p++) for (int p = 0; p < _NumPlayers; p++)
CRecord.AnalyzeBuffer(p); CRecord.AnalyzeBuffer(p);
+27 -26
View File
@@ -218,7 +218,7 @@ namespace Vocaluxe.Base
{ {
if (_NextScreen != EScreens.ScreenNull && _Fading == null) if (_NextScreen != EScreens.ScreenNull && _Fading == null)
{ {
_Fading = new CFading(0f, 1f, CConfig.FadeTime); _Fading = new CFading(0f, 1f, CConfig.Config.Graphics.FadeTime);
if (_NextScreen == EScreens.ScreenPartyDummy) if (_NextScreen == EScreens.ScreenPartyDummy)
{ {
@@ -343,13 +343,13 @@ namespace Vocaluxe.Base
bool popupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && bool popupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
(_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen != EScreens.ScreenSong ||
(_CurrentScreen == EScreens.ScreenSong && !CSongs.IsInCategory && CConfig.Tabs == EOffOn.TR_CONFIG_ON)) (_CurrentScreen == EScreens.ScreenSong && !CSongs.IsInCategory && CConfig.Config.Game.Tabs == EOffOn.TR_CONFIG_ON))
&& _CurrentScreen != EScreens.ScreenCredits && !CBackgroundMusic.Disabled; && _CurrentScreen != EScreens.ScreenCredits && !CBackgroundMusic.Disabled;
bool popupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord; bool popupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord;
//Hide volume control for bg-music if bg-music is disabled //Hide volume control for bg-music if bg-music is disabled
if (popupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || CSongs.Category == -1) if (popupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || CSongs.Category == -1)
&& _CurrentScreen != EScreens.ScreenSing && CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF) && _CurrentScreen != EScreens.ScreenSing && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
popupVolumeControlAllowed = false; popupVolumeControlAllowed = false;
@@ -372,43 +372,44 @@ namespace Vocaluxe.Base
{ {
case Keys.Right: case Keys.Right:
if (keyEvent.ModShift) if (keyEvent.ModShift)
CConfig.BorderLeft++; CConfig.Config.Graphics.BorderLeft++;
else else
CConfig.BorderRight--; CConfig.Config.Graphics.BorderRight--;
break; break;
case Keys.Left: case Keys.Left:
if (keyEvent.ModShift) if (keyEvent.ModShift)
CConfig.BorderLeft--; CConfig.Config.Graphics.BorderLeft--;
else else
CConfig.BorderRight++; CConfig.Config.Graphics.BorderRight++;
break; break;
case Keys.Down: case Keys.Down:
if (keyEvent.ModShift) if (keyEvent.ModShift)
CConfig.BorderTop++; CConfig.Config.Graphics.BorderTop++;
else else
CConfig.BorderBottom--; CConfig.Config.Graphics.BorderBottom--;
break; break;
case Keys.Up: case Keys.Up:
if (keyEvent.ModShift) if (keyEvent.ModShift)
CConfig.BorderTop--; CConfig.Config.Graphics.BorderTop--;
else else
CConfig.BorderBottom++; CConfig.Config.Graphics.BorderBottom++;
break; break;
case Keys.D0: case Keys.D0:
case Keys.NumPad0: case Keys.NumPad0:
CConfig.BorderLeft = CConfig.BorderRight = CConfig.BorderTop = CConfig.BorderBottom = 0; CConfig.Config.Graphics.BorderLeft =
CConfig.Config.Graphics.BorderRight = CConfig.Config.Graphics.BorderTop = CConfig.Config.Graphics.BorderBottom = 0;
break; break;
case Keys.Add: case Keys.Add:
switch (CConfig.ScreenAlignment) switch (CConfig.Config.Graphics.ScreenAlignment)
{ {
case EGeneralAlignment.Middle: case EGeneralAlignment.Middle:
CConfig.ScreenAlignment = EGeneralAlignment.End; CConfig.Config.Graphics.ScreenAlignment = EGeneralAlignment.End;
break; break;
case EGeneralAlignment.End: case EGeneralAlignment.End:
CConfig.ScreenAlignment = EGeneralAlignment.Start; CConfig.Config.Graphics.ScreenAlignment = EGeneralAlignment.Start;
break; break;
default: default:
CConfig.ScreenAlignment = EGeneralAlignment.Middle; CConfig.Config.Graphics.ScreenAlignment = EGeneralAlignment.Middle;
break; break;
} }
break; break;
@@ -428,13 +429,13 @@ namespace Vocaluxe.Base
if (popupPlayerControlAllowed && keyEvent.Key == Keys.Tab) if (popupPlayerControlAllowed && keyEvent.Key == Keys.Tab)
{ {
if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
ShowPopup(EPopupScreens.PopupPlayerControl); ShowPopup(EPopupScreens.PopupPlayerControl);
else else
HidePopup(EPopupScreens.PopupPlayerControl); HidePopup(EPopupScreens.PopupPlayerControl);
} }
if (popupPlayerControlAllowed && CConfig.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_OFF) if (popupPlayerControlAllowed && CConfig.Config.Sound.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_OFF)
{ {
if (keyEvent.Key == Keys.MediaNextTrack) if (keyEvent.Key == Keys.MediaNextTrack)
CBackgroundMusic.Next(); CBackgroundMusic.Next();
@@ -499,7 +500,7 @@ namespace Vocaluxe.Base
if (keyEvent.ModShift && (keyEvent.Key == Keys.F1)) if (keyEvent.ModShift && (keyEvent.Key == Keys.F1))
CSettings.ProgramState = EProgramState.EditTheme; CSettings.ProgramState = EProgramState.EditTheme;
else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter)) else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter))
CConfig.FullScreen = (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) ? EOffOn.TR_CONFIG_OFF : EOffOn.TR_CONFIG_ON; CConfig.Config.Graphics.FullScreen = (CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) ? EOffOn.TR_CONFIG_OFF : EOffOn.TR_CONFIG_ON;
else if (keyEvent.ModAlt && (keyEvent.Key == Keys.P)) else if (keyEvent.ModAlt && (keyEvent.Key == Keys.P))
CDraw.MakeScreenShot(); CDraw.MakeScreenShot();
else else
@@ -534,7 +535,7 @@ namespace Vocaluxe.Base
bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, mouseEvent); bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, mouseEvent);
if (popupPlayerControlAllowed && isOverPopupPlayerControl) if (popupPlayerControlAllowed && isOverPopupPlayerControl)
{ {
if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
ShowPopup(EPopupScreens.PopupPlayerControl); ShowPopup(EPopupScreens.PopupPlayerControl);
} }
@@ -589,7 +590,7 @@ namespace Vocaluxe.Base
_Screens[(int)_CurrentScreen].NextElement(); _Screens[(int)_CurrentScreen].NextElement();
} }
else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter)) else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter))
CConfig.FullScreen = (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) ? EOffOn.TR_CONFIG_OFF : EOffOn.TR_CONFIG_ON; CConfig.Config.Graphics.FullScreen = (CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) ? EOffOn.TR_CONFIG_OFF : EOffOn.TR_CONFIG_ON;
else if (keyEvent.ModAlt && (keyEvent.Key == Keys.P)) else if (keyEvent.ModAlt && (keyEvent.Key == Keys.P))
CDraw.MakeScreenShot(); CDraw.MakeScreenShot();
else else
@@ -632,12 +633,12 @@ namespace Vocaluxe.Base
private static void _DrawDebugInfos() private static void _DrawDebugInfos()
{ {
if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF) if (CConfig.Config.Debug.DebugLevel == EDebugLevel.TR_CONFIG_OFF)
return; return;
List<String> debugOutput = new List<string> {CTime.GetFPS().ToString("FPS: 000")}; List<String> debugOutput = new List<string> {CTime.GetFPS().ToString("FPS: 000")};
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
{ {
debugOutput.Add(CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00")); debugOutput.Add(CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00"));
debugOutput.Add(CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00")); debugOutput.Add(CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00"));
@@ -645,18 +646,18 @@ namespace Vocaluxe.Base
long memory = GC.GetTotalMemory(false); long memory = GC.GetTotalMemory(false);
debugOutput.Add((memory / 1000000L).ToString(CLanguage.Translate("TR_DEBUG_MEMORY") + ": 00000 MB")); debugOutput.Add((memory / 1000000L).ToString(CLanguage.Translate("TR_DEBUG_MEMORY") + ": 00000 MB"));
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL2) if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL2)
{ {
debugOutput.Add(CRecord.GetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00")); debugOutput.Add(CRecord.GetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00"));
debugOutput.Add(CRecord.GetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000")); debugOutput.Add(CRecord.GetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000"));
debugOutput.Add(CRecord.GetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00")); debugOutput.Add(CRecord.GetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00"));
debugOutput.Add(CRecord.GetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000")); debugOutput.Add(CRecord.GetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000"));
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL3) if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL3)
{ {
debugOutput.Add(CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000")); debugOutput.Add(CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000"));
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX) if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX)
debugOutput.Add(_Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)")); debugOutput.Add(_Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)"));
} }
} }
+12 -12
View File
@@ -64,7 +64,7 @@ namespace Vocaluxe.Base
{ {
public EOffOn GetSaveModifiedSongs() public EOffOn GetSaveModifiedSongs()
{ {
return CConfig.SaveModifiedSongs; return CConfig.Config.Debug.SaveModifiedSongs;
} }
public void SetBackgroundMusicVolume(int newVolume) public void SetBackgroundMusicVolume(int newVolume)
@@ -79,7 +79,7 @@ namespace Vocaluxe.Base
public EBackgroundMusicOffOn GetBackgroundMusicStatus() public EBackgroundMusicOffOn GetBackgroundMusicStatus()
{ {
return CConfig.BackgroundMusic; return CConfig.Config.Sound.BackgroundMusic;
} }
public int GetPreviewMusicVolume() public int GetPreviewMusicVolume()
@@ -89,37 +89,37 @@ namespace Vocaluxe.Base
public ESongMenu GetSongMenuType() public ESongMenu GetSongMenuType()
{ {
return CConfig.SongMenu; return CConfig.Config.Game.SongMenu;
} }
public EOffOn GetVideosToBackground() public EOffOn GetVideosToBackground()
{ {
return CConfig.VideosToBackground; return CConfig.Config.Video.VideosToBackground;
} }
public EOffOn GetVideoBackgrounds() public EOffOn GetVideoBackgrounds()
{ {
return CConfig.VideoBackgrounds; return CConfig.Config.Video.VideoBackgrounds;
} }
public EOffOn GetVideoPreview() public EOffOn GetVideoPreview()
{ {
return CConfig.VideoPreview; return CConfig.Config.Video.VideoPreview;
} }
public EOffOn GetDrawNoteLines() public EOffOn GetDrawNoteLines()
{ {
return CConfig.DrawNoteLines; return CConfig.Config.Theme.DrawNoteLines;
} }
public EOffOn GetDrawToneHelper() public EOffOn GetDrawToneHelper()
{ {
return CConfig.DrawToneHelper; return CConfig.Config.Theme.DrawToneHelper;
} }
public int GetCoverSize() public int GetCoverSize()
{ {
return CConfig.CoverSize; return CConfig.Config.Graphics.CoverSize;
} }
public IEnumerable<string> GetSongFolders() public IEnumerable<string> GetSongFolders()
@@ -129,17 +129,17 @@ namespace Vocaluxe.Base
public ESongSorting GetSongSorting() public ESongSorting GetSongSorting()
{ {
return CConfig.SongSorting; return CConfig.Config.Game.SongSorting;
} }
public EOffOn GetTabs() public EOffOn GetTabs()
{ {
return CConfig.Tabs; return CConfig.Config.Game.Tabs;
} }
public EOffOn GetIgnoreArticles() public EOffOn GetIgnoreArticles()
{ {
return CConfig.IgnoreArticles; return CConfig.Config.Game.IgnoreArticles;
} }
public bool IsMicConfigured(int playerNr) public bool IsMicConfigured(int playerNr)
+3 -3
View File
@@ -614,11 +614,11 @@ namespace Vocaluxe.Base
try try
{ {
//Check if profile saved in config //Check if profile saved in config
for (int i = 0; i < CConfig.Players.Length; i++) for (int i = 0; i < CSettings.MaxNumPlayer; i++)
{ {
if (CConfig.Players[i] == _Profiles[profileID].FileName) if (CConfig.Config.Game.Players[i] == _Profiles[profileID].FileName)
{ {
CConfig.Players[i] = string.Empty; CConfig.Config.Game.Players[i] = string.Empty;
CConfig.SaveConfig(); CConfig.SaveConfig();
} }
} }
+6 -6
View File
@@ -31,7 +31,7 @@ namespace Vocaluxe.Base
{ {
if (_Record != null) if (_Record != null)
return false; return false;
switch (CConfig.RecordLib) switch (CConfig.Config.Sound.RecordLib)
{ {
#if WIN #if WIN
case ERecordLib.DirectSound: case ERecordLib.DirectSound:
@@ -135,12 +135,12 @@ namespace Vocaluxe.Base
private static int _GetPlayerFromMicConfig(string device, string devicedriver, int channel) private static int _GetPlayerFromMicConfig(string device, string devicedriver, int channel)
{ {
for (int p = 0; p < CSettings.MaxNumPlayer; p++) for (int p = 0; p < CConfig.Config.Record.MicConfig.Length; p++)
{ {
if (CConfig.MicConfig[p].Channel != 0 && if (CConfig.Config.Record.MicConfig[p].Channel != 0 &&
CConfig.MicConfig[p].DeviceName == device && CConfig.Config.Record.MicConfig[p].DeviceName == device &&
CConfig.MicConfig[p].DeviceDriver == devicedriver && CConfig.Config.Record.MicConfig[p].DeviceDriver == devicedriver &&
CConfig.MicConfig[p].Channel == channel) CConfig.Config.Record.MicConfig[p].Channel == channel)
return p + 1; return p + 1;
} }
return 0; return 0;
+1 -1
View File
@@ -26,7 +26,7 @@ namespace Vocaluxe.Base
class CSongCategorizer : CObservable class CSongCategorizer : CObservable
{ {
private readonly List<CCategory> _Categories = new List<CCategory>(); private readonly List<CCategory> _Categories = new List<CCategory>();
private EOffOn _Tabs = CConfig.Tabs; private EOffOn _Tabs = CConfig.Config.Game.Tabs;
public CSongCategorizer() public CSongCategorizer()
{ {
+2 -2
View File
@@ -27,8 +27,8 @@ namespace Vocaluxe.Base
class CSongSorter : CObservable class CSongSorter : CObservable
{ {
private CSongPointer[] _SortedSongs = new CSongPointer[0]; private CSongPointer[] _SortedSongs = new CSongPointer[0];
private EOffOn _IgnoreArticles = CConfig.IgnoreArticles; private EOffOn _IgnoreArticles = CConfig.Config.Game.IgnoreArticles;
private ESongSorting _SongSorting = CConfig.SongSorting; private ESongSorting _SongSorting = CConfig.Config.Game.SongSorting;
public CSongSorter() public CSongSorter()
{ {
+4 -4
View File
@@ -354,15 +354,15 @@ namespace Vocaluxe.Base
CLog.StopBenchmark("Read TXTs"); CLog.StopBenchmark("Read TXTs");
CLog.StartBenchmark("Sort Songs"); CLog.StartBenchmark("Sort Songs");
Sorter.SongSorting = CConfig.SongSorting; Sorter.SongSorting = CConfig.Config.Game.SongSorting;
Sorter.IgnoreArticles = CConfig.IgnoreArticles; Sorter.IgnoreArticles = CConfig.Config.Game.IgnoreArticles;
Categorizer.Tabs = CConfig.Tabs; Categorizer.Tabs = CConfig.Config.Game.Tabs;
Categorizer.ObjectChanged += _HandleCategoriesChanged; Categorizer.ObjectChanged += _HandleCategoriesChanged;
CLog.StopBenchmark("Sort Songs"); CLog.StopBenchmark("Sort Songs");
Category = -1; Category = -1;
SongsLoaded = true; SongsLoaded = true;
switch (CConfig.CoverLoading) switch (CConfig.Config.Theme.CoverLoading)
{ {
case ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART: case ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART:
_LoadCovers(); _LoadCovers();
+1 -1
View File
@@ -40,7 +40,7 @@ namespace Vocaluxe.Base
{ {
if (_Playback != null) if (_Playback != null)
return false; return false;
switch (CConfig.PlayBackLib) switch (CConfig.Config.Sound.PlayBackLib)
{ {
case EPlaybackLib.PortAudio: case EPlaybackLib.PortAudio:
_Playback = new CPortAudioPlay(); _Playback = new CPortAudioPlay();
+1 -1
View File
@@ -30,7 +30,7 @@ namespace Vocaluxe.Base
{ {
if (_VideoDecoder != null) if (_VideoDecoder != null)
return false; return false;
switch (CConfig.VideoDecoder) switch (CConfig.Config.Video.VideoDecoder)
{ {
case EVideoDecoder.FFmpeg: case EVideoDecoder.FFmpeg:
_VideoDecoder = new CVideoDecoderFFmpeg(); _VideoDecoder = new CVideoDecoderFFmpeg();
+3 -3
View File
@@ -30,7 +30,7 @@ namespace Vocaluxe.Base
{ {
if (_Webcam != null) if (_Webcam != null)
return false; return false;
switch (CConfig.WebcamLib) switch (CConfig.Config.Video.WebcamLib)
{ {
case EWebcamLib.AForgeNet: case EWebcamLib.AForgeNet:
_Webcam = new CAForgeNet(); _Webcam = new CAForgeNet();
@@ -42,9 +42,9 @@ namespace Vocaluxe.Base
} }
if (!_Webcam.Init()) if (!_Webcam.Init())
return false; return false;
_Webcam.Select(CConfig.WebcamConfig); _Webcam.Select(CConfig.Config.Video.WebcamConfig.HasValue ? CConfig.Config.Video.WebcamConfig.Value : new SWebcamConfig());
CConfig.WebcamConfig = _Webcam.GetConfig(); CConfig.Config.Video.WebcamConfig = _Webcam.GetConfig();
CConfig.SaveConfig(); CConfig.SaveConfig();
return true; return true;
} }
+1 -1
View File
@@ -42,7 +42,7 @@ namespace Vocaluxe.Base.Fonts
Outline = outline; Outline = outline;
OutlineColor = outlineColor; OutlineColor = outlineColor;
switch (CConfig.TextureQuality) switch (CConfig.Config.Graphics.TextureQuality)
{ {
case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST: case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST:
_MaxGlyphHeight = 20f; _MaxGlyphHeight = 20f;
+1 -1
View File
@@ -236,7 +236,7 @@ namespace Vocaluxe.Base.Fonts
{ {
int index = _GetPartyFontIndex(fontName, PartyModeID); int index = _GetPartyFontIndex(fontName, PartyModeID);
if (index < 0) if (index < 0)
index = _GetThemeFontIndex(fontName, CConfig.Theme); index = _GetThemeFontIndex(fontName, CConfig.Config.Theme.Theme);
if (index >= 0) if (index >= 0)
return index; return index;
for (int i = 0; i < _FontFamilies.Count; i++) for (int i = 0; i < _FontFamilies.Count; i++)
+2 -2
View File
@@ -61,7 +61,7 @@ namespace Vocaluxe.Base.Server
public static void Init() public static void Init()
{ {
_Server = new CServer(CConfig.ServerPort, CConfig.ServerEncryption == EOffOn.TR_CONFIG_ON); _Server = new CServer(CConfig.Config.Server.ServerPort, CConfig.Config.Server.ServerEncryption == EOffOn.TR_CONFIG_ON);
CServer.SendKeyEvent = _SendKeyEvent; CServer.SendKeyEvent = _SendKeyEvent;
CServer.GetProfileData = _GetProfileData; CServer.GetProfileData = _GetProfileData;
@@ -92,7 +92,7 @@ namespace Vocaluxe.Base.Server
public static void Start() public static void Start()
{ {
if (CConfig.ServerActive == EOffOn.TR_CONFIG_ON) if (CConfig.Config.Server.ServerActive == EOffOn.TR_CONFIG_ON)
{ {
_Server.Start(); _Server.Start();
//_Discover.StartBroadcasting(); //_Discover.StartBroadcasting();
+1 -1
View File
@@ -59,7 +59,7 @@ namespace Vocaluxe.Base.ThemeSystem
protected override bool _LoadSkin() protected override bool _LoadSkin()
{ {
CSkin skin; CSkin skin;
if (!_Skins.TryGetValue(CConfig.Skin, out skin)) if (!_Skins.TryGetValue(CConfig.Config.Theme.Skin, out skin))
skin = _Skins.Values.FirstOrDefault(); skin = _Skins.Values.FirstOrDefault();
while (skin != null) while (skin != null)
{ {
+1 -1
View File
@@ -49,7 +49,7 @@ namespace Vocaluxe.Base.ThemeSystem
switch (fallbackNum) switch (fallbackNum)
{ {
case 0: case 0:
_Skins.TryGetValue(CConfig.Skin, out skin); _Skins.TryGetValue(CConfig.Config.Theme.Skin, out skin);
break; break;
case 1: case 1:
_Skins.TryGetValue(CSettings.DefaultName, out skin); _Skins.TryGetValue(CSettings.DefaultName, out skin);
+4 -4
View File
@@ -69,7 +69,7 @@ namespace Vocaluxe.Base.ThemeSystem
/// </summary> /// </summary>
public static void Load() public static void Load()
{ {
CTheme theme = _Themes.FirstOrDefault(th => th is CBaseTheme && th.Name == CConfig.Theme) ?? _Themes.FirstOrDefault(th => th is CBaseTheme); CTheme theme = _Themes.FirstOrDefault(th => th is CBaseTheme && th.Name == CConfig.Config.Theme.Theme) ?? _Themes.FirstOrDefault(th => th is CBaseTheme);
while (theme != null) while (theme != null)
{ {
if (theme.Load()) if (theme.Load())
@@ -84,8 +84,8 @@ namespace Vocaluxe.Base.ThemeSystem
CLog.LogError("No themes found! Cannot continue!", true, true); CLog.LogError("No themes found! Cannot continue!", true, true);
else else
{ {
CConfig.Theme = theme.Name; CConfig.Config.Theme.Theme = theme.Name;
CConfig.Skin = theme.CurrentSkin.Name; CConfig.Config.Theme.Skin = theme.CurrentSkin.Name;
int[] ids = _Themes.Select(th => th.PartyModeID).Distinct().ToArray(); int[] ids = _Themes.Select(th => th.PartyModeID).Distinct().ToArray();
foreach (int id in ids.Where(id => id >= 0)) foreach (int id in ids.Where(id => id >= 0))
LoadPartymodeTheme(id); LoadPartymodeTheme(id);
@@ -95,7 +95,7 @@ namespace Vocaluxe.Base.ThemeSystem
public static bool LoadPartymodeTheme(int partyModeID) public static bool LoadPartymodeTheme(int partyModeID)
{ {
Debug.Assert(partyModeID >= 0); Debug.Assert(partyModeID >= 0);
CTheme theme = _Themes.FirstOrDefault(th => th.PartyModeID == partyModeID && th.Name == CConfig.Theme); CTheme theme = _Themes.FirstOrDefault(th => th.PartyModeID == partyModeID && th.Name == CConfig.Config.Theme.Theme);
if (theme != null) if (theme != null)
{ {
if (theme.Load()) if (theme.Load())
+7 -7
View File
@@ -86,7 +86,7 @@ namespace Vocaluxe.Lib.Draw
/// </summary> /// </summary>
public CDirect3D() public CDirect3D()
{ {
_Form = new CRenderFormHook {ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH)}; _Form = new CRenderFormHook {ClientSize = new Size(CConfig.Config.Graphics.ScreenW, CConfig.Config.Graphics.ScreenH)};
try try
{ {
@@ -113,8 +113,8 @@ namespace Vocaluxe.Lib.Draw
{ {
Windowed = true, Windowed = true,
SwapEffect = SwapEffect.Discard, SwapEffect = SwapEffect.Discard,
BackBufferHeight = CConfig.ScreenH, BackBufferHeight = CConfig.Config.Graphics.ScreenH,
BackBufferWidth = CConfig.ScreenW, BackBufferWidth = CConfig.Config.Graphics.ScreenW,
BackBufferFormat = _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, BackBufferFormat = _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format,
Multisample = MultisampleType.None, Multisample = MultisampleType.None,
MultisampleQuality = 0 MultisampleQuality = 0
@@ -125,7 +125,7 @@ namespace Vocaluxe.Lib.Draw
#region Antialiasing #region Antialiasing
int quality; int quality;
MultisampleType msType; MultisampleType msType;
switch (CConfig.AAMode) switch (CConfig.Config.Graphics.AAMode)
{ {
case EAntiAliasingModes.X2: case EAntiAliasingModes.X2:
msType = MultisampleType.TwoSamples; msType = MultisampleType.TwoSamples;
@@ -159,7 +159,7 @@ namespace Vocaluxe.Lib.Draw
#endregion Antialiasing #endregion Antialiasing
//Apply the VSync configuration //Apply the VSync configuration
_PresentParameters.PresentationInterval = CConfig.VSync == EOffOn.TR_CONFIG_ON ? PresentInterval.Default : PresentInterval.Immediate; _PresentParameters.PresentationInterval = CConfig.Config.Graphics.VSync == EOffOn.TR_CONFIG_ON ? PresentInterval.Default : PresentInterval.Immediate;
//GMA 950 graphics devices can only process vertices in software mode //GMA 950 graphics devices can only process vertices in software mode
Capabilities caps = _D3D.GetDeviceCaps(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware); Capabilities caps = _D3D.GetDeviceCaps(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware);
@@ -200,10 +200,10 @@ namespace Vocaluxe.Lib.Draw
if (_Form.ClientSize.Width == 0 || _Form.ClientSize.Height == 0) if (_Form.ClientSize.Width == 0 || _Form.ClientSize.Height == 0)
_Form.ClientSize = _SizeBeforeMinimize; _Form.ClientSize = _SizeBeforeMinimize;
if (_H == _Form.ClientSize.Height && _W == _Form.ClientSize.Width && CConfig.ScreenAlignment == _CurrentAlignment) if (_H == _Form.ClientSize.Height && _W == _Form.ClientSize.Width && CConfig.Config.Graphics.ScreenAlignment == _CurrentAlignment)
return; return;
_CurrentAlignment = CConfig.ScreenAlignment; _CurrentAlignment = CConfig.Config.Graphics.ScreenAlignment;
_H = _Form.ClientSize.Height; _H = _Form.ClientSize.Height;
_W = _Form.ClientSize.Width; _W = _Form.ClientSize.Width;
+10 -9
View File
@@ -321,7 +321,7 @@ namespace Vocaluxe.Lib.Draw
_Run = true; _Run = true;
_Fullscreen = false; _Fullscreen = false;
if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) if (CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON)
_EnterFullScreen(); _EnterFullScreen();
else else
_DoResize(); //Resize window if aspect ratio is incorrect _DoResize(); //Resize window if aspect ratio is incorrect
@@ -343,24 +343,25 @@ namespace Vocaluxe.Lib.Draw
_Run = false; _Run = false;
//Apply fullscreen mode //Apply fullscreen mode
if ((CConfig.FullScreen == EOffOn.TR_CONFIG_ON) != _Fullscreen) if ((CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) != _Fullscreen)
_ToggleFullScreen(); _ToggleFullScreen();
//Apply border changes //Apply border changes
if (_BorderLeft != CConfig.BorderLeft || _BorderRight != CConfig.BorderRight || _BorderTop != CConfig.BorderTop || _BorderBottom != CConfig.BorderBottom) if (_BorderLeft != CConfig.Config.Graphics.BorderLeft || _BorderRight != CConfig.Config.Graphics.BorderRight || _BorderTop != CConfig.Config.Graphics.BorderTop ||
_BorderBottom != CConfig.Config.Graphics.BorderBottom)
{ {
_BorderLeft = CConfig.BorderLeft; _BorderLeft = CConfig.Config.Graphics.BorderLeft;
_BorderRight = CConfig.BorderRight; _BorderRight = CConfig.Config.Graphics.BorderRight;
_BorderTop = CConfig.BorderTop; _BorderTop = CConfig.Config.Graphics.BorderTop;
_BorderBottom = CConfig.BorderBottom; _BorderBottom = CConfig.Config.Graphics.BorderBottom;
_AdjustNewBorders(); _AdjustNewBorders();
} }
if (_CurrentAlignment != CConfig.ScreenAlignment) if (_CurrentAlignment != CConfig.Config.Graphics.ScreenAlignment)
_DoResize(); _DoResize();
if (CConfig.VSync == EOffOn.TR_CONFIG_OFF) if (CConfig.Config.Graphics.VSync == EOffOn.TR_CONFIG_OFF)
{ {
if (CTime.IsRunning()) if (CTime.IsRunning())
{ {
+2 -2
View File
@@ -223,7 +223,7 @@ namespace Vocaluxe.Lib.Draw
int delay = 0; int delay = 0;
Show(); Show();
if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) if (CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON)
_Maximize(this); _Maximize(this);
while (_Run) while (_Run)
@@ -237,7 +237,7 @@ namespace Vocaluxe.Lib.Draw
_Run = CGraphics.UpdateGameLogic(_Keys, _Mouse); _Run = CGraphics.UpdateGameLogic(_Keys, _Mouse);
_FlipBuffer(); _FlipBuffer();
if ((CConfig.FullScreen == EOffOn.TR_CONFIG_ON) != _Fullscreen) if ((CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) != _Fullscreen)
_ToggleFullScreen(); _ToggleFullScreen();
if (CTime.IsRunning()) if (CTime.IsRunning())
+7 -6
View File
@@ -99,16 +99,16 @@ namespace Vocaluxe.Lib.Draw
public COpenGL() public COpenGL()
{ {
_Form = new CFormHook {ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH)}; _Form = new CFormHook {ClientSize = new Size(CConfig.Config.Graphics.ScreenW, CConfig.Config.Graphics.ScreenH)};
//OpenGL needs that here but D3D needs it in the constructor, so do NOT unify! //OpenGL needs that here but D3D needs it in the constructor, so do NOT unify!
//Check AA Mode //Check AA Mode
CConfig.AAMode = (EAntiAliasingModes)_CheckAntiAliasingMode((int)CConfig.AAMode); CConfig.Config.Graphics.AAMode = (EAntiAliasingModes)_CheckAntiAliasingMode((int)CConfig.Config.Graphics.AAMode);
bool ok = false; bool ok = false;
try try
{ {
var gm = new GraphicsMode(32, 24, 0, (int)CConfig.AAMode); var gm = new GraphicsMode(32, 24, 0, (int)CConfig.Config.Graphics.AAMode);
_Control = new GLControl(gm, 2, 1, GraphicsContextFlags.Default); _Control = new GLControl(gm, 2, 1, GraphicsContextFlags.Default);
if (_Control.GraphicsMode != null) if (_Control.GraphicsMode != null)
ok = true; ok = true;
@@ -122,7 +122,7 @@ namespace Vocaluxe.Lib.Draw
_Control = new GLControl(); _Control = new GLControl();
_Control.MakeCurrent(); _Control.MakeCurrent();
_Control.VSync = CConfig.VSync == EOffOn.TR_CONFIG_ON; _Control.VSync = CConfig.Config.Graphics.VSync == EOffOn.TR_CONFIG_ON;
_Form.Controls.Add(_Control); _Form.Controls.Add(_Control);
_Control.ClientSize = _Form.ClientSize; _Control.ClientSize = _Form.ClientSize;
@@ -212,7 +212,7 @@ namespace Vocaluxe.Lib.Draw
{ {
_H = _Control.Height; _H = _Control.Height;
_W = _Control.Width; _W = _Control.Width;
_CurrentAlignment = CConfig.ScreenAlignment; _CurrentAlignment = CConfig.Config.Graphics.ScreenAlignment;
_AdjustAspect(true); _AdjustAspect(true);
_AdjustNewBorders(); _AdjustNewBorders();
@@ -276,7 +276,8 @@ namespace Vocaluxe.Lib.Draw
{ {
GL.MatrixMode(MatrixMode.Projection); GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity(); GL.LoadIdentity();
GL.Ortho(-CConfig.BorderLeft, CConfig.BorderRight + CSettings.RenderW, CConfig.BorderBottom + CSettings.RenderH, -CConfig.BorderTop, CSettings.ZNear, CSettings.ZFar); GL.Ortho(-CConfig.Config.Graphics.BorderLeft, CConfig.Config.Graphics.BorderRight + CSettings.RenderW, CConfig.Config.Graphics.BorderBottom + CSettings.RenderH,
-CConfig.Config.Graphics.BorderTop, CSettings.ZNear, CSettings.ZFar);
} }
public void MakeScreenShot() public void MakeScreenShot()
+1 -1
View File
@@ -161,7 +161,7 @@ namespace Vocaluxe.Lib.Draw
/// <returns></returns> /// <returns></returns>
private static int _GetMaxTextureArea() private static int _GetMaxTextureArea()
{ {
switch (CConfig.TextureQuality) switch (CConfig.Config.Graphics.TextureQuality)
{ {
case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST: case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST:
return 128 * 128; return 128 * 128;
@@ -208,7 +208,7 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL
_Timer.Reset(); _Timer.Reset();
_Data = new CRingBuffer(_Bufsize); _Data = new CRingBuffer(_Bufsize);
_NoMoreData = false; _NoMoreData = false;
_SampleBuf = new byte[(int)CConfig.AudioBufferSize]; _SampleBuf = new byte[(int)CConfig.Config.Sound.AudioBufferSize];
//From now on closing the driver and the decoder is handled by the thread ONLY! //From now on closing the driver and the decoder is handled by the thread ONLY!
_DecoderThread = new Thread(_Execute) {Priority = ThreadPriority.Normal, Name = Path.GetFileName(_Medium)}; _DecoderThread = new Thread(_Execute) {Priority = ThreadPriority.Normal, Name = Path.GetFileName(_Medium)};
@@ -384,7 +384,7 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL
} }
} }
float latency = CConfig.AudioLatency / 1000f + queuedCount * _SampleBuf.Length / _BytesPerSecond + 0.1f; float latency = CConfig.Config.Sound.AudioLatency / 1000f + queuedCount * _SampleBuf.Length / _BytesPerSecond + 0.1f;
_CurrentTime = _TimeCode - _Data.BytesNotRead / _BytesPerSecond - latency; _CurrentTime = _TimeCode - _Data.BytesNotRead / _BytesPerSecond - latency;
_Timer.Restart(); _Timer.Restart();
} }
@@ -199,7 +199,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
out _Stream, out _Stream,
ref outputParams, ref outputParams,
format.SamplesPerSecond, format.SamplesPerSecond,
(uint)CConfig.AudioBufferSize / 2, (uint)CConfig.Config.Sound.AudioBufferSize / 2,
PortAudioSharp.PortAudio.PaStreamFlags.paNoFlag, PortAudioSharp.PortAudio.PaStreamFlags.paNoFlag,
_PaStreamCallback, _PaStreamCallback,
IntPtr.Zero) || _Stream == IntPtr.Zero) IntPtr.Zero) || _Stream == IntPtr.Zero)
@@ -208,7 +208,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
return false; return false;
} }
_Latency = CConfig.AudioLatency / 1000f + (float)PortAudioSharp.PortAudio.Pa_GetStreamInfo(_Stream).outputLatency; _Latency = CConfig.Config.Sound.AudioLatency / 1000f + (float)PortAudioSharp.PortAudio.Pa_GetStreamInfo(_Stream).outputLatency;
//From now on closing the driver and the decoder is handled by the thread ONLY! //From now on closing the driver and the decoder is handled by the thread ONLY!
@@ -58,21 +58,21 @@ namespace Vocaluxe.Screens
private bool _VideoBackground private bool _VideoBackground
{ {
get { return CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON; } get { return CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON; }
set set
{ {
if (!value) if (!value)
{ {
if (CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON) if (CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON)
{ {
CConfig.VideosToBackground = EOffOn.TR_CONFIG_OFF; CConfig.Config.Video.VideosToBackground = EOffOn.TR_CONFIG_OFF;
if (!_VideoPreviewInt) if (!_VideoPreviewInt)
CBackgroundMusic.VideoEnabled = false; CBackgroundMusic.VideoEnabled = false;
} }
} }
else else
{ {
CConfig.VideosToBackground = EOffOn.TR_CONFIG_ON; CConfig.Config.Video.VideosToBackground = EOffOn.TR_CONFIG_ON;
CBackgroundMusic.VideoEnabled = true; CBackgroundMusic.VideoEnabled = true;
} }
CConfig.SaveConfig(); CConfig.SaveConfig();
+6 -6
View File
@@ -105,7 +105,7 @@ namespace Vocaluxe.Screens
_CurrentIntroVideo = -1; _CurrentIntroVideo = -1;
_IntroOutPlayed = false; _IntroOutPlayed = false;
if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) if (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON)
{ {
for (int i = 0; i < _Intros.Length; i++) for (int i = 0; i < _Intros.Length; i++)
_Intros[i].Load(_IntroVideo[i]); _Intros[i].Load(_IntroVideo[i]);
@@ -117,7 +117,7 @@ namespace Vocaluxe.Screens
{ {
base.OnShowFinish(); base.OnShowFinish();
if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) if (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON)
{ {
foreach (CVideoPlayer videoPlayer in _Intros) foreach (CVideoPlayer videoPlayer in _Intros)
videoPlayer.PreLoad(); videoPlayer.PreLoad();
@@ -135,7 +135,7 @@ namespace Vocaluxe.Screens
{ {
_CheckStartIntroVideos(); _CheckStartIntroVideos();
bool next = CConfig.CoverLoading != ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART || CSongs.CoverLoaded; bool next = CConfig.Config.Theme.CoverLoading != ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART || CSongs.CoverLoaded;
if ((_IntroOutPlayed || _SkipIntro) && next && CSettings.ProgramState != EProgramState.EditTheme && CSongs.SongsLoaded) if ((_IntroOutPlayed || _SkipIntro) && next && CSettings.ProgramState != EProgramState.EditTheme && CSongs.SongsLoaded)
CSettings.ProgramState = EProgramState.Normal; CSettings.ProgramState = EProgramState.Normal;
@@ -152,7 +152,7 @@ namespace Vocaluxe.Screens
{ {
CBackgroundMusic.OwnSongsAvailable = true; CBackgroundMusic.OwnSongsAvailable = true;
if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON || CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON) if (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON || CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON)
CBackgroundMusic.VideoEnabled = true; CBackgroundMusic.VideoEnabled = true;
CBackgroundMusic.Play(); CBackgroundMusic.Play();
@@ -189,7 +189,7 @@ namespace Vocaluxe.Screens
if (_IntroOutPlayed) if (_IntroOutPlayed)
return; return;
if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_OFF) if (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_OFF)
{ {
_IntroOutPlayed = true; _IntroOutPlayed = true;
return; return;
@@ -200,7 +200,7 @@ namespace Vocaluxe.Screens
_CurrentIntroVideo = 0; _CurrentIntroVideo = 0;
_Intros[0].Start(); _Intros[0].Start();
} }
else if (_CurrentIntroVideo == 0 && _Intros[0].IsFinished && CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART) else if (_CurrentIntroVideo == 0 && _Intros[0].IsFinished && CConfig.Config.Theme.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART)
{ {
_Intros[_CurrentIntroVideo].Close(); _Intros[_CurrentIntroVideo].Close();
_CurrentIntroVideo = 1; _CurrentIntroVideo = 1;
+14 -14
View File
@@ -125,9 +125,9 @@ namespace Vocaluxe.Screens
switch (keyEvent.Key) switch (keyEvent.Key)
{ {
case Keys.Add: case Keys.Add:
if (CConfig.NumPlayers + 1 <= CSettings.MaxNumPlayer) if (CConfig.Config.Game.NumPlayers + 1 <= CSettings.MaxNumPlayer)
{ {
_SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayers; _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.Config.Game.NumPlayers;
_UpdatePlayerNumber(); _UpdatePlayerNumber();
//Update Tiles-List //Update Tiles-List
_NameSelections[_NameSelection].UpdateList(); _NameSelections[_NameSelection].UpdateList();
@@ -135,9 +135,9 @@ namespace Vocaluxe.Screens
break; break;
case Keys.Subtract: case Keys.Subtract:
if (CConfig.NumPlayers - 1 > 0) if (CConfig.Config.Game.NumPlayers - 1 > 0)
{ {
_SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayers - 2; _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.Config.Game.NumPlayers - 2;
_UpdatePlayerNumber(); _UpdatePlayerNumber();
//Update Tiles-List //Update Tiles-List
_NameSelections[_NameSelection].UpdateList(); _NameSelections[_NameSelection].UpdateList();
@@ -261,7 +261,7 @@ namespace Vocaluxe.Screens
_SelectingKeyboardActive = false; _SelectingKeyboardActive = false;
_NameSelections[_NameSelection].FastSelection(false, -1); _NameSelections[_NameSelection].FastSelection(false, -1);
} }
else if (numberPressed <= CConfig.NumPlayers) else if (numberPressed <= CConfig.Config.Game.NumPlayers)
{ {
_SelectingFastPlayerNr = numberPressed; _SelectingFastPlayerNr = numberPressed;
_NameSelections[_NameSelection].FastSelection(true, numberPressed); _NameSelections[_NameSelection].FastSelection(true, numberPressed);
@@ -324,7 +324,7 @@ namespace Vocaluxe.Screens
} }
if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= CConfig.NumPlayers) if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= CConfig.Config.Game.NumPlayers)
{ {
_SelectingKeyboardActive = true; _SelectingKeyboardActive = true;
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
@@ -488,7 +488,7 @@ namespace Vocaluxe.Screens
{ {
bool exit = true; bool exit = true;
//Remove profile-selection //Remove profile-selection
for (int i = 0; i < CConfig.NumPlayers; i++) for (int i = 0; i < CConfig.Config.Game.NumPlayers; i++)
{ {
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent)) if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
{ {
@@ -627,12 +627,12 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlidePlayerNumber].Clear(); _SelectSlides[_SelectSlidePlayerNumber].Clear();
for (int i = 1; i <= CSettings.MaxNumPlayer; i++) for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
_SelectSlides[_SelectSlidePlayerNumber].AddValue(CLanguage.Translate("TR_SCREENNAMES_" + i + "PLAYER")); _SelectSlides[_SelectSlidePlayerNumber].AddValue(CLanguage.Translate("TR_SCREENNAMES_" + i + "PLAYER"));
_SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayers - 1; _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.Config.Game.NumPlayers - 1;
} }
private void _UpdatePlayerNumber() private void _UpdatePlayerNumber()
{ {
CConfig.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1; CConfig.Config.Game.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
CGame.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1; CGame.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
for (int i = 1; i <= CSettings.MaxNumPlayer; i++) for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
{ {
@@ -668,7 +668,7 @@ namespace Vocaluxe.Screens
//Update Game-infos with new player //Update Game-infos with new player
CGame.Players[playerNum].ProfileID = profileId; CGame.Players[playerNum].ProfileID = profileId;
//Update config for default players. //Update config for default players.
CConfig.Players[playerNum] = CProfiles.GetProfileFileName(profileId); CConfig.Config.Game.Players[playerNum] = CProfiles.GetProfileFileName(profileId);
CConfig.SaveConfig(); CConfig.SaveConfig();
//Update texture and name //Update texture and name
_Statics[_StaticPlayerAvatar[playerNum]].Texture = CProfiles.GetAvatarTextureFromProfile(profileId); _Statics[_StaticPlayerAvatar[playerNum]].Texture = CProfiles.GetAvatarTextureFromProfile(profileId);
@@ -686,7 +686,7 @@ namespace Vocaluxe.Screens
_NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[i].ProfileID); _NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[i].ProfileID);
CGame.Players[i].ProfileID = -1; CGame.Players[i].ProfileID = -1;
//Update config for default players. //Update config for default players.
CConfig.Players[i] = String.Empty; CConfig.Config.Game.Players[i] = String.Empty;
//Update texture and name //Update texture and name
_Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i]; _Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i];
_Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(-1, i + 1); _Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(-1, i + 1);
@@ -700,7 +700,7 @@ namespace Vocaluxe.Screens
_NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[playerNum].ProfileID); _NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[playerNum].ProfileID);
CGame.Players[playerNum].ProfileID = -1; CGame.Players[playerNum].ProfileID = -1;
//Update config for default players. //Update config for default players.
CConfig.Players[playerNum] = String.Empty; CConfig.Config.Game.Players[playerNum] = String.Empty;
CConfig.SaveConfig(); CConfig.SaveConfig();
//Update texture and name //Update texture and name
_Statics[_StaticPlayerAvatar[playerNum]].Texture = _OriginalPlayerAvatarTextures[playerNum]; _Statics[_StaticPlayerAvatar[playerNum]].Texture = _OriginalPlayerAvatarTextures[playerNum];
@@ -714,7 +714,7 @@ namespace Vocaluxe.Screens
private void _CheckMics() private void _CheckMics()
{ {
var playerWithoutMicro = new List<int>(); var playerWithoutMicro = new List<int>();
for (int player = 0; player < CConfig.NumPlayers; player++) for (int player = 0; player < CConfig.Config.Game.NumPlayers; player++)
{ {
if (!CConfig.IsMicConfig(player + 1)) if (!CConfig.IsMicConfig(player + 1))
playerWithoutMicro.Add(player + 1); playerWithoutMicro.Add(player + 1);
@@ -752,7 +752,7 @@ namespace Vocaluxe.Screens
private void _CheckPlayers() private void _CheckPlayers()
{ {
var playerWithoutProfile = new List<int>(); var playerWithoutProfile = new List<int>();
for (int player = 0; player < CConfig.NumPlayers; player++) for (int player = 0; player < CConfig.Config.Game.NumPlayers; player++)
{ {
if (CGame.Players[player].ProfileID < 0) if (CGame.Players[player].ProfileID < 0)
playerWithoutProfile.Add(player + 1); playerWithoutProfile.Add(player + 1);
+13 -13
View File
@@ -55,11 +55,11 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideLanguage].AddValues(CLanguage.GetLanguageNames()); _SelectSlides[_SelectSlideLanguage].AddValues(CLanguage.GetLanguageNames());
_SelectSlides[_SelectSlideLanguage].Selection = CLanguage.LanguageId; _SelectSlides[_SelectSlideLanguage].Selection = CLanguage.LanguageId;
_SelectSlides[_SelectSlideDebugLevel].SetValues<EDebugLevel>((int)CConfig.DebugLevel); _SelectSlides[_SelectSlideDebugLevel].SetValues<EDebugLevel>((int)CConfig.Config.Debug.DebugLevel);
_SelectSlides[_SelectSlideSongMenu].SetValues<ESongMenu>((int)CConfig.SongMenu); _SelectSlides[_SelectSlideSongMenu].SetValues<ESongMenu>((int)CConfig.Config.Game.SongMenu);
_SelectSlides[_SelectSlideSongSorting].SetValues<ESongSorting>((int)CConfig.SongSorting); _SelectSlides[_SelectSlideSongSorting].SetValues<ESongSorting>((int)CConfig.Config.Game.SongSorting);
_SelectSlides[_SelectSlideTabs].SetValues<EOffOn>((int)CConfig.Tabs); _SelectSlides[_SelectSlideTabs].SetValues<EOffOn>((int)CConfig.Config.Game.Tabs);
_SelectSlides[_SelectSlideTimerMode].SetValues<ETimerMode>((int)CConfig.TimerMode); _SelectSlides[_SelectSlideTimerMode].SetValues<ETimerMode>((int)CConfig.Config.Game.TimerMode);
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -134,17 +134,17 @@ namespace Vocaluxe.Screens
private void _SaveConfig() private void _SaveConfig()
{ {
CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection; CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection;
CConfig.Language = CLanguage.GetLanguageName(CLanguage.LanguageId); CConfig.Config.Game.Language = CLanguage.GetLanguageName(CLanguage.LanguageId);
CConfig.DebugLevel = (EDebugLevel)_SelectSlides[_SelectSlideDebugLevel].Selection; CConfig.Config.Debug.DebugLevel = (EDebugLevel)_SelectSlides[_SelectSlideDebugLevel].Selection;
CConfig.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection; CConfig.Config.Game.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection;
CConfig.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection; CConfig.Config.Game.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection;
CConfig.Tabs = (EOffOn)_SelectSlides[_SelectSlideTabs].Selection; CConfig.Config.Game.Tabs = (EOffOn)_SelectSlides[_SelectSlideTabs].Selection;
CConfig.TimerMode = (ETimerMode)_SelectSlides[_SelectSlideTimerMode].Selection; CConfig.Config.Game.TimerMode = (ETimerMode)_SelectSlides[_SelectSlideTimerMode].Selection;
CConfig.SaveConfig(); CConfig.SaveConfig();
CSongs.Sorter.SongSorting = CConfig.SongSorting; CSongs.Sorter.SongSorting = CConfig.Config.Game.SongSorting;
CSongs.Categorizer.Tabs = CConfig.Tabs; CSongs.Categorizer.Tabs = CConfig.Config.Game.Tabs;
} }
} }
} }
+4 -4
View File
@@ -46,8 +46,8 @@ namespace Vocaluxe.Screens
public override void LoadTheme(string xmlPath) public override void LoadTheme(string xmlPath)
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
_SelectSlides[_SelectSlideLyricStyle].SetValues<ELyricStyle>((int)CConfig.LyricStyle); _SelectSlides[_SelectSlideLyricStyle].SetValues<ELyricStyle>((int)CConfig.Config.Theme.LyricStyle);
_SelectSlides[_SelectSlideLyricsPosition].SetValues<ELyricsPosition>((int)CConfig.LyricsPosition); _SelectSlides[_SelectSlideLyricsPosition].SetValues<ELyricsPosition>((int)CConfig.Config.Game.LyricsPosition);
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -115,8 +115,8 @@ namespace Vocaluxe.Screens
private void _SaveConfig() private void _SaveConfig()
{ {
CConfig.LyricsPosition = (ELyricsPosition)_SelectSlides[_SelectSlideLyricsPosition].Selection; CConfig.Config.Game.LyricsPosition = (ELyricsPosition)_SelectSlides[_SelectSlideLyricsPosition].Selection;
CConfig.LyricStyle = (ELyricStyle)_SelectSlides[_SelectSlideLyricStyle].Selection; CConfig.Config.Theme.LyricStyle = (ELyricStyle)_SelectSlides[_SelectSlideLyricStyle].Selection;
CConfig.SaveConfig(); CConfig.SaveConfig();
} }
} }
+12 -12
View File
@@ -292,7 +292,7 @@ namespace Vocaluxe.Screens
_DelayTest.Reset(); _DelayTest.Reset();
_SelectSlides[_SelectSlideDelay].Selection = CConfig.MicDelay / 20; _SelectSlides[_SelectSlideDelay].Selection = CConfig.Config.Record.MicDelay / 20;
} }
public override void OnShowFinish() public override void OnShowFinish()
@@ -341,7 +341,7 @@ namespace Vocaluxe.Screens
private void _SaveDelayConfig() private void _SaveDelayConfig()
{ {
CConfig.MicDelay = _SelectSlides[_SelectSlideDelay].Selection * 20; CConfig.Config.Record.MicDelay = _SelectSlides[_SelectSlideDelay].Selection * 20;
CConfig.SaveConfig(); CConfig.SaveConfig();
} }
@@ -356,22 +356,22 @@ namespace Vocaluxe.Screens
if (_CheckMicConfig()) if (_CheckMicConfig())
{ {
for (int p = 0; p < CSettings.MaxNumPlayer; p++) for (int p = 0; p < CSettings.MaxNumPlayer; p++)
CConfig.MicConfig[p].Channel = 0; CConfig.Config.Record.MicConfig[p].Channel = 0;
foreach (CRecordDevice device in _Devices) foreach (CRecordDevice device in _Devices)
{ {
if (device.PlayerChannel1 > 0) if (device.PlayerChannel1 > 0)
{ {
CConfig.MicConfig[device.PlayerChannel1 - 1].Channel = 1; CConfig.Config.Record.MicConfig[device.PlayerChannel1 - 1].Channel = 1;
CConfig.MicConfig[device.PlayerChannel1 - 1].DeviceName = device.Name; CConfig.Config.Record.MicConfig[device.PlayerChannel1 - 1].DeviceName = device.Name;
CConfig.MicConfig[device.PlayerChannel1 - 1].DeviceDriver = device.Driver; CConfig.Config.Record.MicConfig[device.PlayerChannel1 - 1].DeviceDriver = device.Driver;
} }
if (device.PlayerChannel2 > 0) if (device.PlayerChannel2 > 0)
{ {
CConfig.MicConfig[device.PlayerChannel2 - 1].Channel = 2; CConfig.Config.Record.MicConfig[device.PlayerChannel2 - 1].Channel = 2;
CConfig.MicConfig[device.PlayerChannel2 - 1].DeviceName = device.Name; CConfig.Config.Record.MicConfig[device.PlayerChannel2 - 1].DeviceName = device.Name;
CConfig.MicConfig[device.PlayerChannel2 - 1].DeviceDriver = device.Driver; CConfig.Config.Record.MicConfig[device.PlayerChannel2 - 1].DeviceDriver = device.Driver;
} }
} }
CConfig.SaveConfig(); CConfig.SaveConfig();
@@ -448,15 +448,15 @@ namespace Vocaluxe.Screens
if (_Devices == null) if (_Devices == null)
return; return;
if (CConfig.MicConfig == null) if (CConfig.Config.Record.MicConfig == null)
return; return;
if (CConfig.MicConfig[0].Channel <= 0) if (CConfig.Config.Record.MicConfig[0].Channel <= 0)
return; return;
for (int i = 0; i < _Devices.Count; i++) for (int i = 0; i < _Devices.Count; i++)
{ {
if (_Devices[i].Name == CConfig.MicConfig[0].DeviceName && _Devices[i].Driver == CConfig.MicConfig[0].DeviceDriver) if (_Devices[i].Name == CConfig.Config.Record.MicConfig[0].DeviceName && _Devices[i].Driver == CConfig.Config.Record.MicConfig[0].DeviceDriver)
{ {
device = i; device = i;
return; return;
+7 -7
View File
@@ -52,12 +52,12 @@ namespace Vocaluxe.Screens
public override void LoadTheme(string xmlPath) public override void LoadTheme(string xmlPath)
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
_SelectSlides[_SelectSlideBackgroundMusic].SetValues<EBackgroundMusicOffOn>((int)CConfig.BackgroundMusic); _SelectSlides[_SelectSlideBackgroundMusic].SetValues<EBackgroundMusicOffOn>((int)CConfig.Config.Sound.BackgroundMusic);
_SelectSlides[_SelectSlideBackgroundMusicVolume].AddValues(new string[] _SelectSlides[_SelectSlideBackgroundMusicVolume].AddValues(new string[]
{"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"});
_SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5;
_SelectSlides[_SelectSlideBackgroundMusicSource].SetValues<EBackgroundMusicSource>((int)CConfig.BackgroundMusicSource); _SelectSlides[_SelectSlideBackgroundMusicSource].SetValues<EBackgroundMusicSource>((int)CConfig.Config.Sound.BackgroundMusicSource);
_SelectSlides[_SelectSlideBackgroundMusicSource].Selection = (int)CConfig.BackgroundMusicSource; _SelectSlides[_SelectSlideBackgroundMusicSource].Selection = (int)CConfig.Config.Sound.BackgroundMusicSource;
_SelectSlides[_SelectSlidePreviewMusicVolume].AddValues(new string[] _SelectSlides[_SelectSlidePreviewMusicVolume].AddValues(new string[]
{"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"});
_SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; _SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5;
@@ -144,14 +144,14 @@ namespace Vocaluxe.Screens
{ {
CConfig.GameMusicVolume = _SelectSlides[_SelectSlideGameMusicVolume].Selection * 5; CConfig.GameMusicVolume = _SelectSlides[_SelectSlideGameMusicVolume].Selection * 5;
CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5; CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5;
CConfig.BackgroundMusic = (EBackgroundMusicOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection; CConfig.Config.Sound.BackgroundMusic = (EBackgroundMusicOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection;
CConfig.BackgroundMusicSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection; CConfig.Config.Sound.BackgroundMusicSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection;
CConfig.BackgroundMusicVolume = _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5; CConfig.BackgroundMusicVolume = _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5;
CConfig.SaveConfig(); CConfig.SaveConfig();
CBackgroundMusic.SetMusicSource(CConfig.BackgroundMusicSource); CBackgroundMusic.SetMusicSource(CConfig.Config.Sound.BackgroundMusicSource);
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
if (CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) if (CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
CBackgroundMusic.Play(); CBackgroundMusic.Play();
else else
CBackgroundMusic.Stop(); CBackgroundMusic.Stop();
+18 -18
View File
@@ -69,11 +69,11 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideCover].AddValues(CCover.CoverThemes); _SelectSlides[_SelectSlideCover].AddValues(CCover.CoverThemes);
_SelectSlides[_SelectSlideCover].Selection = CCover.GetCoverThemeIndex(); _SelectSlides[_SelectSlideCover].Selection = CCover.GetCoverThemeIndex();
_SelectSlides[_SelectSlideNoteLines].SetValues<EOffOn>((int)CConfig.DrawNoteLines); _SelectSlides[_SelectSlideNoteLines].SetValues<EOffOn>((int)CConfig.Config.Theme.DrawNoteLines);
_SelectSlides[_SelectSlideToneHelper].SetValues<EOffOn>((int)CConfig.DrawToneHelper); _SelectSlides[_SelectSlideToneHelper].SetValues<EOffOn>((int)CConfig.Config.Theme.DrawToneHelper);
_SelectSlides[_SelectSlideTimerLook].SetValues<ETimerLook>((int)CConfig.TimerLook); _SelectSlides[_SelectSlideTimerLook].SetValues<ETimerLook>((int)CConfig.Config.Theme.TimerLook);
_SelectSlides[_SelectSlideFadeInfo].SetValues<EFadePlayerInfo>((int)CConfig.FadePlayerInfo); _SelectSlides[_SelectSlideFadeInfo].SetValues<EFadePlayerInfo>((int)CConfig.Config.Theme.FadePlayerInfo);
_SelectSlides[_SelectSlideCoverLoading].SetValues<ECoverLoading>((int)CConfig.CoverLoading); _SelectSlides[_SelectSlideCoverLoading].SetValues<ECoverLoading>((int)CConfig.Config.Theme.CoverLoading);
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
@@ -135,18 +135,18 @@ namespace Vocaluxe.Screens
_ResetSlides(); _ResetSlides();
_OldCoverTheme = CConfig.CoverTheme; _OldCoverTheme = CConfig.Config.Theme.CoverTheme;
} }
private void _ResetSlides() private void _ResetSlides()
{ {
_SelectSlides[_SelectSlideTheme].Clear(); _SelectSlides[_SelectSlideTheme].Clear();
_SelectSlides[_SelectSlideTheme].AddValues(CThemes.ThemeNames); _SelectSlides[_SelectSlideTheme].AddValues(CThemes.ThemeNames);
_SelectSlides[_SelectSlideTheme].Selection = Array.IndexOf(CThemes.ThemeNames, CConfig.Theme); _SelectSlides[_SelectSlideTheme].Selection = Array.IndexOf(CThemes.ThemeNames, CConfig.Config.Theme.Theme);
_SelectSlides[_SelectSlideSkin].Clear(); _SelectSlides[_SelectSlideSkin].Clear();
_SelectSlides[_SelectSlideSkin].AddValues(CThemes.SkinNames); _SelectSlides[_SelectSlideSkin].AddValues(CThemes.SkinNames);
_SelectSlides[_SelectSlideSkin].Selection = Array.IndexOf(CThemes.SkinNames, CConfig.Skin); _SelectSlides[_SelectSlideSkin].Selection = Array.IndexOf(CThemes.SkinNames, CConfig.Config.Theme.Skin);
} }
public override bool UpdateGame() public override bool UpdateGame()
@@ -162,12 +162,12 @@ namespace Vocaluxe.Screens
private void _SaveConfig() private void _SaveConfig()
{ {
CConfig.CoverTheme = CCover.CoverThemes[_SelectSlides[_SelectSlideCover].Selection]; CConfig.Config.Theme.CoverTheme = CCover.CoverThemes[_SelectSlides[_SelectSlideCover].Selection];
CConfig.DrawNoteLines = (EOffOn)_SelectSlides[_SelectSlideNoteLines].Selection; CConfig.Config.Theme.DrawNoteLines = (EOffOn)_SelectSlides[_SelectSlideNoteLines].Selection;
CConfig.DrawToneHelper = (EOffOn)_SelectSlides[_SelectSlideToneHelper].Selection; CConfig.Config.Theme.DrawToneHelper = (EOffOn)_SelectSlides[_SelectSlideToneHelper].Selection;
CConfig.TimerLook = (ETimerLook)_SelectSlides[_SelectSlideTimerLook].Selection; CConfig.Config.Theme.TimerLook = (ETimerLook)_SelectSlides[_SelectSlideTimerLook].Selection;
CConfig.FadePlayerInfo = (EFadePlayerInfo)_SelectSlides[_SelectSlideFadeInfo].Selection; CConfig.Config.Theme.FadePlayerInfo = (EFadePlayerInfo)_SelectSlides[_SelectSlideFadeInfo].Selection;
CConfig.CoverLoading = (ECoverLoading)_SelectSlides[_SelectSlideCoverLoading].Selection; CConfig.Config.Theme.CoverLoading = (ECoverLoading)_SelectSlides[_SelectSlideCoverLoading].Selection;
CConfig.SaveConfig(); CConfig.SaveConfig();
@@ -177,9 +177,9 @@ namespace Vocaluxe.Screens
private void _OnChange() private void _OnChange()
{ {
if (CConfig.Theme != _SelectSlides[_SelectSlideTheme].Value) if (CConfig.Config.Theme.Theme != _SelectSlides[_SelectSlideTheme].Value)
{ {
CConfig.Theme = _SelectSlides[_SelectSlideTheme].Value; CConfig.Config.Theme.Theme = _SelectSlides[_SelectSlideTheme].Value;
CThemes.Reload(); CThemes.Reload();
CGraphics.ReloadTheme(); CGraphics.ReloadTheme();
@@ -188,9 +188,9 @@ namespace Vocaluxe.Screens
return; return;
} }
if (CConfig.Skin != _SelectSlides[_SelectSlideSkin].Value) if (CConfig.Config.Theme.Skin != _SelectSlides[_SelectSlideSkin].Value)
{ {
CConfig.Skin = _SelectSlides[_SelectSlideSkin].Value; CConfig.Config.Theme.Skin = _SelectSlides[_SelectSlideSkin].Value;
CThemes.ReloadSkin(); CThemes.ReloadSkin();
CGraphics.ReloadSkin(); CGraphics.ReloadSkin();
+16 -15
View File
@@ -71,10 +71,10 @@ namespace Vocaluxe.Screens
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
_SelectSlides[_SelectSlideVideoBackgrounds].SetValues<EOffOn>((int)CConfig.VideoBackgrounds); _SelectSlides[_SelectSlideVideoBackgrounds].SetValues<EOffOn>((int)CConfig.Config.Video.VideoBackgrounds);
_SelectSlides[_SelectSlideVideoPreview].SetValues<EOffOn>((int)CConfig.VideoPreview); _SelectSlides[_SelectSlideVideoPreview].SetValues<EOffOn>((int)CConfig.Config.Video.VideoPreview);
_SelectSlides[_SelectSlideVideosInSongs].SetValues<EOffOn>((int)CConfig.VideosInSongs); _SelectSlides[_SelectSlideVideosInSongs].SetValues<EOffOn>((int)CConfig.Config.Video.VideosInSongs);
_SelectSlides[_SelectSlideVideosToBackground].SetValues<EOffOn>((int)CConfig.VideosToBackground); _SelectSlides[_SelectSlideVideosToBackground].SetValues<EOffOn>((int)CConfig.Config.Video.VideosToBackground);
_Statics[_StaticWebcamOutput].Aspect = EAspect.Crop; _Statics[_StaticWebcamOutput].Aspect = EAspect.Crop;
} }
@@ -160,7 +160,7 @@ namespace Vocaluxe.Screens
{ {
if (CWebcam.GetFrame(ref _WebcamTexture)) if (CWebcam.GetFrame(ref _WebcamTexture))
_Statics[_StaticWebcamOutput].Texture = _WebcamTexture; _Statics[_StaticWebcamOutput].Texture = _WebcamTexture;
_SelectSlides[_SelectSlideVideosToBackground].Selection = (int)CConfig.VideosToBackground; _SelectSlides[_SelectSlideVideosToBackground].Selection = (int)CConfig.Config.Video.VideosToBackground;
return true; return true;
} }
@@ -216,13 +216,13 @@ namespace Vocaluxe.Screens
private void _SaveConfig() private void _SaveConfig()
{ {
CConfig.VideoBackgrounds = (EOffOn)_SelectSlides[_SelectSlideVideoBackgrounds].Selection; CConfig.Config.Video.VideoBackgrounds = (EOffOn)_SelectSlides[_SelectSlideVideoBackgrounds].Selection;
CConfig.VideoPreview = (EOffOn)_SelectSlides[_SelectSlideVideoPreview].Selection; CConfig.Config.Video.VideoPreview = (EOffOn)_SelectSlides[_SelectSlideVideoPreview].Selection;
CConfig.VideosInSongs = (EOffOn)_SelectSlides[_SelectSlideVideosInSongs].Selection; CConfig.Config.Video.VideosInSongs = (EOffOn)_SelectSlides[_SelectSlideVideosInSongs].Selection;
CConfig.VideosToBackground = (EOffOn)_SelectSlides[_SelectSlideVideosToBackground].Selection; CConfig.Config.Video.VideosToBackground = (EOffOn)_SelectSlides[_SelectSlideVideosToBackground].Selection;
CConfig.WebcamConfig = _Config; CConfig.Config.Video.WebcamConfig = _Config;
CBackgroundMusic.VideoEnabled = CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON; CBackgroundMusic.VideoEnabled = CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON;
CConfig.SaveConfig(); CConfig.SaveConfig();
} }
@@ -272,15 +272,16 @@ namespace Vocaluxe.Screens
capabilities = -1; capabilities = -1;
return false; return false;
} }
SWebcamConfig curConfig = CConfig.Config.Video.WebcamConfig.HasValue ? CConfig.Config.Video.WebcamConfig.Value : new SWebcamConfig();
for (int i = 0; i < devices.Length; i++) for (int i = 0; i < devices.Length; i++)
{ {
if (devices[i].MonikerString != CConfig.WebcamConfig.MonikerString) if (devices[i].MonikerString != curConfig.MonikerString)
continue; continue;
for (int j = 0; j < devices[i].Capabilities.Count; j++) for (int j = 0; j < devices[i].Capabilities.Count; j++)
{ {
if (devices[i].Capabilities[j].Framerate == CConfig.WebcamConfig.Framerate && devices[i].Capabilities[j].Width == CConfig.WebcamConfig.Width && if (devices[i].Capabilities[j].Framerate == curConfig.Framerate &&
devices[i].Capabilities[j].Height == CConfig.WebcamConfig.Height) devices[i].Capabilities[j].Width == curConfig.Width &&
devices[i].Capabilities[j].Height == curConfig.Height)
{ {
device = i; device = i;
capabilities = j; capabilities = j;
+3 -3
View File
@@ -157,9 +157,9 @@ namespace Vocaluxe.Screens
{ {
if (_StaticPointsBarDrawnPoints[p] < players[p].Points) if (_StaticPointsBarDrawnPoints[p] < players[p].Points)
{ {
if (CConfig.ScoreAnimationTime >= 1) if (CConfig.Config.Game.ScoreAnimationTime >= 1)
{ {
_StaticPointsBarDrawnPoints[p] = (_Timer.ElapsedMilliseconds / 1000f) / CConfig.ScoreAnimationTime * 10000; _StaticPointsBarDrawnPoints[p] = (_Timer.ElapsedMilliseconds / 1000f) / CConfig.Config.Game.ScoreAnimationTime * 10000;
if (_StaticPointsBarDrawnPoints[p] > players[p].Points) if (_StaticPointsBarDrawnPoints[p] > players[p].Points)
@@ -339,7 +339,7 @@ namespace Vocaluxe.Screens
_Statics[_StaticAvatar[p, CGame.NumPlayers - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID); _Statics[_StaticAvatar[p, CGame.NumPlayers - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID);
} }
if (CConfig.ScoreAnimationTime < 1) if (CConfig.Config.Game.ScoreAnimationTime < 1)
{ {
for (int p = 0; p < CGame.NumPlayers; p++) for (int p = 0; p < CGame.NumPlayers; p++)
{ {
+27 -26
View File
@@ -178,22 +178,22 @@ namespace Vocaluxe.Screens
break; break;
case Keys.T: case Keys.T:
var mode = (int)CConfig.TimerMode; var mode = (int)CConfig.Config.Game.TimerMode;
mode++; mode++;
if (mode > Enum.GetNames(typeof(ETimerMode)).Length - 1) if (mode > Enum.GetNames(typeof(ETimerMode)).Length - 1)
mode = 0; mode = 0;
CConfig.TimerMode = (ETimerMode)mode; CConfig.Config.Game.TimerMode = (ETimerMode)mode;
CConfig.SaveConfig(); CConfig.SaveConfig();
break; break;
case Keys.I: case Keys.I:
mode = (int)CConfig.PlayerInfo; mode = (int)CConfig.Config.Theme.PlayerInfo;
mode++; mode++;
if (mode > Enum.GetNames(typeof(EPlayerInfo)).Length - 1) if (mode > Enum.GetNames(typeof(EPlayerInfo)).Length - 1)
mode = 0; mode = 0;
CConfig.PlayerInfo = (EPlayerInfo)mode; CConfig.Config.Theme.PlayerInfo = (EPlayerInfo)mode;
CConfig.SaveConfig(); CConfig.SaveConfig();
_SetVisibility(); _SetVisibility();
if (CGame.GetSong() != null) if (CGame.GetSong() != null)
@@ -259,7 +259,7 @@ namespace Vocaluxe.Screens
CSong song = CGame.GetSong(); CSong song = CGame.GetSong();
song.VideoAspect = _VideoAspect; song.VideoAspect = _VideoAspect;
if (CConfig.SaveModifiedSongs == EOffOn.TR_CONFIG_ON) if (CConfig.Config.Debug.SaveModifiedSongs == EOffOn.TR_CONFIG_ON)
song.Save(); song.Save();
break; break;
} }
@@ -344,12 +344,13 @@ namespace Vocaluxe.Screens
for (int p = 0; p < CGame.NumPlayers; p++) for (int p = 0; p < CGame.NumPlayers; p++)
{ {
_SingNotes[_SingBars].PlayerNotes[p].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _SingNotes[_SingBars].PlayerNotes[p].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO || CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) if (CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO ||
CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
{ {
_Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Texts[_TextNames[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Texts[_TextNames[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
} }
if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) if (CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
{ {
_Statics[_StaticScores[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Statics[_StaticScores[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
@@ -381,7 +382,7 @@ namespace Vocaluxe.Screens
_Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = CGame.Players[p].Points.ToString(fmtString); _Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = CGame.Players[p].Points.ToString(fmtString);
} }
if (_CurrentVideo != null && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON) if (_CurrentVideo != null && !_FadeOut && CConfig.Config.Video.VideosInSongs == EOffOn.TR_CONFIG_ON)
CVideo.GetFrame(_CurrentVideo, _CurrentTime); CVideo.GetFrame(_CurrentVideo, _CurrentTime);
if (_Webcam) if (_Webcam)
@@ -411,7 +412,7 @@ namespace Vocaluxe.Screens
_SingNotes[_SingBars].Init(0); _SingNotes[_SingBars].Init(0);
foreach (CLyric lyric in _Lyrics) foreach (CLyric lyric in _Lyrics)
lyric.LyricStyle = CConfig.LyricStyle; lyric.LyricStyle = CConfig.Config.Theme.LyricStyle;
for (int p = 0; p < CGame.NumPlayers; p++) for (int p = 0; p < CGame.NumPlayers; p++)
_Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Aspect = EAspect.Crop; _Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Aspect = EAspect.Crop;
@@ -439,7 +440,7 @@ namespace Vocaluxe.Screens
{ {
CTextureRef background; CTextureRef background;
var aspect = EAspect.Crop; var aspect = EAspect.Crop;
if (_CurrentVideo != null && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam) if (_CurrentVideo != null && CConfig.Config.Video.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam)
{ {
background = _CurrentVideo.Texture; background = _CurrentVideo.Texture;
aspect = _VideoAspect; aspect = _VideoAspect;
@@ -463,7 +464,7 @@ namespace Vocaluxe.Screens
base.Draw(); base.Draw();
switch (CConfig.TimerLook) switch (CConfig.Config.Theme.TimerLook)
{ {
case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL:
CDraw.DrawTexture(_Statics[_StaticTimeLine].Texture, _Statics[_StaticTimeLine].Rect, new SColorF(1, 1, 1, 1), _TimeLineRect); CDraw.DrawTexture(_Statics[_StaticTimeLine].Texture, _Statics[_StaticTimeLine].Rect, new SColorF(1, 1, 1, 1), _TimeLineRect);
@@ -636,9 +637,9 @@ namespace Vocaluxe.Screens
} }
else else
{ {
bool lyricsOnTop = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP bool lyricsOnTop = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP
|| CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
|| (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop); || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop);
_Lyrics[_LyricMainTop].Visible = lyricsOnTop; _Lyrics[_LyricMainTop].Visible = lyricsOnTop;
_Lyrics[_LyricSubTop].Visible = lyricsOnTop; _Lyrics[_LyricSubTop].Visible = lyricsOnTop;
_Statics[_StaticLyricsTop].Visible = lyricsOnTop; _Statics[_StaticLyricsTop].Visible = lyricsOnTop;
@@ -647,9 +648,9 @@ namespace Vocaluxe.Screens
private void _SetNormalLyricsVisibility() private void _SetNormalLyricsVisibility()
{ {
bool visible = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM bool visible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM
|| CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
|| (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom); || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom);
_Lyrics[_LyricMain].Visible = visible; _Lyrics[_LyricMain].Visible = visible;
_Lyrics[_LyricSub].Visible = visible; _Lyrics[_LyricSub].Visible = visible;
_Statics[_StaticLyrics].Visible = visible; _Statics[_StaticLyrics].Visible = visible;
@@ -694,11 +695,11 @@ namespace Vocaluxe.Screens
if (firstNoteTime <= currentTime + 10f) if (firstNoteTime <= currentTime + 10f)
{ {
//First line has no predecessor or line has to be shown //First line has no predecessor or line has to be shown
if (j == 0 || firstNoteTime - CConfig.MinLineBreakTime <= currentTime) if (j == 0 || firstNoteTime - CConfig.Config.Game.MinLineBreakTime <= currentTime)
return j; return j;
float lastNoteTime = CGame.GetTimeFromBeats(lines[j - 1].LastNoteBeat, song.BPM); float lastNoteTime = CGame.GetTimeFromBeats(lines[j - 1].LastNoteBeat, song.BPM);
//No line break if last line is not fully evaluated (with 50% tolerance -> tested so notes are drawn) //No line break if last line is not fully evaluated (with 50% tolerance -> tested so notes are drawn)
if (lastNoteTime + CConfig.MicDelay / 1000f * 1.5f >= currentTime) if (lastNoteTime + CConfig.Config.Record.MicDelay / 1000f * 1.5f >= currentTime)
return j - 1; return j - 1;
return j; return j;
} }
@@ -880,12 +881,12 @@ namespace Vocaluxe.Screens
bool isIvisible = numplayer + 1 == CGame.NumPlayers && player <= CGame.NumPlayers; bool isIvisible = numplayer + 1 == CGame.NumPlayers && player <= CGame.NumPlayers;
_Texts[_TextScores[player, numplayer]].Visible = isIvisible; _Texts[_TextScores[player, numplayer]].Visible = isIvisible;
_Texts[_TextNames[player, numplayer]].Visible = isIvisible && _Texts[_TextNames[player, numplayer]].Visible = isIvisible &&
(CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH ||
CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME);
_Statics[_StaticScores[player, numplayer]].Visible = isIvisible; _Statics[_StaticScores[player, numplayer]].Visible = isIvisible;
_Statics[_StaticAvatars[player, numplayer]].Visible = isIvisible && _Statics[_StaticAvatars[player, numplayer]].Visible = isIvisible &&
(CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH ||
CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR);
} }
} }
@@ -1233,7 +1234,7 @@ namespace Vocaluxe.Screens
if (totalTime <= 0f) if (totalTime <= 0f)
return; return;
switch (CConfig.TimerMode) switch (CConfig.Config.Game.TimerMode)
{ {
case ETimerMode.TR_CONFIG_TIMERMODE_CURRENT: case ETimerMode.TR_CONFIG_TIMERMODE_CURRENT:
var min = (int)Math.Floor(currentTime / 60f); var min = (int)Math.Floor(currentTime / 60f);
@@ -1255,7 +1256,7 @@ namespace Vocaluxe.Screens
} }
switch (CConfig.TimerLook) switch (CConfig.Config.Theme.TimerLook)
{ {
case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL:
_TimeLineRect.W = _Statics[_StaticTimeLine].Rect.W * (currentTime / totalTime); _TimeLineRect.W = _Statics[_StaticTimeLine].Rect.W * (currentTime / totalTime);
@@ -1285,7 +1286,7 @@ namespace Vocaluxe.Screens
private void _PrepareTimeLine() private void _PrepareTimeLine()
{ {
CStatic stat = _Statics[_StaticTimeLine]; CStatic stat = _Statics[_StaticTimeLine];
switch (CConfig.TimerLook) switch (CConfig.Config.Theme.TimerLook)
{ {
case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL:
_TimeLineRect = stat.Rect; _TimeLineRect = stat.Rect;
+9 -9
View File
@@ -717,7 +717,7 @@ namespace Vocaluxe.Screens
_SongMenu.OnHide(); _SongMenu.OnHide();
if (CGraphics.NextScreen != EScreens.ScreenNames || CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF) if (CGraphics.NextScreen != EScreens.ScreenNames || CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
{ {
CBackgroundMusic.Disabled = false; CBackgroundMusic.Disabled = false;
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
@@ -1017,12 +1017,12 @@ namespace Vocaluxe.Screens
{ {
int start = 0; int start = 0;
int curSelected = CSongs.IsInCategory ? _SongMenu.GetSelectedSongNr() : _SongMenu.GetSelectedCategory(); int curSelected = CSongs.IsInCategory ? _SongMenu.GetSelectedSongNr() : _SongMenu.GetSelectedCategory();
bool firstLevel = CConfig.Tabs == EOffOn.TR_CONFIG_OFF && CSongs.IsInCategory; bool firstLevel = CConfig.Config.Game.Tabs == EOffOn.TR_CONFIG_OFF && CSongs.IsInCategory;
bool secondSort = CConfig.Tabs == EOffOn.TR_CONFIG_ON && bool secondSort = CConfig.Config.Game.Tabs == EOffOn.TR_CONFIG_ON &&
(CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST || (CConfig.Config.Game.SongSorting == ESongSorting.TR_CONFIG_ARTIST ||
CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || CConfig.Config.Game.SongSorting == ESongSorting.TR_CONFIG_ARTIST_LETTER ||
CConfig.SongSorting == ESongSorting.TR_CONFIG_FOLDER || CConfig.Config.Game.SongSorting == ESongSorting.TR_CONFIG_FOLDER ||
CConfig.SongSorting == ESongSorting.TR_CONFIG_TITLE_LETTER); CConfig.Config.Game.SongSorting == ESongSorting.TR_CONFIG_TITLE_LETTER);
if (firstLevel && !secondSort) if (firstLevel && !secondSort)
{ {
//TODO: What's to do with multiple tags? //TODO: What's to do with multiple tags?
@@ -1030,7 +1030,7 @@ namespace Vocaluxe.Screens
ReadOnlyCollection<CSong> songs = CSongs.VisibleSongs; ReadOnlyCollection<CSong> songs = CSongs.VisibleSongs;
int ct = songs.Count; int ct = songs.Count;
int visibleID = -1; int visibleID = -1;
switch (CConfig.SongSorting) switch (CConfig.Config.Game.SongSorting)
{ {
case ESongSorting.TR_CONFIG_ARTIST: case ESongSorting.TR_CONFIG_ARTIST:
case ESongSorting.TR_CONFIG_ARTIST_LETTER: case ESongSorting.TR_CONFIG_ARTIST_LETTER:
@@ -1066,7 +1066,7 @@ namespace Vocaluxe.Screens
ReadOnlyCollection<CSong> songs = CSongs.VisibleSongs; ReadOnlyCollection<CSong> songs = CSongs.VisibleSongs;
int ct = songs.Count; int ct = songs.Count;
int visibleID = -1; int visibleID = -1;
switch (CConfig.SongSorting) switch (CConfig.Config.Game.SongSorting)
{ {
case ESongSorting.TR_CONFIG_FOLDER: case ESongSorting.TR_CONFIG_FOLDER:
case ESongSorting.TR_CONFIG_TITLE_LETTER: case ESongSorting.TR_CONFIG_TITLE_LETTER: