Merge branch 'develop' into develop_fk

This commit is contained in:
Flamefire committed 2013-04-30 19:42:53 +02:00
commit 5a12cb48f9
31 files changed
+239 -449

No files matched your search

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<ScreenOptionsRecord> <ScreenOptionsRecord>
<ScreenVersion>2</ScreenVersion> <ScreenVersion>3</ScreenVersion>
<Background1> <Background1>
<!--<Type>: Background type: None, Color, Texture, Video--> <!--<Type>: Background type: None, Color, Texture, Video-->
<Type>Video</Type> <Type>Video</Type>
@@ -216,35 +216,6 @@
<!-- <Height>: Reflection Height--> <!-- <Height>: Reflection Height-->
</Text2> </Text2>
<Text3> <Text3>
<!--<X>, <Y>: Text position-->
<X>75</X>
<Y>165</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>32</H>
<!--<MaxW>: Maximum text width (if exists)-->
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Left</Align>
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_SCREENORECORD_INPUT</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text3>
<Text4>
<!--<X>, <Y>: Text position--> <!--<X>, <Y>: Text position-->
<X>75</X> <X>75</X>
<Y>225</Y> <Y>225</Y>
@@ -272,8 +243,8 @@
<!--<Reflection> If exists:--> <!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space--> <!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height--> <!-- <Height>: Reflection Height-->
</Text4> </Text3>
<Text5> <Text4>
<!--<X>, <Y>: Text position--> <!--<X>, <Y>: Text position-->
<X>75</X> <X>75</X>
<Y>285</Y> <Y>285</Y>
@@ -301,8 +272,8 @@
<!--<Reflection> If exists:--> <!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space--> <!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height--> <!-- <Height>: Reflection Height-->
</Text5> </Text4>
<Text6> <Text5>
<!--<X>, <Y>: Text position--> <!--<X>, <Y>: Text position-->
<X>75</X> <X>75</X>
<Y>345</Y> <Y>345</Y>
@@ -330,7 +301,7 @@
<!--<Reflection> If exists:--> <!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space--> <!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height--> <!-- <Height>: Reflection Height-->
</Text6> </Text5>
<TextWarning> <TextWarning>
<!--<X>, <Y>: Text position--> <!--<X>, <Y>: Text position-->
<X>640</X> <X>640</X>
@@ -600,73 +571,6 @@
<!--<NumVisible>: Number of visible elements in the slide--> <!--<NumVisible>: Number of visible elements in the slide-->
<NumVisible>1</NumVisible> <NumVisible>1</NumVisible>
</SelectSlideRecordDevices> </SelectSlideRecordDevices>
<SelectSlideRecordInputs>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
<!--<SkinArrowLeft>: Texture name of left arrow-->
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
<!--<SkinArrowRight>: Texture name of right arrow-->
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
<!--<SkinSelected>: Texture name for selected SelectSlide-->
<SkinSelected>SelectSlide</SkinSelected>
<!--<SkinArrowLeftSelected>: Texture name of selected left arrow-->
<SkinArrowLeftSelected>SelectSlideArrowLeft</SkinArrowLeftSelected>
<!--<SkinArrowRightSelected>: Texture name of selected right arrow-->
<SkinArrowRightSelected>SelectSlideArrowRight</SkinArrowRightSelected>
<!--<SkinHighlighted>: Texture name for highlighted SelectSlide-->
<SkinHighlighted>SelectSlide</SkinHighlighted>
<!--<X>, <Y>, <Z>, <W>, <H>: SelectSlide position, width and height-->
<X>500</X>
<Y>160</Y>
<Z>0,00</Z>
<W>700</W>
<H>50</H>
<!--<ArrowLeftX>, <ArrowLeftY>, <ArrowLeftZ>, <ArrowLeftW>, <ArrowLeftH>: Left arrow position, width and height-->
<ArrowLeftX>505</ArrowLeftX>
<ArrowLeftY>165</ArrowLeftY>
<ArrowLeftZ>0,00</ArrowLeftZ>
<ArrowLeftW>40</ArrowLeftW>
<ArrowLeftH>40</ArrowLeftH>
<!--<ArrowRightX>, <ArrowRightY>, <ArrowRightZ>, <ArrowRightW>, <ArrowRightH>: Right arrow position, width and height-->
<ArrowRightX>1170</ArrowRightX>
<ArrowRightY>165</ArrowRightY>
<ArrowRightZ>0,00</ArrowRightZ>
<ArrowRightW>40</ArrowRightW>
<ArrowRightH>40</ArrowRightH>
<!--<Color>: SelectSlide color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>SelectSlideColor</Color>
<!--<SColor>: Selected SelectSlide color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>SelectSlideSColor</SColor>
<!--<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)-->
<!--or <HR>, <HG>, <HB>, <HA> (lower priority)-->
<HColor>SelectSlideHColor</HColor>
<!--<ArrowColor>: Arrow color from ColorScheme (high priority)-->
<!--or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)-->
<ArrowColor>ArrowColor</ArrowColor>
<!--<ArrowSColor>: Selected arrow color from ColorScheme (high priority)-->
<!--or <ArrowSR>, <ArrowSG>, <ArrowSB>, <ArrowSA> (lower priority)-->
<ArrowSColor>ArrowSColor</ArrowSColor>
<!--<TextColor>: Text color from ColorScheme (high priority)-->
<!--or <TextR>, <TextG>, <TextB>, <TextA> (lower priority)-->
<TextColor>TextColor</TextColor>
<!--<TextSColor>: Selected text color from ColorScheme (high priority)-->
<!--or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)-->
<TextSColor>TextSColor</TextSColor>
<!--<TextH>: Text height-->
<TextH>32,00</TextH>
<!--<TextRelativeX>: Text relative x-position-->
<!--<TextRelativeY>: Text relative y-position-->
<!--<TextMaxW>: Maximum text width (if exists)-->
<TextMaxW>616,00</TextMaxW>
<!--<TextFont>: Text font name-->
<TextFont>Outline</TextFont>
<!--<TextStyle>: Text style: Normal, Italic, Bold, BoldItalic-->
<TextStyle>Bold</TextStyle>
<!--<NumVisible>: Number of visible elements in the slide-->
<NumVisible>1</NumVisible>
</SelectSlideRecordInputs>
<SelectSlideRecordChannel1> <SelectSlideRecordChannel1>
<!--<Skin>: Texture name--> <!--<Skin>: Texture name-->
<Skin>Invisible</Skin> <Skin>Invisible</Skin>
@@ -504,7 +504,9 @@ namespace VocaluxeLib.PartyModes.Challenge
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")"; _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]; int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
_RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName; _RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset) if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
_RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString(); _RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString();
else else
_RoundsTable[i].TextScores[p].Text = ""; _RoundsTable[i].TextScores[p].Text = "";
@@ -504,7 +504,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")"; _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]; int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
_RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName; _RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset) if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
_RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString(); _RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString();
else else
_RoundsTable[i].TextScores[p].Text = ""; _RoundsTable[i].TextScores[p].Text = "";
+35 -64
View File
@@ -19,6 +19,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -266,7 +267,6 @@ namespace Vocaluxe.Base
MicConfig[p - 1] = new SMicConfig(0); 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 + "/DeviceName", out MicConfig[p - 1].DeviceName, String.Empty);
xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceDriver", out MicConfig[p - 1].DeviceDriver, String.Empty); xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceDriver", out MicConfig[p - 1].DeviceDriver, String.Empty);
xmlReader.GetValue("//root/Record/MicConfig" + p + "/InputName", out MicConfig[p - 1].InputName, String.Empty);
xmlReader.TryGetIntValue("//root/Record/MicConfig" + p + "/Channel", ref MicConfig[p - 1].Channel); xmlReader.TryGetIntValue("//root/Record/MicConfig" + p + "/Channel", ref MicConfig[p - 1].Channel);
} }
@@ -514,13 +514,12 @@ namespace Vocaluxe.Base
for (int p = 1; p <= CSettings.MaxNumPlayer; p++) for (int p = 1; p <= CSettings.MaxNumPlayer; p++)
{ {
if (MicConfig[p - 1].DeviceName != "" && MicConfig[p - 1].InputName != "" && MicConfig[p - 1].Channel > 0) if (MicConfig[p - 1].DeviceName != "" && MicConfig[p - 1].Channel > 0)
{ {
writer.WriteStartElement("MicConfig" + p); writer.WriteStartElement("MicConfig" + p);
writer.WriteElementString("DeviceName", MicConfig[p - 1].DeviceName); writer.WriteElementString("DeviceName", MicConfig[p - 1].DeviceName);
writer.WriteElementString("DeviceDriver", MicConfig[p - 1].DeviceDriver); writer.WriteElementString("DeviceDriver", MicConfig[p - 1].DeviceDriver);
writer.WriteElementString("InputName", MicConfig[p - 1].InputName);
writer.WriteElementString("Channel", MicConfig[p - 1].Channel.ToString()); writer.WriteElementString("Channel", MicConfig[p - 1].Channel.ToString());
writer.WriteEndElement(); writer.WriteEndElement();
@@ -563,19 +562,11 @@ namespace Vocaluxe.Base
/// <returns></returns> /// <returns></returns>
public static bool IsMicConfig() public static bool IsMicConfig()
{ {
SRecordDevice[] devices = CSound.RecordGetDevices(); ReadOnlyCollection<CRecordDevice> devices = CSound.RecordGetDevices();
if (devices == null) if (devices == null)
return false; return false;
for (int dev = 0; dev < devices.Length; dev++) return devices.Any(t => t.PlayerChannel1 != 0 || t.PlayerChannel2 != 0);
{
for (int inp = 0; inp < devices[dev].Inputs.Count; inp++)
{
if (devices[dev].Inputs[inp].PlayerChannel1 != 0 || devices[dev].Inputs[inp].PlayerChannel2 != 0)
return true;
}
}
return false;
} }
/// <summary> /// <summary>
@@ -585,19 +576,11 @@ namespace Vocaluxe.Base
/// <returns></returns> /// <returns></returns>
public static bool IsMicConfig(int player) public static bool IsMicConfig(int player)
{ {
SRecordDevice[] devices = CSound.RecordGetDevices(); ReadOnlyCollection<CRecordDevice> devices = CSound.RecordGetDevices();
if (devices == null) if (devices == null)
return false; return false;
for (int dev = 0; dev < devices.Length; dev++) return devices.Any(t => t.PlayerChannel1 == player || t.PlayerChannel2 == player);
{
for (int inp = 0; inp < devices[dev].Inputs.Count; inp++)
{
if (devices[dev].Inputs[inp].PlayerChannel1 == player || devices[dev].Inputs[inp].PlayerChannel2 == player)
return true;
}
}
return false;
} }
public static int GetMaxNumMics() public static int GetMaxNumMics()
@@ -620,65 +603,53 @@ namespace Vocaluxe.Base
{ {
//Look for (usb-)mic //Look for (usb-)mic
//SRecordDevice[] Devices = new SRecordDevice[CSound.RecordGetDevices().Length]; //SRecordDevice[] Devices = new SRecordDevice[CSound.RecordGetDevices().Length];
SRecordDevice[] devices = CSound.RecordGetDevices(); ReadOnlyCollection<CRecordDevice> devices = CSound.RecordGetDevices();
if (devices == null) if (devices == null)
return false; return false;
for (int dev = 0; dev < devices.Length; dev++) foreach (CRecordDevice device in devices)
{ {
//Has Device some signal-names in name -> This could be a (usb-)mic //Has Device some signal-names in name -> This could be a (usb-)mic
if (Regex.IsMatch(devices[dev].Name, "Usb|Wireless", RegexOptions.IgnoreCase)) if (Regex.IsMatch(device.Name, "Usb|Wireless", RegexOptions.IgnoreCase))
{ {
//Check if there are inputs. //Check if there is one or more channels
if (devices[dev].Inputs.Count >= 1) if (device.Channels >= 2)
{ {
//Check if there is one or more channels //Set this device to player 1
if (devices[dev].Inputs[0].Channels >= 2) MicConfig[0].DeviceName = device.Name;
{ MicConfig[0].DeviceDriver = device.Driver;
//Set this device to player 1 MicConfig[0].Channel = 1;
MicConfig[0].DeviceName = devices[dev].Name; //Set this device to player 2
MicConfig[0].DeviceDriver = devices[dev].Driver; MicConfig[1].DeviceName = device.Name;
MicConfig[0].InputName = devices[dev].Inputs[0].Name; MicConfig[1].DeviceDriver = device.Driver;
MicConfig[0].Channel = 1; MicConfig[1].Channel = 2;
//Set this device to player 2
MicConfig[1].DeviceName = devices[dev].Name;
MicConfig[1].DeviceDriver = devices[dev].Driver;
MicConfig[1].InputName = devices[dev].Inputs[0].Name;
MicConfig[1].Channel = 2;
return true; return true;
}
} }
} }
} }
//If no usb-mics found -> Look for Devices with "mic" or "mik" //If no usb-mics found -> Look for Devices with "mic" or "mik"
for (int dev = 0; dev < devices.Length; dev++) foreach (CRecordDevice device in devices)
{ {
//Has Device some signal-names in name -> This could be a mic //Has Device some signal-names in name -> This could be a mic
if (Regex.IsMatch(devices[dev].Name, "Mic|Mik", RegexOptions.IgnoreCase)) if (Regex.IsMatch(device.Name, "Mic|Mik", RegexOptions.IgnoreCase))
{ {
//Check if there are inputs. //Check if there is one or more channels
if (devices[dev].Inputs.Count >= 1) if (device.Channels >= 1)
{ {
//Check if there is one or more channels //Set this device to player 1
if (devices[dev].Inputs[0].Channels >= 1) MicConfig[0].DeviceName = device.Name;
MicConfig[0].DeviceDriver = device.Driver;
MicConfig[0].Channel = 1;
if (device.Channels >= 2)
{ {
//Set this device to player 1 //Set this device to player 2
MicConfig[0].DeviceName = devices[dev].Name; MicConfig[1].DeviceName = device.Name;
MicConfig[0].DeviceDriver = devices[dev].Driver; MicConfig[1].DeviceDriver = device.Driver;
MicConfig[0].InputName = devices[dev].Inputs[0].Name; MicConfig[1].Channel = 2;
MicConfig[0].Channel = 1;
if (devices[dev].Inputs[0].Channels >= 2) return true;
{
//Set this device to player 2
MicConfig[1].DeviceName = devices[dev].Name;
MicConfig[1].DeviceDriver = devices[dev].Driver;
MicConfig[1].InputName = devices[dev].Inputs[0].Name;
MicConfig[1].Channel = 2;
return true;
}
} }
} }
} }
@@ -23,56 +23,56 @@ using VocaluxeLib.Menu;
namespace Vocaluxe.Base namespace Vocaluxe.Base
{ {
static class CInput static class CController
{ {
private static IInput _Input; private static IController _Controller;
public static void Init() public static void Init()
{ {
_Input = new CWiiMote(); _Controller = new CWiiMote();
_Input.Init(); _Controller.Init();
} }
public static void Close() public static void Close()
{ {
_Input.Close(); _Controller.Close();
_Input = null; _Controller = null;
} }
public static void Connect() public static void Connect()
{ {
_Input.Connect(); _Controller.Connect();
} }
public static void Disconnect() public static void Disconnect()
{ {
_Input.Disconnect(); _Controller.Disconnect();
} }
public static bool IsConnected() public static bool IsConnected()
{ {
return _Input.IsConnected(); return _Controller.IsConnected();
} }
public static void Update() public static void Update()
{ {
_Input.Update(); _Controller.Update();
} }
public static bool PollKeyEvent(ref SKeyEvent keyEvent) public static bool PollKeyEvent(ref SKeyEvent keyEvent)
{ {
return _Input.PollKeyEvent(ref keyEvent); return _Controller.PollKeyEvent(ref keyEvent);
} }
public static bool PollMouseEvent(ref SMouseEvent mouseEvent) public static bool PollMouseEvent(ref SMouseEvent mouseEvent)
{ {
return _Input.PollMouseEvent(ref mouseEvent); return _Controller.PollMouseEvent(ref mouseEvent);
} }
public static void SetRumble(float duration) public static void SetRumble(float duration)
{ {
_Input.SetRumble(duration); _Controller.SetRumble(duration);
} }
} }
} }
+5 -11
View File
@@ -708,17 +708,9 @@ namespace Vocaluxe.Base
} }
//This is a USDX 1.01 DB //This is a USDX 1.01 DB
if (!dateExists) command.CommandText = !dateExists
{ ? "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', '0', '0', '0', Difficulty from US_Scores"
command.CommandText = : "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores";
"INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', '0', '0', '0', Difficulty from US_Scores";
}
else
{
// This is a CMD 1.01 DB
command.CommandText =
"INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores";
}
command.ExecuteNonQuery(); command.ExecuteNonQuery();
command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs"; command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs";
@@ -763,7 +755,9 @@ namespace Vocaluxe.Base
stmt = new Sqlite3.Vdbe(); stmt = new Sqlite3.Vdbe();
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (!dateExists) if (!dateExists)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, PlayerName FROM Scores", -1, ref stmt, 0); res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, PlayerName FROM Scores", -1, ref stmt, 0);
else else
res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, PlayerName, Date FROM Scores", -1, ref stmt, 0); res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, PlayerName, Date FROM Scores", -1, ref stmt, 0);
+5 -5
View File
@@ -320,7 +320,7 @@ namespace Vocaluxe.Base
CVideo.Update(); CVideo.Update();
CSound.Update(); CSound.Update();
CBackgroundMusic.Update(); CBackgroundMusic.Update();
CInput.Update(); CController.Update();
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && _CurrentScreen != EScreens.ScreenSing) if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && _CurrentScreen != EScreens.ScreenSing)
CSongs.LoadCover(); CSongs.LoadCover();
@@ -512,7 +512,7 @@ namespace Vocaluxe.Base
bool resume = true; bool resume = true;
bool eventsAvailable; bool eventsAvailable;
bool inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent); bool inputEventsAvailable = CController.PollKeyEvent(ref inputKeyEvent);
while ((eventsAvailable = keys.PollEvent(ref keyEvent)) || inputEventsAvailable) while ((eventsAvailable = keys.PollEvent(ref keyEvent)) || inputEventsAvailable)
{ {
@@ -617,10 +617,10 @@ namespace Vocaluxe.Base
} }
if (!eventsAvailable) if (!eventsAvailable)
inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent); inputEventsAvailable = CController.PollKeyEvent(ref inputKeyEvent);
} }
inputEventsAvailable = CInput.PollMouseEvent(ref inputMouseEvent); inputEventsAvailable = CController.PollMouseEvent(ref inputMouseEvent);
while ((eventsAvailable = mouse.PollEvent(ref mouseEvent)) || inputEventsAvailable) while ((eventsAvailable = mouse.PollEvent(ref mouseEvent)) || inputEventsAvailable)
{ {
@@ -678,7 +678,7 @@ namespace Vocaluxe.Base
resume &= _Screens[(int)_CurrentScreen].HandleMouse(mouseEvent); resume &= _Screens[(int)_CurrentScreen].HandleMouse(mouseEvent);
if (!eventsAvailable) if (!eventsAvailable)
inputEventsAvailable = CInput.PollMouseEvent(ref inputMouseEvent); inputEventsAvailable = CController.PollMouseEvent(ref inputMouseEvent);
} }
return resume; return resume;
} }
+2 -6
View File
@@ -20,6 +20,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
@@ -168,12 +169,7 @@ namespace Vocaluxe.Base
List<string> files = new List<string>(); List<string> files = new List<string>();
files.AddRange(CHelper.ListFiles(path, "*.xml", true, true)); files.AddRange(CHelper.ListFiles(path, "*.xml", true, true));
foreach (string file in files) return files.All(file => _LoadPartyLanguageFile(partyModeID, file));
{
if (!_LoadPartyLanguageFile(partyModeID, file))
return false;
}
return true;
} }
private static bool _LoadLanguageEntries(CXMLReader xmlReader, out Dictionary<string, string> texts) private static bool _LoadLanguageEntries(CXMLReader xmlReader, out Dictionary<string, string> texts)
+4 -4
View File
@@ -46,13 +46,13 @@ namespace Vocaluxe.Base
private static readonly ISound _Sound = new CBsound(); private static readonly ISound _Sound = new CBsound();
private static readonly ICover _Cover = new CBcover(); private static readonly ICover _Cover = new CBcover();
private static readonly IDataBase _DataBase = new CBdataBase(); private static readonly IDataBase _DataBase = new CBdataBase();
private static readonly IInputs _Input = new CBinputs(); private static readonly IControllers _Controller = new CBcontrollers();
private static readonly IPlaylist _Playlist = new CBplaylist(); private static readonly IPlaylist _Playlist = new CBplaylist();
public static void Init() public static void Init()
{ {
CBase.Assign(_Config, _Settings, _Theme, _Log, _BackgroundMusic, _Draw, _Graphics, _Fonts, _Language, CBase.Assign(_Config, _Settings, _Theme, _Log, _BackgroundMusic, _Draw, _Graphics, _Fonts, _Language,
_Game, _Profiles, _Record, _Songs, _Video, _Sound, _Cover, _DataBase, _Input, _Playlist); _Game, _Profiles, _Record, _Songs, _Video, _Sound, _Cover, _DataBase, _Controller, _Playlist);
} }
} }
@@ -770,11 +770,11 @@ namespace Vocaluxe.Base
} }
} }
class CBinputs : IInputs class CBcontrollers : IControllers
{ {
public void SetRumble(float duration) public void SetRumble(float duration)
{ {
CInput.SetRumble(duration); CController.SetRumble(duration);
} }
} }
+15 -15
View File
@@ -67,17 +67,17 @@ namespace Vocaluxe.Base
{ {
CCategory lastCategory = null; CCategory lastCategory = null;
CCategory notLetterCat = null; CCategory notLetterCat = null;
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++) foreach (CSongPointer songPointer in CSongs.Sorter.SortedSongs)
{ {
Char firstLetter = Char.ToUpper(CSongs.Sorter.SortedSongs[i].SortString.Normalize(NormalizationForm.FormD)[0]); Char firstLetter = Char.ToUpper(songPointer.SortString.Normalize(NormalizationForm.FormD)[0]);
if (Char.IsLetter(firstLetter)) if (Char.IsLetter(firstLetter))
{ {
if (lastCategory == null || CSongs.Sorter.SortedSongs[i].SortString != lastCategory.Name) if (lastCategory == null || songPointer.SortString != lastCategory.Name)
{ {
lastCategory = new CCategory(CSongs.Sorter.SortedSongs[i].SortString); lastCategory = new CCategory(songPointer.SortString);
_Categories.Add(lastCategory); _Categories.Add(lastCategory);
} }
lastCategory.Songs.Add(CSongs.Sorter.SortedSongs[i]); lastCategory.Songs.Add(songPointer);
} }
else else
{ {
@@ -86,7 +86,7 @@ namespace Vocaluxe.Base
notLetterCat = new CCategory("#"); notLetterCat = new CCategory("#");
_Categories.Add(notLetterCat); _Categories.Add(notLetterCat);
} }
notLetterCat.Songs.Add(CSongs.Sorter.SortedSongs[i]); notLetterCat.Songs.Add(songPointer);
} }
} }
} }
@@ -95,16 +95,16 @@ namespace Vocaluxe.Base
{ {
CCategory lastCategory = null; CCategory lastCategory = null;
CCategory noCategory = null; CCategory noCategory = null;
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++) foreach (CSongPointer songPointer in CSongs.Sorter.SortedSongs)
{ {
if (CSongs.Sorter.SortedSongs[i].SortString != "") if (songPointer.SortString != "")
{ {
if (lastCategory == null || CSongs.Sorter.SortedSongs[i].SortString != lastCategory.Name) if (lastCategory == null || songPointer.SortString != lastCategory.Name)
{ {
lastCategory = new CCategory(CSongs.Sorter.SortedSongs[i].SortString); lastCategory = new CCategory(songPointer.SortString);
_Categories.Add(lastCategory); _Categories.Add(lastCategory);
} }
lastCategory.Songs.Add(CSongs.Sorter.SortedSongs[i]); lastCategory.Songs.Add(songPointer);
} }
else else
{ {
@@ -113,7 +113,7 @@ namespace Vocaluxe.Base
noCategory = new CCategory(noCategoryName); noCategory = new CCategory(noCategoryName);
_Categories.Add(noCategory); _Categories.Add(noCategory);
} }
noCategory.Songs.Add(CSongs.Sorter.SortedSongs[i]); noCategory.Songs.Add(songPointer);
} }
} }
} }
@@ -149,13 +149,13 @@ namespace Vocaluxe.Base
{ {
if (sorting == ESongSorting.TR_CONFIG_DECADE) if (sorting == ESongSorting.TR_CONFIG_DECADE)
{ {
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++) foreach (CSongPointer songPointer in CSongs.Sorter.SortedSongs)
{ {
string year = CSongs.Sorter.SortedSongs[i].SortString; string year = songPointer.SortString;
if (year != "") if (year != "")
{ {
year = year.Substring(0, 3); year = year.Substring(0, 3);
CSongs.Sorter.SortedSongs[i].SortString = year + "0 - " + year + "9"; songPointer.SortString = year + "0 - " + year + "9";
} }
} }
} }
+8 -17
View File
@@ -18,6 +18,7 @@
#endregion #endregion
using System; using System;
using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using Vocaluxe.Lib.Sound; using Vocaluxe.Lib.Sound;
@@ -226,9 +227,7 @@ namespace Vocaluxe.Base
public static bool RecordStart() public static bool RecordStart()
{ {
SRecordDevice[] devices = RecordGetDevices(); return _Record.Start();
return _Record.Start(devices);
} }
public static bool RecordStop() public static bool RecordStop()
@@ -276,23 +275,16 @@ namespace Vocaluxe.Base
return _Record.ToneWeigth(player); return _Record.ToneWeigth(player);
} }
public static SRecordDevice[] RecordGetDevices() public static ReadOnlyCollection<CRecordDevice> RecordGetDevices()
{ {
SRecordDevice[] devices = _Record.RecordDevices(); ReadOnlyCollection<CRecordDevice> devices = _Record.RecordDevices();
if (devices != null) if (devices != null)
{ {
for (int dev = 0; dev < devices.Length; dev++) foreach (CRecordDevice device in devices)
{ {
for (int inp = 0; inp < devices[dev].Inputs.Count; inp++) device.PlayerChannel1 = _GetPlayerFromMicConfig(device.Name, device.Driver, 1);
{ device.PlayerChannel2 = _GetPlayerFromMicConfig(device.Name, device.Driver, 2);
SInput input = devices[dev].Inputs[inp];
input.PlayerChannel1 = _GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 1);
input.PlayerChannel2 = _GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 2);
devices[dev].Inputs[inp] = input;
}
} }
return devices; return devices;
} }
@@ -300,14 +292,13 @@ namespace Vocaluxe.Base
return null; return null;
} }
private static int _GetPlayerFromMicConfig(string device, string devicedriver, string input, 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 < CSettings.MaxNumPlayer; p++)
{ {
if (CConfig.MicConfig[p].Channel != 0 && if (CConfig.MicConfig[p].Channel != 0 &&
CConfig.MicConfig[p].DeviceName == device && CConfig.MicConfig[p].DeviceName == device &&
CConfig.MicConfig[p].DeviceDriver == devicedriver && CConfig.MicConfig[p].DeviceDriver == devicedriver &&
CConfig.MicConfig[p].InputName == input &&
CConfig.MicConfig[p].Channel == channel) CConfig.MicConfig[p].Channel == channel)
return p + 1; return p + 1;
} }
-1
View File
@@ -20,7 +20,6 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text; using System.Drawing.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
-3
View File
@@ -17,10 +17,7 @@
// */ // */
#endregion #endregion
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vocaluxe.Base; using Vocaluxe.Base;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.Menu.SongMenu;
@@ -32,7 +32,7 @@ namespace Vocaluxe.Lib.Input
ScrollUp ScrollUp
} }
interface IInput interface IController
{ {
void Init(); void Init();
void Close(); void Close();
+1 -1
View File
@@ -27,7 +27,7 @@ using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Input.WiiMote namespace Vocaluxe.Lib.Input.WiiMote
{ {
class CWiiMote : IInput, IDisposable class CWiiMote : IController, IDisposable
{ {
private CWiiMoteLib _WiiMote; private CWiiMoteLib _WiiMote;
+25 -36
View File
@@ -17,6 +17,7 @@
// */ // */
#endregion #endregion
using System.Collections.ObjectModel;
using SlimDX.DirectSound; using SlimDX.DirectSound;
using SlimDX.Multimedia; using SlimDX.Multimedia;
using System; using System;
@@ -29,8 +30,7 @@ namespace Vocaluxe.Lib.Sound
class CDirectSoundRecord : IRecord class CDirectSoundRecord : IRecord
{ {
private bool _Initialized; private bool _Initialized;
private List<SRecordDevice> _Devices; private List<CRecordDevice> _Devices;
private SRecordDevice[] _DeviceConfig;
private List<CSoundCardSource> _Sources; private List<CSoundCardSource> _Sources;
private readonly CBuffer[] _Buffer; private readonly CBuffer[] _Buffer;
@@ -47,7 +47,7 @@ namespace Vocaluxe.Lib.Sound
public bool Init() public bool Init()
{ {
DeviceCollection devices = DirectSoundCapture.GetDevices(); DeviceCollection devices = DirectSoundCapture.GetDevices();
_Devices = new List<SRecordDevice>(); _Devices = new List<CRecordDevice>();
_Sources = new List<CSoundCardSource>(); _Sources = new List<CSoundCardSource>();
int id = 0; int id = 0;
@@ -55,21 +55,17 @@ namespace Vocaluxe.Lib.Sound
{ {
using (DirectSoundCapture ds = new DirectSoundCapture(dev.DriverGuid)) using (DirectSoundCapture ds = new DirectSoundCapture(dev.DriverGuid))
{ {
SRecordDevice device = new SRecordDevice {Driver = dev.DriverGuid.ToString(), ID = id, Name = dev.Description, Inputs = new List<SInput>()}; CRecordDevice device = new CRecordDevice {Driver = dev.DriverGuid.ToString(), ID = id, Name = dev.Description, Channels = ds.Capabilities.Channels};
SInput inp = new SInput {Name = "Default", Channels = ds.Capabilities.Channels}; if (device.Channels > 2)
device.Channels = 2; //more are not supported in vocaluxe
if (inp.Channels > 2)
inp.Channels = 2; //more are not supported in vocaluxe
device.Inputs.Add(inp);
_Devices.Add(device); _Devices.Add(device);
id++; id++;
} }
} }
_DeviceConfig = _Devices.ToArray();
_Initialized = true; _Initialized = true;
return true; return true;
@@ -85,7 +81,7 @@ namespace Vocaluxe.Lib.Sound
//System.IO.File.WriteAllBytes("test0.raw", _Buffer[0].Buffer); //System.IO.File.WriteAllBytes("test0.raw", _Buffer[0].Buffer);
} }
public bool Start(SRecordDevice[] deviceConfig) public bool Start()
{ {
if (!_Initialized) if (!_Initialized)
return false; return false;
@@ -93,21 +89,16 @@ namespace Vocaluxe.Lib.Sound
foreach (CBuffer buffer in _Buffer) foreach (CBuffer buffer in _Buffer)
buffer.Reset(); buffer.Reset();
_DeviceConfig = deviceConfig; bool[] active = new bool[_Devices.Count];
bool[] active = new bool[deviceConfig.Length]; Guid[] guid = new Guid[_Devices.Count];
Guid[] guid = new Guid[deviceConfig.Length]; short[] channels = new short[_Devices.Count];
short[] channels = new short[deviceConfig.Length]; for (int dev = 0; dev < _Devices.Count; dev++)
for (int dev = 0; dev < deviceConfig.Length; dev++)
{ {
active[dev] = false; active[dev] = false;
for (int inp = 0; inp < deviceConfig[dev].Inputs.Count; inp++) if (_Devices[dev].PlayerChannel1 > 0 || _Devices[dev].PlayerChannel2 > 0)
{ active[dev] = true;
if (deviceConfig[dev].Inputs[inp].PlayerChannel1 > 0 || guid[dev] = new Guid(_Devices[dev].Driver);
deviceConfig[dev].Inputs[inp].PlayerChannel2 > 0) channels[dev] = (short)_Devices[dev].Channels;
active[dev] = true;
guid[dev] = new Guid(deviceConfig[dev].Driver);
channels[dev] = (short)deviceConfig[dev].Inputs[0].Channels;
}
} }
for (int i = 0; i < _Devices.Count; i++) for (int i = 0; i < _Devices.Count; i++)
@@ -121,8 +112,6 @@ namespace Vocaluxe.Lib.Sound
_Sources.Add(source); _Sources.Add(source);
} }
} }
_DeviceConfig = deviceConfig;
return true; return true;
} }
@@ -189,7 +178,7 @@ namespace Vocaluxe.Lib.Sound
return _Buffer[player].ToneValid; return _Buffer[player].ToneValid;
} }
public SRecordDevice[] RecordDevices() public ReadOnlyCollection<CRecordDevice> RecordDevices()
{ {
if (!_Initialized) if (!_Initialized)
return null; return null;
@@ -197,7 +186,7 @@ namespace Vocaluxe.Lib.Sound
if (_Devices.Count == 0) if (_Devices.Count == 0)
return null; return null;
return _Devices.ToArray(); return _Devices.AsReadOnly();
} }
public int NumHalfTones(int player) public int NumHalfTones(int player)
@@ -232,21 +221,21 @@ namespace Vocaluxe.Lib.Sound
rightBuffer[i] = e.Data[i * 2 - (i % 2) + 2]; rightBuffer[i] = e.Data[i * 2 - (i % 2) + 2];
} }
for (int i = 0; i < _DeviceConfig.Length; i++) foreach (CRecordDevice device in _Devices)
{ {
if (_DeviceConfig[i].Driver == e.Guid.ToString()) if (device.Driver == e.Guid.ToString())
{ {
if (_DeviceConfig[i].Inputs[0].PlayerChannel1 > 0) if (device.PlayerChannel1 > 0)
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer); _Buffer[device.PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer);
if (_DeviceConfig[i].Inputs[0].PlayerChannel2 > 0) if (device.PlayerChannel2 > 0)
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer); _Buffer[device.PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer);
} }
} }
} }
} }
public class CSampleDataEventArgs : EventArgs private class CSampleDataEventArgs : EventArgs
{ {
public CSampleDataEventArgs(byte[] data, Guid guid) public CSampleDataEventArgs(byte[] data, Guid guid)
{ {
@@ -258,7 +247,7 @@ namespace Vocaluxe.Lib.Sound
public Guid Guid { get; private set; } public Guid Guid { get; private set; }
} }
public class CSoundCardSource : IDisposable private class CSoundCardSource : IDisposable
{ {
private volatile bool _Running; private volatile bool _Running;
private readonly int _BufferSize; private readonly int _BufferSize;
+23 -37
View File
@@ -17,6 +17,7 @@
// */ // */
#endregion #endregion
using System.Collections.ObjectModel;
using System.Threading; using System.Threading;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -29,8 +30,7 @@ namespace Vocaluxe.Lib.Sound
class CPortAudioRecord : IRecord class CPortAudioRecord : IRecord
{ {
private bool _Initialized; private bool _Initialized;
private List<SRecordDevice> _Devices; private List<CRecordDevice> _Devices;
private SRecordDevice[] _DeviceConfig;
private CPortAudio.PaStreamCallbackDelegate _MyRecProc; private CPortAudio.PaStreamCallbackDelegate _MyRecProc;
private IntPtr[] _RecHandle; private IntPtr[] _RecHandle;
@@ -39,7 +39,7 @@ namespace Vocaluxe.Lib.Sound
public CPortAudioRecord() public CPortAudioRecord()
{ {
_DeviceConfig = null; _Devices = null;
_Buffer = new CBuffer[CSettings.MaxNumPlayer]; _Buffer = new CBuffer[CSettings.MaxNumPlayer];
for (int i = 0; i < _Buffer.Length; i++) for (int i = 0; i < _Buffer.Length; i++)
@@ -54,7 +54,7 @@ namespace Vocaluxe.Lib.Sound
/// <returns>true if success</returns> /// <returns>true if success</returns>
public bool Init() public bool Init()
{ {
_Devices = new List<SRecordDevice>(); _Devices = new List<CRecordDevice>();
try try
{ {
@@ -73,22 +73,17 @@ namespace Vocaluxe.Lib.Sound
CPortAudio.SPaDeviceInfo info = CPortAudio.PaGetDeviceInfo(i); CPortAudio.SPaDeviceInfo info = CPortAudio.PaGetDeviceInfo(i);
if (info.HostApi == hostAPI && info.MaxInputChannels > 0) if (info.HostApi == hostAPI && info.MaxInputChannels > 0)
{ {
SRecordDevice dev = new SRecordDevice {ID = i, Name = info.Name, Driver = info.Name + i, Inputs = new List<SInput>()}; CRecordDevice dev = new CRecordDevice {ID = i, Name = info.Name, Driver = info.Name + i, Channels = info.MaxInputChannels};
SInput inp = new SInput {Name = "Default", Channels = info.MaxInputChannels}; if (dev.Channels > 2)
dev.Channels = 2; //more are not supported in vocaluxe
if (inp.Channels > 2)
inp.Channels = 2; //more are not supported in vocaluxe
dev.Inputs.Add(inp);
_Devices.Add(dev); _Devices.Add(dev);
} }
} }
_RecHandle = new IntPtr[_Devices.Count]; _RecHandle = new IntPtr[_Devices.Count];
_MyRecProc = MyPaStreamCallback; _MyRecProc = _MyPaStreamCallback;
_DeviceConfig = _Devices.ToArray();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -103,16 +98,12 @@ namespace Vocaluxe.Lib.Sound
/// <summary> /// <summary>
/// Start Voice Capturing /// Start Voice Capturing
/// </summary> /// </summary>
/// <param name="deviceConfig"></param>
/// <returns></returns> /// <returns></returns>
public bool Start(SRecordDevice[] deviceConfig) public bool Start()
{ {
if (!_Initialized) if (!_Initialized)
return false; return false;
if (deviceConfig == null)
return false;
if (_RecHandle == null || _RecHandle.Length == 0) if (_RecHandle == null || _RecHandle.Length == 0)
return false; return false;
@@ -132,17 +123,12 @@ namespace Vocaluxe.Lib.Sound
for (int i = 0; i < _RecHandle.Length; i++) for (int i = 0; i < _RecHandle.Length; i++)
_RecHandle[i] = IntPtr.Zero; _RecHandle[i] = IntPtr.Zero;
_DeviceConfig = deviceConfig; bool[] active = new bool[_Devices.Count];
bool[] active = new bool[deviceConfig.Length]; for (int dev = 0; dev < _Devices.Count; dev++)
for (int dev = 0; dev < deviceConfig.Length; dev++)
{ {
active[dev] = false; active[dev] = false;
for (int inp = 0; inp < deviceConfig[dev].Inputs.Count; inp++) if (_Devices[dev].PlayerChannel1 > 0 || _Devices[dev].PlayerChannel2 > 0)
{ active[dev] = true;
if (deviceConfig[dev].Inputs[inp].PlayerChannel1 > 0 ||
deviceConfig[dev].Inputs[inp].PlayerChannel2 > 0)
active[dev] = true;
}
} }
for (int i = 0; i < _RecHandle.Length; i++) for (int i = 0; i < _RecHandle.Length; i++)
@@ -151,10 +137,10 @@ namespace Vocaluxe.Lib.Sound
{ {
CPortAudio.SPaStreamParameters inputParams = new CPortAudio.SPaStreamParameters CPortAudio.SPaStreamParameters inputParams = new CPortAudio.SPaStreamParameters
{ {
ChannelCount = _DeviceConfig[i].Inputs[0].Channels, ChannelCount = _Devices[i].Channels,
Device = _DeviceConfig[i].ID, Device = _Devices[i].ID,
SampleFormat = CPortAudio.EPaSampleFormat.PaInt16, SampleFormat = CPortAudio.EPaSampleFormat.PaInt16,
SuggestedLatency = CPortAudio.PaGetDeviceInfo(_DeviceConfig[i].ID).DefaultLowInputLatency SuggestedLatency = CPortAudio.PaGetDeviceInfo(_Devices[i].ID).DefaultLowInputLatency
}; };
if (_ErrorCheck("OpenStream (rec)", CPortAudio.Pa_OpenStream( if (_ErrorCheck("OpenStream (rec)", CPortAudio.Pa_OpenStream(
@@ -273,7 +259,7 @@ namespace Vocaluxe.Lib.Sound
return _Buffer[player].ToneWeigth; return _Buffer[player].ToneWeigth;
} }
public SRecordDevice[] RecordDevices() public ReadOnlyCollection<CRecordDevice> RecordDevices()
{ {
if (!_Initialized) if (!_Initialized)
return null; return null;
@@ -281,10 +267,10 @@ namespace Vocaluxe.Lib.Sound
if (_Devices.Count == 0) if (_Devices.Count == 0)
return null; return null;
return _Devices.ToArray(); return _Devices.AsReadOnly();
} }
public CPortAudio.EPaStreamCallbackResult MyPaStreamCallback( private CPortAudio.EPaStreamCallbackResult _MyPaStreamCallback(
IntPtr input, IntPtr input,
IntPtr output, IntPtr output,
uint frameCount, uint frameCount,
@@ -315,11 +301,11 @@ namespace Vocaluxe.Lib.Sound
{ {
if (new IntPtr(i) == userData) if (new IntPtr(i) == userData)
{ {
if (_DeviceConfig[i].Inputs[0].PlayerChannel1 > 0) if (_Devices[i].PlayerChannel1 > 0)
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer); _Buffer[_Devices[i].PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer);
if (_DeviceConfig[i].Inputs[0].PlayerChannel2 > 0) if (_Devices[i].PlayerChannel2 > 0)
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer); _Buffer[_Devices[i].PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer);
break; break;
} }
+4 -12
View File
@@ -18,23 +18,17 @@
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.ObjectModel;
namespace Vocaluxe.Lib.Sound namespace Vocaluxe.Lib.Sound
{ {
struct SRecordDevice class CRecordDevice
{ {
public int ID; public int ID;
public string Name; public string Name;
public string Driver; public string Driver;
public List<SInput> Inputs;
}
struct SInput
{
public string Name;
public int Channels; public int Channels;
public int PlayerChannel1; public int PlayerChannel1;
public int PlayerChannel2; public int PlayerChannel2;
} }
@@ -43,7 +37,6 @@ namespace Vocaluxe.Lib.Sound
{ {
public string DeviceName; public string DeviceName;
public string DeviceDriver; public string DeviceDriver;
public string InputName;
public int Channel; public int Channel;
// ReSharper disable UnusedParameter.Local // ReSharper disable UnusedParameter.Local
@@ -52,7 +45,6 @@ namespace Vocaluxe.Lib.Sound
{ {
DeviceName = String.Empty; DeviceName = String.Empty;
DeviceDriver = String.Empty; DeviceDriver = String.Empty;
InputName = String.Empty;
Channel = 0; Channel = 0;
} }
} }
@@ -62,7 +54,7 @@ namespace Vocaluxe.Lib.Sound
bool Init(); bool Init();
void CloseAll(); void CloseAll();
bool Start(SRecordDevice[] deviceConfig); bool Start();
bool Stop(); bool Stop();
void AnalyzeBuffer(int player); void AnalyzeBuffer(int player);
@@ -74,6 +66,6 @@ namespace Vocaluxe.Lib.Sound
int NumHalfTones(int player); int NumHalfTones(int player);
float[] ToneWeigth(int player); float[] ToneWeigth(int player);
SRecordDevice[] RecordDevices(); ReadOnlyCollection<CRecordDevice> RecordDevices();
} }
} }
+3 -3
View File
@@ -185,8 +185,8 @@ namespace Vocaluxe
// Init Input // Init Input
CLog.StartBenchmark(0, "Init Input"); CLog.StartBenchmark(0, "Init Input");
CInput.Init(); CController.Init();
CInput.Connect(); CController.Connect();
CLog.StopBenchmark(0, "Init Input"); CLog.StopBenchmark(0, "Init Input");
// Init Game; // Init Game;
@@ -220,7 +220,7 @@ namespace Vocaluxe
try try
{ {
CLog.CloseAll(); CLog.CloseAll();
CInput.Close(); CController.Close();
CSound.RecordCloseAll(); CSound.RecordCloseAll();
CSound.CloseAllStreams(); CSound.CloseAllStreams();
CVideo.VdCloseAll(); CVideo.VdCloseAll();
+41 -90
View File
@@ -18,6 +18,7 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.Windows.Forms; using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
@@ -37,12 +38,11 @@ namespace Vocaluxe.Screens
// Version number for theme files. Increment it, if you've changed something on the theme files! // Version number for theme files. Increment it, if you've changed something on the theme files!
protected override int _ScreenVersion protected override int _ScreenVersion
{ {
get { return 2; } get { return 3; }
} }
private const float _MaxDelayTime = 1f; private const float _MaxDelayTime = 1f;
private const string _SelectSlideRecordDevices = "SelectSlideRecordDevices"; private const string _SelectSlideRecordDevices = "SelectSlideRecordDevices";
private const string _SelectSlideRecordInputs = "SelectSlideRecordInputs";
private const string _SelectSlideRecordChannel1 = "SelectSlideRecordChannel1"; private const string _SelectSlideRecordChannel1 = "SelectSlideRecordChannel1";
private const string _SelectSlideRecordChannel2 = "SelectSlideRecordChannel2"; private const string _SelectSlideRecordChannel2 = "SelectSlideRecordChannel2";
@@ -63,9 +63,8 @@ namespace Vocaluxe.Screens
private readonly string[] _StaticEnergyChannel = new string[] {"StaticEnergyChannel1", "StaticEnergyChannel2"}; private readonly string[] _StaticEnergyChannel = new string[] {"StaticEnergyChannel1", "StaticEnergyChannel2"};
private float[] _ChannelEnergy; private float[] _ChannelEnergy;
private SRecordDevice[] _Devices; private ReadOnlyCollection<CRecordDevice> _Devices;
private int _DeviceNr; private int _DeviceNr;
private int _InputNr;
private SDelayTest[] _DelayTest; private SDelayTest[] _DelayTest;
private bool _DelayTestRunning; private bool _DelayTestRunning;
@@ -81,7 +80,7 @@ namespace Vocaluxe.Screens
_ThemeTexts = new string[] {_TextWarning, _TextDelayChannel1, _TextDelayChannel2}; _ThemeTexts = new string[] {_TextWarning, _TextDelayChannel1, _TextDelayChannel2};
_ThemeButtons = new string[] {_ButtonExit, _ButtonDelayTest}; _ThemeButtons = new string[] {_ButtonExit, _ButtonDelayTest};
_ThemeSelectSlides = new string[] {_SelectSlideRecordDevices, _SelectSlideRecordInputs, _SelectSlideRecordChannel1, _SelectSlideRecordChannel2, _SelectSlideDelay}; _ThemeSelectSlides = new string[] {_SelectSlideRecordDevices, _SelectSlideRecordChannel1, _SelectSlideRecordChannel2, _SelectSlideDelay};
_ThemeEqualizers = new string[] {_EqualizerChannel1, _EqualizerChannel2}; _ThemeEqualizers = new string[] {_EqualizerChannel1, _EqualizerChannel2};
} }
@@ -160,9 +159,6 @@ namespace Vocaluxe.Screens
if (_SelectSlides[_SelectSlideRecordDevices].Selected) if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent(); _OnDeviceEvent();
if (_SelectSlides[_SelectSlideRecordInputs].Selected)
_OnInputEvent();
if (_SelectSlides[_SelectSlideRecordChannel1].Selected || if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
_SelectSlides[_SelectSlideRecordChannel2].Selected) _SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig(); _SetMicConfig();
@@ -175,9 +171,6 @@ namespace Vocaluxe.Screens
if (_SelectSlides[_SelectSlideRecordDevices].Selected) if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent(); _OnDeviceEvent();
if (_SelectSlides[_SelectSlideRecordInputs].Selected)
_OnInputEvent();
if (_SelectSlides[_SelectSlideRecordChannel1].Selected || if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
_SelectSlides[_SelectSlideRecordChannel2].Selected) _SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig(); _SetMicConfig();
@@ -205,9 +198,6 @@ namespace Vocaluxe.Screens
if (_SelectSlides[_SelectSlideRecordDevices].Selected) if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent(); _OnDeviceEvent();
if (_SelectSlides[_SelectSlideRecordInputs].Selected)
_OnInputEvent();
if (_SelectSlides[_SelectSlideRecordChannel1].Selected || if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
_SelectSlides[_SelectSlideRecordChannel2].Selected) _SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig(); _SetMicConfig();
@@ -311,28 +301,22 @@ namespace Vocaluxe.Screens
base.OnShow(); base.OnShow();
_SelectSlides[_SelectSlideRecordDevices].Clear(); _SelectSlides[_SelectSlideRecordDevices].Clear();
_SelectSlides[_SelectSlideRecordInputs].Clear();
for (int i = 0; i < _ChannelEnergy.Length; i++) for (int i = 0; i < _ChannelEnergy.Length; i++)
_ChannelEnergy[i] = 0f; _ChannelEnergy[i] = 0f;
_DeviceNr = -1; _DeviceNr = -1;
_InputNr = -1;
_Devices = CSound.RecordGetDevices(); _Devices = CSound.RecordGetDevices();
if (_Devices != null) if (_Devices != null)
{ {
_DeviceNr = 0; _DeviceNr = 0;
_InputNr = 0; _GetFirstConfiguredRecordDevice(ref _DeviceNr);
_GetFirstConfiguredRecordDevice(ref _DeviceNr, ref _InputNr);
for (int dev = 0; dev < _Devices.Length; dev++) foreach (CRecordDevice device in _Devices)
_SelectSlides[_SelectSlideRecordDevices].AddValue(_Devices[dev].Name); _SelectSlides[_SelectSlideRecordDevices].AddValue(device.Name);
_SelectSlides[_SelectSlideRecordDevices].Selection = _DeviceNr; _SelectSlides[_SelectSlideRecordDevices].Selection = _DeviceNr;
for (int inp = 0; inp < _Devices[0].Inputs.Count; inp++)
_SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[0].Inputs[inp].Name);
_SelectSlides[_SelectSlideRecordInputs].Selection = _InputNr;
_UpdateChannels(); _UpdateChannels();
} }
@@ -416,24 +400,7 @@ namespace Vocaluxe.Screens
{ {
if (_SelectSlides[_SelectSlideRecordDevices].Selection != _DeviceNr) if (_SelectSlides[_SelectSlideRecordDevices].Selection != _DeviceNr)
{ {
_SelectSlides[_SelectSlideRecordInputs].Clear();
_DeviceNr = _SelectSlides[_SelectSlideRecordDevices].Selection; _DeviceNr = _SelectSlides[_SelectSlideRecordDevices].Selection;
_InputNr = 0;
for (int inp = 0; inp < _Devices[_DeviceNr].Inputs.Count; inp++)
_SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[_DeviceNr].Inputs[inp].Name);
_InputNr = 0;
_SelectSlides[_SelectSlideRecordInputs].Selection = 0;
_UpdateChannels();
}
}
private void _OnInputEvent()
{
if (_SelectSlides[_SelectSlideRecordInputs].Selection != _InputNr)
{
_InputNr = _SelectSlides[_SelectSlideRecordInputs].Selection;
_UpdateChannels(); _UpdateChannels();
} }
} }
@@ -457,25 +424,20 @@ namespace Vocaluxe.Screens
for (int p = 0; p < CSettings.MaxNumPlayer; p++) for (int p = 0; p < CSettings.MaxNumPlayer; p++)
CConfig.MicConfig[p].Channel = 0; CConfig.MicConfig[p].Channel = 0;
for (int dev = 0; dev < _Devices.Length; dev++) foreach (CRecordDevice device in _Devices)
{ {
for (int inp = 0; inp < _Devices[dev].Inputs.Count; inp++) if (device.PlayerChannel1 > 0)
{ {
if (_Devices[dev].Inputs[inp].PlayerChannel1 > 0) CConfig.MicConfig[device.PlayerChannel1 - 1].Channel = 1;
{ CConfig.MicConfig[device.PlayerChannel1 - 1].DeviceName = device.Name;
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].Channel = 1; CConfig.MicConfig[device.PlayerChannel1 - 1].DeviceDriver = device.Driver;
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].DeviceName = _Devices[dev].Name; }
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].DeviceDriver = _Devices[dev].Driver;
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].InputName = _Devices[dev].Inputs[inp].Name;
}
if (_Devices[dev].Inputs[inp].PlayerChannel2 > 0) if (device.PlayerChannel2 > 0)
{ {
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].Channel = 2; CConfig.MicConfig[device.PlayerChannel2 - 1].Channel = 2;
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].DeviceName = _Devices[dev].Name; CConfig.MicConfig[device.PlayerChannel2 - 1].DeviceName = device.Name;
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].DeviceDriver = _Devices[dev].Driver; CConfig.MicConfig[device.PlayerChannel2 - 1].DeviceDriver = device.Driver;
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].InputName = _Devices[dev].Inputs[inp].Name;
}
} }
} }
CConfig.SaveConfig(); CConfig.SaveConfig();
@@ -487,16 +449,15 @@ namespace Vocaluxe.Screens
{ {
if (_DeviceNr < 0) if (_DeviceNr < 0)
return; return;
SInput input = _Devices[_DeviceNr].Inputs[_InputNr]; CRecordDevice device = _Devices[_DeviceNr];
input.PlayerChannel1 = _SelectSlides[_SelectSlideRecordChannel1].Selection; device.PlayerChannel1 = _SelectSlides[_SelectSlideRecordChannel1].Selection;
input.PlayerChannel2 = _SelectSlides[_SelectSlideRecordChannel2].Selection; device.PlayerChannel2 = _SelectSlides[_SelectSlideRecordChannel2].Selection;
_Devices[_DeviceNr].Inputs[_InputNr] = input;
} }
private void _UpdateChannels() private void _UpdateChannels()
{ {
_SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel1; _SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].PlayerChannel1;
_SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel2; _SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].PlayerChannel2;
_SaveMicConfig(); _SaveMicConfig();
} }
@@ -510,25 +471,22 @@ namespace Vocaluxe.Screens
if (_Devices == null) if (_Devices == null)
return true; return true;
for (int dev = 0; dev < _Devices.Length; dev++) foreach (CRecordDevice device in _Devices)
{ {
for (int inp = 0; inp < _Devices[dev].Inputs.Count; inp++) if (device.PlayerChannel1 > 0)
{ {
if (_Devices[dev].Inputs[inp].PlayerChannel1 > 0) if (isSet[device.PlayerChannel1 - 1])
{ return false;
if (isSet[_Devices[dev].Inputs[inp].PlayerChannel1 - 1])
return false;
isSet[_Devices[dev].Inputs[inp].PlayerChannel1 - 1] = true; isSet[device.PlayerChannel1 - 1] = true;
} }
if (_Devices[dev].Inputs[inp].PlayerChannel2 > 0) if (device.PlayerChannel2 > 0)
{ {
if (isSet[_Devices[dev].Inputs[inp].PlayerChannel2 - 1]) if (isSet[device.PlayerChannel2 - 1])
return false; return false;
isSet[_Devices[dev].Inputs[inp].PlayerChannel2 - 1] = true; isSet[device.PlayerChannel2 - 1] = true;
}
} }
} }
return true; return true;
@@ -545,7 +503,7 @@ namespace Vocaluxe.Screens
_DelayTestRunning = true; _DelayTestRunning = true;
} }
private void _GetFirstConfiguredRecordDevice(ref int device, ref int input) private void _GetFirstConfiguredRecordDevice(ref int device)
{ {
if (_Devices == null) if (_Devices == null)
return; return;
@@ -553,22 +511,15 @@ namespace Vocaluxe.Screens
if (CConfig.MicConfig == null) if (CConfig.MicConfig == null)
return; return;
for (int i = 0; i < _Devices.Length; i++) if (CConfig.MicConfig[0].Channel <= 0)
return;
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.MicConfig[0].DeviceName && _Devices[i].Driver == CConfig.MicConfig[0].DeviceDriver)
{ {
for (int j = 0; j < _Devices[i].Inputs.Count; j++) device = i;
{ return;
if (_Devices[i].Inputs[j].Name == CConfig.MicConfig[0].InputName)
{
if (CConfig.MicConfig[0].Channel > 0)
{
device = i;
input = j;
return;
}
}
}
} }
} }
} }
-1
View File
@@ -17,7 +17,6 @@
// */ // */
#endregion #endregion
using System;
using System.Windows.Forms; using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Base.Font; using Vocaluxe.Base.Font;
+12 -2
View File
@@ -177,6 +177,7 @@ namespace Vocaluxe.Screens
if (!_PartyModeInfos[index].Playable) if (!_PartyModeInfos[index].Playable)
{ {
_Buttons[_ButtonStart].Visible = false; _Buttons[_ButtonStart].Visible = false;
_Texts[_TextError].Text = "TR_SCREENPARTY_ERROR";
_Texts[_TextError].Visible = true; _Texts[_TextError].Visible = true;
} }
else else
@@ -193,10 +194,19 @@ namespace Vocaluxe.Screens
int index = _SelectSlides[_SelectSlideModes].Selection; int index = _SelectSlides[_SelectSlideModes].Selection;
if (index >= _PartyModeInfos.Count) if (index >= _PartyModeInfos.Count)
return; {
_Buttons[_ButtonStart].Visible = false;
_Texts[_TextError].Text = "TR_SCREENPARTY_ERROR";
_Texts[_TextError].Visible = true;
}
if (CConfig.GetMaxNumMics() == 0) if (CConfig.GetMaxNumMics() == 0)
return; //TODO: Add message! {
_Buttons[_ButtonStart].Visible = false;
_Texts[_TextError].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_PL").Replace("%v", "");
_Texts[_TextError].Visible = true;
return;
}
CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID); CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID);
CGraphics.FadeTo(EScreens.ScreenPartyDummy); CGraphics.FadeTo(EScreens.ScreenPartyDummy);
+2
View File
@@ -384,7 +384,9 @@ namespace Vocaluxe.Screens
for (int p = 0; p < CGame.NumPlayer; p++) for (int p = 0; p < CGame.NumPlayer; p++)
{ {
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (CGame.Players[p].Points < 10000) if (CGame.Players[p].Points < 10000)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Players[p].Points.ToString("0000"); _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Players[p].Points.ToString("0000");
else else
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Players[p].Points.ToString("00000"); _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Players[p].Points.ToString("00000");
+2
View File
@@ -1157,7 +1157,9 @@ namespace Vocaluxe.Screens
if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].NumValues > 0) if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].NumValues > 0)
_SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = true; _SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = true;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (_Buttons[_ButtonOptionsRandom].Visible) if (_Buttons[_ButtonOptionsRandom].Visible)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
_SetInteractionToButton(_Buttons[_ButtonOptionsRandom]); _SetInteractionToButton(_Buttons[_ButtonOptionsRandom]);
else else
_SetInteractionToButton(_Buttons[_ButtonOptionsRandomCategory]); _SetInteractionToButton(_Buttons[_ButtonOptionsRandomCategory]);
+2 -2
View File
@@ -178,7 +178,7 @@
<Compile Include="Base\CDraw.cs" /> <Compile Include="Base\CDraw.cs" />
<Compile Include="Base\Font\CFont.cs" /> <Compile Include="Base\Font\CFont.cs" />
<Compile Include="Base\CGame.cs" /> <Compile Include="Base\CGame.cs" />
<Compile Include="Base\CInput.cs" /> <Compile Include="Base\CController.cs" />
<Compile Include="Base\CLanguage.cs" /> <Compile Include="Base\CLanguage.cs" />
<Compile Include="Base\CLog.cs" /> <Compile Include="Base\CLog.cs" />
<Compile Include="Base\CMain.cs" /> <Compile Include="Base\CMain.cs" />
@@ -217,7 +217,7 @@
</Compile> </Compile>
<Compile Include="Lib\Draw\IDraw.cs" /> <Compile Include="Lib\Draw\IDraw.cs" />
<Compile Include="Lib\Input\CHIDAPI.cs" /> <Compile Include="Lib\Input\CHIDAPI.cs" />
<Compile Include="Lib\Input\IInput.cs" /> <Compile Include="Lib\Input\IController.cs" />
<Compile Include="Lib\Input\WiiMote\CWiiMote.cs" /> <Compile Include="Lib\Input\WiiMote\CWiiMote.cs" />
<Compile Include="Lib\Input\WiiMote\WiiMoteLib.cs" /> <Compile Include="Lib\Input\WiiMote\WiiMoteLib.cs" />
<Compile Include="Lib\Playlist\CPlaylistFile.cs" /> <Compile Include="Lib\Playlist\CPlaylistFile.cs" />
+3 -3
View File
@@ -38,12 +38,12 @@ namespace VocaluxeLib.Menu
public static ISound Sound; public static ISound Sound;
public static ICover Cover; public static ICover Cover;
public static IDataBase DataBase; public static IDataBase DataBase;
public static IInputs Input; public static IControllers Controller;
public static IPlaylist Playlist; public static IPlaylist Playlist;
public static void Assign(IConfig config, ISettings settings, ITheme theme, ILog log, IBackgroundMusic backgroundMusic, public static void Assign(IConfig config, ISettings settings, ITheme theme, ILog log, IBackgroundMusic backgroundMusic,
IDrawing draw, IGraphics graphics, IFonts fonts, ILanguage language, IGame game, IProfiles profiles, IRecording record, IDrawing draw, IGraphics graphics, IFonts fonts, ILanguage language, IGame game, IProfiles profiles, IRecording record,
ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IInputs input, IPlaylist playlist) ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IControllers controller, IPlaylist playlist)
{ {
Config = config; Config = config;
Settings = settings; Settings = settings;
@@ -62,7 +62,7 @@ namespace VocaluxeLib.Menu
Sound = sound; Sound = sound;
Cover = cover; Cover = cover;
DataBase = dataBase; DataBase = dataBase;
Input = input; Controller = controller;
Playlist = playlist; Playlist = playlist;
} }
} }
+2
View File
@@ -297,7 +297,9 @@ namespace VocaluxeLib.Menu
public void Draw() public void Draw()
{ {
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (_TextureName != "") if (_TextureName != "")
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
CBase.Drawing.DrawTexture(CBase.Theme.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); CBase.Drawing.DrawTexture(CBase.Theme.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
else else
CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
+12
View File
@@ -127,7 +127,9 @@ namespace VocaluxeLib.Menu
if (Math.Abs(_MaxWidth - value) > 0.01) if (Math.Abs(_MaxWidth - value) > 0.01)
{ {
_MaxWidth = value; _MaxWidth = value;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (_MaxWidth > 0) if (_MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), _MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), _MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else else
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
@@ -332,7 +334,9 @@ namespace VocaluxeLib.Menu
Selected = false; Selected = false;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0) if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else else
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
@@ -367,7 +371,9 @@ namespace VocaluxeLib.Menu
Selected = false; Selected = false;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0) if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else else
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
@@ -400,7 +406,9 @@ namespace VocaluxeLib.Menu
Selected = false; Selected = false;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0) if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else else
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
@@ -435,7 +443,9 @@ namespace VocaluxeLib.Menu
Selected = false; Selected = false;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0) if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else else
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
@@ -509,7 +519,9 @@ namespace VocaluxeLib.Menu
{ {
LoadTextures(); LoadTextures();
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0) if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else else
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f); Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
+1 -1
View File
@@ -302,7 +302,7 @@ namespace VocaluxeLib.Menu
bool GetCover(string fileName, ref STexture texture, int coverSize); bool GetCover(string fileName, ref STexture texture, int coverSize);
} }
public interface IInputs public interface IControllers
{ {
void SetRumble(float duration); void SetRumble(float duration);
} }
+2 -14
View File
@@ -348,13 +348,7 @@ namespace VocaluxeLib.Menu.SingNotes
public string Lyrics public string Lyrics
{ {
get get { return _Notes.Aggregate(String.Empty, (current, note) => current + note.Text); }
{
string lyrics = String.Empty;
foreach (CNote note in _Notes)
lyrics += note.Text;
return lyrics;
}
} }
public int NoteCount public int NoteCount
@@ -364,13 +358,7 @@ namespace VocaluxeLib.Menu.SingNotes
public int Points public int Points
{ {
get get { return _Notes.Sum(note => note.Points); }
{
int points = 0;
foreach (CNote note in _Notes)
points += note.Points;
return points;
}
} }
public CNote[] Notes public CNote[] Notes
@@ -347,7 +347,7 @@ namespace VocaluxeLib.Menu.SongMenu
sel = true; sel = true;
if (mouseEvent.Sender == ESender.WiiMote && _ActualSelection != lastselection && _ActualSelection != -1) if (mouseEvent.Sender == ESender.WiiMote && _ActualSelection != lastselection && _ActualSelection != -1)
CBase.Input.SetRumble(0.050f); CBase.Controller.SetRumble(0.050f);
if (!sel) if (!sel)
_ActualSelection = -1; _ActualSelection = -1;
@@ -392,7 +392,9 @@ namespace VocaluxeLib.Menu.SongMenu
tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop); tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop);
else else
{ {
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (tile.Texture.Index != _CoverTexture.Index) if (tile.Texture.Index != _CoverTexture.Index)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
tile.Draw(1f, tile.Rect.Z, EAspect.Crop); tile.Draw(1f, tile.Rect.Z, EAspect.Crop);
else else
tile.Draw(1f, tile.Rect.Z, EAspect.Stretch); tile.Draw(1f, tile.Rect.Z, EAspect.Stretch);
@@ -433,7 +435,9 @@ namespace VocaluxeLib.Menu.SongMenu
_Artist.Text = CBase.Songs.GetCategory(actcat).Name; _Artist.Text = CBase.Songs.GetCategory(actcat).Name;
int num = CBase.Songs.NumSongsInCategory(actcat); int num = CBase.Songs.NumSongsInCategory(actcat);
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (num != 1) if (num != 1)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString()); _Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString());
else else
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString()); _Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString());
@@ -623,10 +627,7 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
if (itemCount > i + offset) if (itemCount > i + offset)
{ {
if (isInCategory) _Tiles[i].Texture = isInCategory ? CBase.Songs.GetVisibleSong(i + offset).CoverTextureSmall : CBase.Songs.GetCategory(i + offset).CoverTextureSmall;
_Tiles[i].Texture = CBase.Songs.GetVisibleSong(i + offset).CoverTextureSmall;
else
_Tiles[i].Texture = CBase.Songs.GetCategory(i + offset).CoverTextureSmall;
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f); _Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
} }
else else