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"?>
<root>
<ScreenOptionsRecord>
<ScreenVersion>2</ScreenVersion>
<ScreenVersion>3</ScreenVersion>
<Background1>
<!--<Type>: Background type: None, Color, Texture, Video-->
<Type>Video</Type>
@@ -216,35 +216,6 @@
<!-- <Height>: Reflection Height-->
</Text2>
<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>75</X>
<Y>225</Y>
@@ -272,8 +243,8 @@
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text4>
<Text5>
</Text3>
<Text4>
<!--<X>, <Y>: Text position-->
<X>75</X>
<Y>285</Y>
@@ -301,8 +272,8 @@
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text5>
<Text6>
</Text4>
<Text5>
<!--<X>, <Y>: Text position-->
<X>75</X>
<Y>345</Y>
@@ -330,7 +301,7 @@
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text6>
</Text5>
<TextWarning>
<!--<X>, <Y>: Text position-->
<X>640</X>
@@ -600,73 +571,6 @@
<!--<NumVisible>: Number of visible elements in the slide-->
<NumVisible>1</NumVisible>
</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>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
@@ -504,7 +504,9 @@ namespace VocaluxeLib.PartyModes.Challenge
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
_RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
_RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString();
else
_RoundsTable[i].TextScores[p].Text = "";
@@ -504,7 +504,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
_RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
_RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString();
else
_RoundsTable[i].TextScores[p].Text = "";
+35 -64
View File
@@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
@@ -266,7 +267,6 @@ namespace Vocaluxe.Base
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.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);
}
@@ -514,13 +514,12 @@ namespace Vocaluxe.Base
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.WriteElementString("DeviceName", MicConfig[p - 1].DeviceName);
writer.WriteElementString("DeviceDriver", MicConfig[p - 1].DeviceDriver);
writer.WriteElementString("InputName", MicConfig[p - 1].InputName);
writer.WriteElementString("Channel", MicConfig[p - 1].Channel.ToString());
writer.WriteEndElement();
@@ -563,19 +562,11 @@ namespace Vocaluxe.Base
/// <returns></returns>
public static bool IsMicConfig()
{
SRecordDevice[] devices = CSound.RecordGetDevices();
ReadOnlyCollection<CRecordDevice> devices = CSound.RecordGetDevices();
if (devices == null)
return false;
for (int dev = 0; dev < devices.Length; dev++)
{
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;
return devices.Any(t => t.PlayerChannel1 != 0 || t.PlayerChannel2 != 0);
}
/// <summary>
@@ -585,19 +576,11 @@ namespace Vocaluxe.Base
/// <returns></returns>
public static bool IsMicConfig(int player)
{
SRecordDevice[] devices = CSound.RecordGetDevices();
ReadOnlyCollection<CRecordDevice> devices = CSound.RecordGetDevices();
if (devices == null)
return false;
for (int dev = 0; dev < devices.Length; dev++)
{
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;
return devices.Any(t => t.PlayerChannel1 == player || t.PlayerChannel2 == player);
}
public static int GetMaxNumMics()
@@ -620,65 +603,53 @@ namespace Vocaluxe.Base
{
//Look for (usb-)mic
//SRecordDevice[] Devices = new SRecordDevice[CSound.RecordGetDevices().Length];
SRecordDevice[] devices = CSound.RecordGetDevices();
ReadOnlyCollection<CRecordDevice> devices = CSound.RecordGetDevices();
if (devices == null)
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
if (Regex.IsMatch(devices[dev].Name, "Usb|Wireless", RegexOptions.IgnoreCase))
if (Regex.IsMatch(device.Name, "Usb|Wireless", RegexOptions.IgnoreCase))
{
//Check if there are inputs.
if (devices[dev].Inputs.Count >= 1)
//Check if there is one or more channels
if (device.Channels >= 2)
{
//Check if there is one or more channels
if (devices[dev].Inputs[0].Channels >= 2)
{
//Set this device to player 1
MicConfig[0].DeviceName = devices[dev].Name;
MicConfig[0].DeviceDriver = devices[dev].Driver;
MicConfig[0].InputName = devices[dev].Inputs[0].Name;
MicConfig[0].Channel = 1;
//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;
//Set this device to player 1
MicConfig[0].DeviceName = device.Name;
MicConfig[0].DeviceDriver = device.Driver;
MicConfig[0].Channel = 1;
//Set this device to player 2
MicConfig[1].DeviceName = device.Name;
MicConfig[1].DeviceDriver = device.Driver;
MicConfig[1].Channel = 2;
return true;
}
return true;
}
}
}
//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
if (Regex.IsMatch(devices[dev].Name, "Mic|Mik", RegexOptions.IgnoreCase))
if (Regex.IsMatch(device.Name, "Mic|Mik", RegexOptions.IgnoreCase))
{
//Check if there are inputs.
if (devices[dev].Inputs.Count >= 1)
//Check if there is one or more channels
if (device.Channels >= 1)
{
//Check if there is one or more channels
if (devices[dev].Inputs[0].Channels >= 1)
//Set this device to player 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
MicConfig[0].DeviceName = devices[dev].Name;
MicConfig[0].DeviceDriver = devices[dev].Driver;
MicConfig[0].InputName = devices[dev].Inputs[0].Name;
MicConfig[0].Channel = 1;
//Set this device to player 2
MicConfig[1].DeviceName = device.Name;
MicConfig[1].DeviceDriver = device.Driver;
MicConfig[1].Channel = 2;
if (devices[dev].Inputs[0].Channels >= 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;
}
}
}
@@ -23,56 +23,56 @@ using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
static class CInput
static class CController
{
private static IInput _Input;
private static IController _Controller;
public static void Init()
{
_Input = new CWiiMote();
_Controller = new CWiiMote();
_Input.Init();
_Controller.Init();
}
public static void Close()
{
_Input.Close();
_Input = null;
_Controller.Close();
_Controller = null;
}
public static void Connect()
{
_Input.Connect();
_Controller.Connect();
}
public static void Disconnect()
{
_Input.Disconnect();
_Controller.Disconnect();
}
public static bool IsConnected()
{
return _Input.IsConnected();
return _Controller.IsConnected();
}
public static void Update()
{
_Input.Update();
_Controller.Update();
}
public static bool PollKeyEvent(ref SKeyEvent keyEvent)
{
return _Input.PollKeyEvent(ref keyEvent);
return _Controller.PollKeyEvent(ref keyEvent);
}
public static bool PollMouseEvent(ref SMouseEvent mouseEvent)
{
return _Input.PollMouseEvent(ref mouseEvent);
return _Controller.PollMouseEvent(ref mouseEvent);
}
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
if (!dateExists)
{
command.CommandText =
"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.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"
: "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.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs";
@@ -763,7 +755,9 @@ namespace Vocaluxe.Base
stmt = new Sqlite3.Vdbe();
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (!dateExists)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, PlayerName FROM Scores", -1, ref stmt, 0);
else
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();
CSound.Update();
CBackgroundMusic.Update();
CInput.Update();
CController.Update();
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && _CurrentScreen != EScreens.ScreenSing)
CSongs.LoadCover();
@@ -512,7 +512,7 @@ namespace Vocaluxe.Base
bool resume = true;
bool eventsAvailable;
bool inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent);
bool inputEventsAvailable = CController.PollKeyEvent(ref inputKeyEvent);
while ((eventsAvailable = keys.PollEvent(ref keyEvent)) || inputEventsAvailable)
{
@@ -617,10 +617,10 @@ namespace Vocaluxe.Base
}
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)
{
@@ -678,7 +678,7 @@ namespace Vocaluxe.Base
resume &= _Screens[(int)_CurrentScreen].HandleMouse(mouseEvent);
if (!eventsAvailable)
inputEventsAvailable = CInput.PollMouseEvent(ref inputMouseEvent);
inputEventsAvailable = CController.PollMouseEvent(ref inputMouseEvent);
}
return resume;
}
+2 -6
View File
@@ -20,6 +20,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using VocaluxeLib.Menu;
@@ -168,12 +169,7 @@ namespace Vocaluxe.Base
List<string> files = new List<string>();
files.AddRange(CHelper.ListFiles(path, "*.xml", true, true));
foreach (string file in files)
{
if (!_LoadPartyLanguageFile(partyModeID, file))
return false;
}
return true;
return files.All(file => _LoadPartyLanguageFile(partyModeID, file));
}
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 ICover _Cover = new CBcover();
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();
public static void Init()
{
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)
{
CInput.SetRumble(duration);
CController.SetRumble(duration);
}
}
+15 -15
View File
@@ -67,17 +67,17 @@ namespace Vocaluxe.Base
{
CCategory lastCategory = 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 (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);
}
lastCategory.Songs.Add(CSongs.Sorter.SortedSongs[i]);
lastCategory.Songs.Add(songPointer);
}
else
{
@@ -86,7 +86,7 @@ namespace Vocaluxe.Base
notLetterCat = new CCategory("#");
_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 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);
}
lastCategory.Songs.Add(CSongs.Sorter.SortedSongs[i]);
lastCategory.Songs.Add(songPointer);
}
else
{
@@ -113,7 +113,7 @@ namespace Vocaluxe.Base
noCategory = new CCategory(noCategoryName);
_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)
{
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 != "")
{
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
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using Vocaluxe.Lib.Sound;
@@ -226,9 +227,7 @@ namespace Vocaluxe.Base
public static bool RecordStart()
{
SRecordDevice[] devices = RecordGetDevices();
return _Record.Start(devices);
return _Record.Start();
}
public static bool RecordStop()
@@ -276,23 +275,16 @@ namespace Vocaluxe.Base
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)
{
for (int dev = 0; dev < devices.Length; dev++)
foreach (CRecordDevice device in devices)
{
for (int inp = 0; inp < devices[dev].Inputs.Count; inp++)
{
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;
}
device.PlayerChannel1 = _GetPlayerFromMicConfig(device.Name, device.Driver, 1);
device.PlayerChannel2 = _GetPlayerFromMicConfig(device.Name, device.Driver, 2);
}
return devices;
}
@@ -300,14 +292,13 @@ namespace Vocaluxe.Base
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++)
{
if (CConfig.MicConfig[p].Channel != 0 &&
CConfig.MicConfig[p].DeviceName == device &&
CConfig.MicConfig[p].DeviceDriver == devicedriver &&
CConfig.MicConfig[p].InputName == input &&
CConfig.MicConfig[p].Channel == channel)
return p + 1;
}
-1
View File
@@ -20,7 +20,6 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Windows.Forms;
using VocaluxeLib.Menu;
-3
View File
@@ -17,10 +17,7 @@
// */
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vocaluxe.Base;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
@@ -32,7 +32,7 @@ namespace Vocaluxe.Lib.Input
ScrollUp
}
interface IInput
interface IController
{
void Init();
void Close();
+1 -1
View File
@@ -27,7 +27,7 @@ using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Input.WiiMote
{
class CWiiMote : IInput, IDisposable
class CWiiMote : IController, IDisposable
{
private CWiiMoteLib _WiiMote;
+25 -36
View File
@@ -17,6 +17,7 @@
// */
#endregion
using System.Collections.ObjectModel;
using SlimDX.DirectSound;
using SlimDX.Multimedia;
using System;
@@ -29,8 +30,7 @@ namespace Vocaluxe.Lib.Sound
class CDirectSoundRecord : IRecord
{
private bool _Initialized;
private List<SRecordDevice> _Devices;
private SRecordDevice[] _DeviceConfig;
private List<CRecordDevice> _Devices;
private List<CSoundCardSource> _Sources;
private readonly CBuffer[] _Buffer;
@@ -47,7 +47,7 @@ namespace Vocaluxe.Lib.Sound
public bool Init()
{
DeviceCollection devices = DirectSoundCapture.GetDevices();
_Devices = new List<SRecordDevice>();
_Devices = new List<CRecordDevice>();
_Sources = new List<CSoundCardSource>();
int id = 0;
@@ -55,21 +55,17 @@ namespace Vocaluxe.Lib.Sound
{
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);
id++;
}
}
_DeviceConfig = _Devices.ToArray();
_Initialized = true;
return true;
@@ -85,7 +81,7 @@ namespace Vocaluxe.Lib.Sound
//System.IO.File.WriteAllBytes("test0.raw", _Buffer[0].Buffer);
}
public bool Start(SRecordDevice[] deviceConfig)
public bool Start()
{
if (!_Initialized)
return false;
@@ -93,21 +89,16 @@ namespace Vocaluxe.Lib.Sound
foreach (CBuffer buffer in _Buffer)
buffer.Reset();
_DeviceConfig = deviceConfig;
bool[] active = new bool[deviceConfig.Length];
Guid[] guid = new Guid[deviceConfig.Length];
short[] channels = new short[deviceConfig.Length];
for (int dev = 0; dev < deviceConfig.Length; dev++)
bool[] active = new bool[_Devices.Count];
Guid[] guid = new Guid[_Devices.Count];
short[] channels = new short[_Devices.Count];
for (int dev = 0; dev < _Devices.Count; dev++)
{
active[dev] = false;
for (int inp = 0; inp < deviceConfig[dev].Inputs.Count; inp++)
{
if (deviceConfig[dev].Inputs[inp].PlayerChannel1 > 0 ||
deviceConfig[dev].Inputs[inp].PlayerChannel2 > 0)
active[dev] = true;
guid[dev] = new Guid(deviceConfig[dev].Driver);
channels[dev] = (short)deviceConfig[dev].Inputs[0].Channels;
}
if (_Devices[dev].PlayerChannel1 > 0 || _Devices[dev].PlayerChannel2 > 0)
active[dev] = true;
guid[dev] = new Guid(_Devices[dev].Driver);
channels[dev] = (short)_Devices[dev].Channels;
}
for (int i = 0; i < _Devices.Count; i++)
@@ -121,8 +112,6 @@ namespace Vocaluxe.Lib.Sound
_Sources.Add(source);
}
}
_DeviceConfig = deviceConfig;
return true;
}
@@ -189,7 +178,7 @@ namespace Vocaluxe.Lib.Sound
return _Buffer[player].ToneValid;
}
public SRecordDevice[] RecordDevices()
public ReadOnlyCollection<CRecordDevice> RecordDevices()
{
if (!_Initialized)
return null;
@@ -197,7 +186,7 @@ namespace Vocaluxe.Lib.Sound
if (_Devices.Count == 0)
return null;
return _Devices.ToArray();
return _Devices.AsReadOnly();
}
public int NumHalfTones(int player)
@@ -232,21 +221,21 @@ namespace Vocaluxe.Lib.Sound
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)
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer);
if (device.PlayerChannel1 > 0)
_Buffer[device.PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer);
if (_DeviceConfig[i].Inputs[0].PlayerChannel2 > 0)
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer);
if (device.PlayerChannel2 > 0)
_Buffer[device.PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer);
}
}
}
}
public class CSampleDataEventArgs : EventArgs
private class CSampleDataEventArgs : EventArgs
{
public CSampleDataEventArgs(byte[] data, Guid guid)
{
@@ -258,7 +247,7 @@ namespace Vocaluxe.Lib.Sound
public Guid Guid { get; private set; }
}
public class CSoundCardSource : IDisposable
private class CSoundCardSource : IDisposable
{
private volatile bool _Running;
private readonly int _BufferSize;
+23 -37
View File
@@ -17,6 +17,7 @@
// */
#endregion
using System.Collections.ObjectModel;
using System.Threading;
using System;
using System.Collections.Generic;
@@ -29,8 +30,7 @@ namespace Vocaluxe.Lib.Sound
class CPortAudioRecord : IRecord
{
private bool _Initialized;
private List<SRecordDevice> _Devices;
private SRecordDevice[] _DeviceConfig;
private List<CRecordDevice> _Devices;
private CPortAudio.PaStreamCallbackDelegate _MyRecProc;
private IntPtr[] _RecHandle;
@@ -39,7 +39,7 @@ namespace Vocaluxe.Lib.Sound
public CPortAudioRecord()
{
_DeviceConfig = null;
_Devices = null;
_Buffer = new CBuffer[CSettings.MaxNumPlayer];
for (int i = 0; i < _Buffer.Length; i++)
@@ -54,7 +54,7 @@ namespace Vocaluxe.Lib.Sound
/// <returns>true if success</returns>
public bool Init()
{
_Devices = new List<SRecordDevice>();
_Devices = new List<CRecordDevice>();
try
{
@@ -73,22 +73,17 @@ namespace Vocaluxe.Lib.Sound
CPortAudio.SPaDeviceInfo info = CPortAudio.PaGetDeviceInfo(i);
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);
}
}
_RecHandle = new IntPtr[_Devices.Count];
_MyRecProc = MyPaStreamCallback;
_DeviceConfig = _Devices.ToArray();
_MyRecProc = _MyPaStreamCallback;
}
catch (Exception e)
{
@@ -103,16 +98,12 @@ namespace Vocaluxe.Lib.Sound
/// <summary>
/// Start Voice Capturing
/// </summary>
/// <param name="deviceConfig"></param>
/// <returns></returns>
public bool Start(SRecordDevice[] deviceConfig)
public bool Start()
{
if (!_Initialized)
return false;
if (deviceConfig == null)
return false;
if (_RecHandle == null || _RecHandle.Length == 0)
return false;
@@ -132,17 +123,12 @@ namespace Vocaluxe.Lib.Sound
for (int i = 0; i < _RecHandle.Length; i++)
_RecHandle[i] = IntPtr.Zero;
_DeviceConfig = deviceConfig;
bool[] active = new bool[deviceConfig.Length];
for (int dev = 0; dev < deviceConfig.Length; dev++)
bool[] active = new bool[_Devices.Count];
for (int dev = 0; dev < _Devices.Count; dev++)
{
active[dev] = false;
for (int inp = 0; inp < deviceConfig[dev].Inputs.Count; inp++)
{
if (deviceConfig[dev].Inputs[inp].PlayerChannel1 > 0 ||
deviceConfig[dev].Inputs[inp].PlayerChannel2 > 0)
active[dev] = true;
}
if (_Devices[dev].PlayerChannel1 > 0 || _Devices[dev].PlayerChannel2 > 0)
active[dev] = true;
}
for (int i = 0; i < _RecHandle.Length; i++)
@@ -151,10 +137,10 @@ namespace Vocaluxe.Lib.Sound
{
CPortAudio.SPaStreamParameters inputParams = new CPortAudio.SPaStreamParameters
{
ChannelCount = _DeviceConfig[i].Inputs[0].Channels,
Device = _DeviceConfig[i].ID,
ChannelCount = _Devices[i].Channels,
Device = _Devices[i].ID,
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(
@@ -273,7 +259,7 @@ namespace Vocaluxe.Lib.Sound
return _Buffer[player].ToneWeigth;
}
public SRecordDevice[] RecordDevices()
public ReadOnlyCollection<CRecordDevice> RecordDevices()
{
if (!_Initialized)
return null;
@@ -281,10 +267,10 @@ namespace Vocaluxe.Lib.Sound
if (_Devices.Count == 0)
return null;
return _Devices.ToArray();
return _Devices.AsReadOnly();
}
public CPortAudio.EPaStreamCallbackResult MyPaStreamCallback(
private CPortAudio.EPaStreamCallbackResult _MyPaStreamCallback(
IntPtr input,
IntPtr output,
uint frameCount,
@@ -315,11 +301,11 @@ namespace Vocaluxe.Lib.Sound
{
if (new IntPtr(i) == userData)
{
if (_DeviceConfig[i].Inputs[0].PlayerChannel1 > 0)
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer);
if (_Devices[i].PlayerChannel1 > 0)
_Buffer[_Devices[i].PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer);
if (_DeviceConfig[i].Inputs[0].PlayerChannel2 > 0)
_Buffer[_DeviceConfig[i].Inputs[0].PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer);
if (_Devices[i].PlayerChannel2 > 0)
_Buffer[_Devices[i].PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer);
break;
}
+4 -12
View File
@@ -18,23 +18,17 @@
#endregion
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Vocaluxe.Lib.Sound
{
struct SRecordDevice
class CRecordDevice
{
public int ID;
public string Name;
public string Driver;
public List<SInput> Inputs;
}
struct SInput
{
public string Name;
public int Channels;
public int PlayerChannel1;
public int PlayerChannel2;
}
@@ -43,7 +37,6 @@ namespace Vocaluxe.Lib.Sound
{
public string DeviceName;
public string DeviceDriver;
public string InputName;
public int Channel;
// ReSharper disable UnusedParameter.Local
@@ -52,7 +45,6 @@ namespace Vocaluxe.Lib.Sound
{
DeviceName = String.Empty;
DeviceDriver = String.Empty;
InputName = String.Empty;
Channel = 0;
}
}
@@ -62,7 +54,7 @@ namespace Vocaluxe.Lib.Sound
bool Init();
void CloseAll();
bool Start(SRecordDevice[] deviceConfig);
bool Start();
bool Stop();
void AnalyzeBuffer(int player);
@@ -74,6 +66,6 @@ namespace Vocaluxe.Lib.Sound
int NumHalfTones(int player);
float[] ToneWeigth(int player);
SRecordDevice[] RecordDevices();
ReadOnlyCollection<CRecordDevice> RecordDevices();
}
}
+3 -3
View File
@@ -185,8 +185,8 @@ namespace Vocaluxe
// Init Input
CLog.StartBenchmark(0, "Init Input");
CInput.Init();
CInput.Connect();
CController.Init();
CController.Connect();
CLog.StopBenchmark(0, "Init Input");
// Init Game;
@@ -220,7 +220,7 @@ namespace Vocaluxe
try
{
CLog.CloseAll();
CInput.Close();
CController.Close();
CSound.RecordCloseAll();
CSound.CloseAllStreams();
CVideo.VdCloseAll();
+41 -90
View File
@@ -18,6 +18,7 @@
#endregion
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows.Forms;
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!
protected override int _ScreenVersion
{
get { return 2; }
get { return 3; }
}
private const float _MaxDelayTime = 1f;
private const string _SelectSlideRecordDevices = "SelectSlideRecordDevices";
private const string _SelectSlideRecordInputs = "SelectSlideRecordInputs";
private const string _SelectSlideRecordChannel1 = "SelectSlideRecordChannel1";
private const string _SelectSlideRecordChannel2 = "SelectSlideRecordChannel2";
@@ -63,9 +63,8 @@ namespace Vocaluxe.Screens
private readonly string[] _StaticEnergyChannel = new string[] {"StaticEnergyChannel1", "StaticEnergyChannel2"};
private float[] _ChannelEnergy;
private SRecordDevice[] _Devices;
private ReadOnlyCollection<CRecordDevice> _Devices;
private int _DeviceNr;
private int _InputNr;
private SDelayTest[] _DelayTest;
private bool _DelayTestRunning;
@@ -81,7 +80,7 @@ namespace Vocaluxe.Screens
_ThemeTexts = new string[] {_TextWarning, _TextDelayChannel1, _TextDelayChannel2};
_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};
}
@@ -160,9 +159,6 @@ namespace Vocaluxe.Screens
if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent();
if (_SelectSlides[_SelectSlideRecordInputs].Selected)
_OnInputEvent();
if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
_SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig();
@@ -175,9 +171,6 @@ namespace Vocaluxe.Screens
if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent();
if (_SelectSlides[_SelectSlideRecordInputs].Selected)
_OnInputEvent();
if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
_SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig();
@@ -205,9 +198,6 @@ namespace Vocaluxe.Screens
if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent();
if (_SelectSlides[_SelectSlideRecordInputs].Selected)
_OnInputEvent();
if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
_SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig();
@@ -311,28 +301,22 @@ namespace Vocaluxe.Screens
base.OnShow();
_SelectSlides[_SelectSlideRecordDevices].Clear();
_SelectSlides[_SelectSlideRecordInputs].Clear();
for (int i = 0; i < _ChannelEnergy.Length; i++)
_ChannelEnergy[i] = 0f;
_DeviceNr = -1;
_InputNr = -1;
_Devices = CSound.RecordGetDevices();
if (_Devices != null)
{
_DeviceNr = 0;
_InputNr = 0;
_GetFirstConfiguredRecordDevice(ref _DeviceNr, ref _InputNr);
_GetFirstConfiguredRecordDevice(ref _DeviceNr);
for (int dev = 0; dev < _Devices.Length; dev++)
_SelectSlides[_SelectSlideRecordDevices].AddValue(_Devices[dev].Name);
foreach (CRecordDevice device in _Devices)
_SelectSlides[_SelectSlideRecordDevices].AddValue(device.Name);
_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();
}
@@ -416,24 +400,7 @@ namespace Vocaluxe.Screens
{
if (_SelectSlides[_SelectSlideRecordDevices].Selection != _DeviceNr)
{
_SelectSlides[_SelectSlideRecordInputs].Clear();
_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();
}
}
@@ -457,25 +424,20 @@ namespace Vocaluxe.Screens
for (int p = 0; p < CSettings.MaxNumPlayer; p++)
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[_Devices[dev].Inputs[inp].PlayerChannel1 - 1].Channel = 1;
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;
}
CConfig.MicConfig[device.PlayerChannel1 - 1].Channel = 1;
CConfig.MicConfig[device.PlayerChannel1 - 1].DeviceName = device.Name;
CConfig.MicConfig[device.PlayerChannel1 - 1].DeviceDriver = device.Driver;
}
if (_Devices[dev].Inputs[inp].PlayerChannel2 > 0)
{
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].Channel = 2;
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].DeviceName = _Devices[dev].Name;
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].DeviceDriver = _Devices[dev].Driver;
CConfig.MicConfig[_Devices[dev].Inputs[inp].PlayerChannel2 - 1].InputName = _Devices[dev].Inputs[inp].Name;
}
if (device.PlayerChannel2 > 0)
{
CConfig.MicConfig[device.PlayerChannel2 - 1].Channel = 2;
CConfig.MicConfig[device.PlayerChannel2 - 1].DeviceName = device.Name;
CConfig.MicConfig[device.PlayerChannel2 - 1].DeviceDriver = device.Driver;
}
}
CConfig.SaveConfig();
@@ -487,16 +449,15 @@ namespace Vocaluxe.Screens
{
if (_DeviceNr < 0)
return;
SInput input = _Devices[_DeviceNr].Inputs[_InputNr];
input.PlayerChannel1 = _SelectSlides[_SelectSlideRecordChannel1].Selection;
input.PlayerChannel2 = _SelectSlides[_SelectSlideRecordChannel2].Selection;
_Devices[_DeviceNr].Inputs[_InputNr] = input;
CRecordDevice device = _Devices[_DeviceNr];
device.PlayerChannel1 = _SelectSlides[_SelectSlideRecordChannel1].Selection;
device.PlayerChannel2 = _SelectSlides[_SelectSlideRecordChannel2].Selection;
}
private void _UpdateChannels()
{
_SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel1;
_SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel2;
_SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].PlayerChannel1;
_SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].PlayerChannel2;
_SaveMicConfig();
}
@@ -510,25 +471,22 @@ namespace Vocaluxe.Screens
if (_Devices == null)
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[_Devices[dev].Inputs[inp].PlayerChannel1 - 1])
return false;
if (isSet[device.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 (isSet[_Devices[dev].Inputs[inp].PlayerChannel2 - 1])
return false;
if (device.PlayerChannel2 > 0)
{
if (isSet[device.PlayerChannel2 - 1])
return false;
isSet[_Devices[dev].Inputs[inp].PlayerChannel2 - 1] = true;
}
isSet[device.PlayerChannel2 - 1] = true;
}
}
return true;
@@ -545,7 +503,7 @@ namespace Vocaluxe.Screens
_DelayTestRunning = true;
}
private void _GetFirstConfiguredRecordDevice(ref int device, ref int input)
private void _GetFirstConfiguredRecordDevice(ref int device)
{
if (_Devices == null)
return;
@@ -553,22 +511,15 @@ namespace Vocaluxe.Screens
if (CConfig.MicConfig == null)
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)
{
for (int j = 0; j < _Devices[i].Inputs.Count; j++)
{
if (_Devices[i].Inputs[j].Name == CConfig.MicConfig[0].InputName)
{
if (CConfig.MicConfig[0].Channel > 0)
{
device = i;
input = j;
return;
}
}
}
device = i;
return;
}
}
}
-1
View File
@@ -17,7 +17,6 @@
// */
#endregion
using System;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Base.Font;
+12 -2
View File
@@ -177,6 +177,7 @@ namespace Vocaluxe.Screens
if (!_PartyModeInfos[index].Playable)
{
_Buttons[_ButtonStart].Visible = false;
_Texts[_TextError].Text = "TR_SCREENPARTY_ERROR";
_Texts[_TextError].Visible = true;
}
else
@@ -193,10 +194,19 @@ namespace Vocaluxe.Screens
int index = _SelectSlides[_SelectSlideModes].Selection;
if (index >= _PartyModeInfos.Count)
return;
{
_Buttons[_ButtonStart].Visible = false;
_Texts[_TextError].Text = "TR_SCREENPARTY_ERROR";
_Texts[_TextError].Visible = true;
}
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);
CGraphics.FadeTo(EScreens.ScreenPartyDummy);
+2
View File
@@ -384,7 +384,9 @@ namespace Vocaluxe.Screens
for (int p = 0; p < CGame.NumPlayer; p++)
{
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (CGame.Players[p].Points < 10000)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Players[p].Points.ToString("0000");
else
_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)
_SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = true;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (_Buttons[_ButtonOptionsRandom].Visible)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
_SetInteractionToButton(_Buttons[_ButtonOptionsRandom]);
else
_SetInteractionToButton(_Buttons[_ButtonOptionsRandomCategory]);
+2 -2
View File
@@ -178,7 +178,7 @@
<Compile Include="Base\CDraw.cs" />
<Compile Include="Base\Font\CFont.cs" />
<Compile Include="Base\CGame.cs" />
<Compile Include="Base\CInput.cs" />
<Compile Include="Base\CController.cs" />
<Compile Include="Base\CLanguage.cs" />
<Compile Include="Base\CLog.cs" />
<Compile Include="Base\CMain.cs" />
@@ -217,7 +217,7 @@
</Compile>
<Compile Include="Lib\Draw\IDraw.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\WiiMoteLib.cs" />
<Compile Include="Lib\Playlist\CPlaylistFile.cs" />
+3 -3
View File
@@ -38,12 +38,12 @@ namespace VocaluxeLib.Menu
public static ISound Sound;
public static ICover Cover;
public static IDataBase DataBase;
public static IInputs Input;
public static IControllers Controller;
public static IPlaylist Playlist;
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,
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;
Settings = settings;
@@ -62,7 +62,7 @@ namespace VocaluxeLib.Menu
Sound = sound;
Cover = cover;
DataBase = dataBase;
Input = input;
Controller = controller;
Playlist = playlist;
}
}
+2
View File
@@ -297,7 +297,9 @@ namespace VocaluxeLib.Menu
public void Draw()
{
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
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));
else
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)
{
_MaxWidth = value;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (_MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), _MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else
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;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else
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;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else
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;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else
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;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else
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();
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else
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);
}
public interface IInputs
public interface IControllers
{
void SetRumble(float duration);
}
+2 -14
View File
@@ -348,13 +348,7 @@ namespace VocaluxeLib.Menu.SingNotes
public string Lyrics
{
get
{
string lyrics = String.Empty;
foreach (CNote note in _Notes)
lyrics += note.Text;
return lyrics;
}
get { return _Notes.Aggregate(String.Empty, (current, note) => current + note.Text); }
}
public int NoteCount
@@ -364,13 +358,7 @@ namespace VocaluxeLib.Menu.SingNotes
public int Points
{
get
{
int points = 0;
foreach (CNote note in _Notes)
points += note.Points;
return points;
}
get { return _Notes.Sum(note => note.Points); }
}
public CNote[] Notes
@@ -347,7 +347,7 @@ namespace VocaluxeLib.Menu.SongMenu
sel = true;
if (mouseEvent.Sender == ESender.WiiMote && _ActualSelection != lastselection && _ActualSelection != -1)
CBase.Input.SetRumble(0.050f);
CBase.Controller.SetRumble(0.050f);
if (!sel)
_ActualSelection = -1;
@@ -392,7 +392,9 @@ namespace VocaluxeLib.Menu.SongMenu
tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop);
else
{
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (tile.Texture.Index != _CoverTexture.Index)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
tile.Draw(1f, tile.Rect.Z, EAspect.Crop);
else
tile.Draw(1f, tile.Rect.Z, EAspect.Stretch);
@@ -433,7 +435,9 @@ namespace VocaluxeLib.Menu.SongMenu
_Artist.Text = CBase.Songs.GetCategory(actcat).Name;
int num = CBase.Songs.NumSongsInCategory(actcat);
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (num != 1)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString());
else
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString());
@@ -623,10 +627,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
if (itemCount > i + offset)
{
if (isInCategory)
_Tiles[i].Texture = CBase.Songs.GetVisibleSong(i + offset).CoverTextureSmall;
else
_Tiles[i].Texture = CBase.Songs.GetCategory(i + offset).CoverTextureSmall;
_Tiles[i].Texture = isInCategory ? CBase.Songs.GetVisibleSong(i + offset).CoverTextureSmall : CBase.Songs.GetCategory(i + offset).CoverTextureSmall;
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
}
else