Merge remote-tracking branch 'refs/remotes/Vocaluxe/develop' into develop

This commit is contained in:
Jiiniasu committed 2016-03-13 10:01:56 +01:00
commit 96a196aa07
10 files changed
+605 -237

No files matched your search

+6 -2
View File
@@ -182,8 +182,12 @@
<string name="TR_SCREENORECORD_OPTIONS">Record Options</string>
<string name="TR_SCREENORECORD_DEVICE">Device</string>
<string name="TR_SCREENORECORD_INPUT">Input</string>
<string name="TR_SCREENORECORD_CHANNEL_1">Channel 1</string>
<string name="TR_SCREENORECORD_CHANNEL_2">Channel 2</string>
<string name="TR_SCREENORECORD_PLAYER_1">Player 1</string>
<string name="TR_SCREENORECORD_PLAYER_2">Player 2</string>
<string name="TR_SCREENORECORD_PLAYER_3">Player 3</string>
<string name="TR_SCREENORECORD_PLAYER_4">Player 4</string>
<string name="TR_SCREENORECORD_PLAYER_5">Player 5</string>
<string name="TR_SCREENORECORD_PLAYER_6">Player 6</string>
<string name="TR_SCREENORECORD_MIC_DELAY">Mic Delay</string>
<string name="TR_SCREENORECORD_MIC_WARNING">Warning: At least one player is assigned to two mics.</string>
<string name="TR_SCREENORECORD_BUTTON_DELAYTEST">Delay Test</string>
@@ -2,7 +2,7 @@
<Screen xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Informations>
<ScreenName>ScreenOptionsRecord</ScreenName>
<ScreenVersion>4</ScreenVersion>
<ScreenVersion>5</ScreenVersion>
</Informations>
<Backgrounds>
<Background Name="Background1">
@@ -91,7 +91,7 @@
<Z>0</Z>
</Rect>
</Static>
<Static Name="StaticEnergyChannel1">
<Static Name="StaticEnergyPlayer1">
<Skin>EnergyBeam</Skin>
<Color Name="Visible" />
<Rect>
@@ -102,7 +102,7 @@
<Z>0</Z>
</Rect>
</Static>
<Static Name="StaticEnergyChannel2">
<Static Name="StaticEnergyPlayer2">
<Skin>EnergyBeam</Skin>
<Color Name="Visible" />
<Rect>
@@ -112,6 +112,50 @@
<H>16</H>
<Z>0</Z>
</Rect>
</Static>
<Static Name="StaticEnergyPlayer3">
<Skin>EnergyBeam</Skin>
<Color Name="Visible" />
<Rect>
<X>390</X>
<Y>354</Y>
<W>100</W>
<H>16</H>
<Z>0</Z>
</Rect>
</Static>
<Static Name="StaticEnergyPlayer4">
<Skin>EnergyBeam</Skin>
<Color Name="Visible" />
<Rect>
<X>390</X>
<Y>416</Y>
<W>100</W>
<H>16</H>
<Z>0</Z>
</Rect>
</Static>
<Static Name="StaticEnergyPlayer5">
<Skin>EnergyBeam</Skin>
<Color Name="Visible" />
<Rect>
<X>390</X>
<Y>474</Y>
<W>100</W>
<H>16</H>
<Z>0</Z>
</Rect>
</Static>
<Static Name="StaticEnergyPlayer6">
<Skin>EnergyBeam</Skin>
<Color Name="Visible" />
<Rect>
<X>390</X>
<Y>536</Y>
<W>100</W>
<H>16</H>
<Z>0</Z>
</Rect>
</Static>
</Statics>
<Texts>
@@ -145,7 +189,7 @@
</Text>
<Text Name="Text3">
<X>75</X>
<Y>347</Y>
<Y>167</Y>
<Z>0</Z>
<H>27</H>
<MaxW>0</MaxW>
@@ -159,7 +203,7 @@
</Text>
<Text Name="TextWarning">
<X>640</X>
<Y>537</Y>
<Y>615</Y>
<Z>0</Z>
<H>27</H>
<MaxW>970</MaxW>
@@ -171,7 +215,7 @@
<Font>Outline</Font>
<Text>TR_SCREENORECORD_MIC_WARNING</Text>
</Text>
<Text Name="TextChannel1">
<Text Name="TextPlayer1">
<X>75</X>
<Y>227</Y>
<Z>0</Z>
@@ -183,9 +227,9 @@
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_SCREENORECORD_CHANNEL_1</Text>
<Text>TR_SCREENORECORD_PLAYER_1</Text>
</Text>
<Text Name="TextChannel2">
<Text Name="TextPlayer2">
<X>75</X>
<Y>287</Y>
<Z>0</Z>
@@ -197,31 +241,143 @@
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_SCREENORECORD_CHANNEL_2</Text>
</Text>
<Text Name="TextDelayChannel1">
<X>330</X>
<Y>227</Y>
<Z>-1</Z>
<Text>TR_SCREENORECORD_PLAYER_2</Text>
</Text>
<Text Name="TextPlayer3">
<X>75</X>
<Y>347</Y>
<Z>0</Z>
<H>27</H>
<MaxW>0</MaxW>
<Color Name="StaticColor" />
<SelColor Name="TextSelColor" />
<Align>Right</Align>
<Align>Left</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_SCREENORECORD_PLAYER_3</Text>
</Text>
<Text Name="TextPlayer4">
<X>75</X>
<Y>407</Y>
<Z>0</Z>
<H>27</H>
<MaxW>0</MaxW>
<Color Name="StaticColor" />
<SelColor Name="TextSelColor" />
<Align>Left</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_SCREENORECORD_PLAYER_4</Text>
</Text>
<Text Name="TextPlayer5">
<X>75</X>
<Y>467</Y>
<Z>0</Z>
<H>27</H>
<MaxW>0</MaxW>
<Color Name="StaticColor" />
<SelColor Name="TextSelColor" />
<Align>Left</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_SCREENORECORD_PLAYER_5</Text>
</Text>
<Text Name="TextPlayer6">
<X>75</X>
<Y>527</Y>
<Z>0</Z>
<H>27</H>
<MaxW>0</MaxW>
<Color Name="StaticColor" />
<SelColor Name="TextSelColor" />
<Align>Left</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_SCREENORECORD_PLAYER_6</Text>
</Text>
<Text Name="TextDelayPlayer1">
<X>320</X>
<Y>227</Y>
<Z>-2</Z>
<H>27</H>
<MaxW>100</MaxW>
<Color Name="StaticColor" />
<SelColor Name="TextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text />
</Text>
<Text Name="TextDelayChannel2">
<X>330</X>
<Text Name="TextDelayPlayer2">
<X>320</X>
<Y>287</Y>
<Z>-1</Z>
<Z>-2</Z>
<H>27</H>
<MaxW>0</MaxW>
<MaxW>100</MaxW>
<Color Name="StaticColor" />
<SelColor Name="TextSelColor" />
<Align>Right</Align>
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text />
</Text>
<Text Name="TextDelayPlayer3">
<X>320</X>
<Y>347</Y>
<Z>-2</Z>
<H>27</H>
<MaxW>100</MaxW>
<Color Name="StaticColor" />
<SelColor Name="TextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text />
</Text>
<Text Name="TextDelayPlayer4">
<X>320</X>
<Y>407</Y>
<Z>-2</Z>
<H>27</H>
<MaxW>100</MaxW>
<Color Name="StaticColor" />
<SelColor Name="TextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text />
</Text>
<Text Name="TextDelayPlayer5">
<X>320</X>
<Y>467</Y>
<Z>-2</Z>
<H>27</H>
<MaxW>100</MaxW>
<Color Name="StaticColor" />
<SelColor Name="TextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text />
</Text>
<Text Name="TextDelayPlayer6">
<X>320</X>
<Y>527</Y>
<Z>-2</Z>
<H>27</H>
<MaxW>100</MaxW>
<Color Name="StaticColor" />
<SelColor Name="TextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
@@ -268,7 +424,7 @@
<Skin>Button</Skin>
<SkinSelected>Button</SkinSelected>
<Rect>
<X>355</X>
<X>985</X>
<Y>600</Y>
<W>150</W>
<H>50</H>
@@ -345,7 +501,7 @@
<TextStyle>Bold</TextStyle>
<NumVisible>1</NumVisible>
</SelectSlide>
<SelectSlide Name="SelectSlideRecordChannel1">
<SelectSlide Name="SelectSlideRecordPlayer1">
<Skin/>
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
@@ -387,7 +543,7 @@
<TextStyle>Bold</TextStyle>
<NumVisible>7</NumVisible>
</SelectSlide>
<SelectSlide Name="SelectSlideRecordChannel2">
<SelectSlide Name="SelectSlideRecordPlayer2">
<Skin/>
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
@@ -429,7 +585,7 @@
<TextStyle>Bold</TextStyle>
<NumVisible>7</NumVisible>
</SelectSlide>
<SelectSlide Name="SelectSlideDelay">
<SelectSlide Name="SelectSlideRecordPlayer3">
<Skin/>
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
@@ -466,6 +622,174 @@
<TextH>27</TextH>
<TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY>
<TextMaxW>154</TextMaxW>
<TextFont>Outline</TextFont>
<TextStyle>Bold</TextStyle>
<NumVisible>7</NumVisible>
</SelectSlide>
<SelectSlide Name="SelectSlideRecordPlayer4">
<Skin/>
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
<SkinSelected>SelectSlide</SkinSelected>
<SkinArrowLeftSelected>SelectSlideArrowLeft</SkinArrowLeftSelected>
<SkinArrowRightSelected>SelectSlideArrowRight</SkinArrowRightSelected>
<Rect>
<X>500</X>
<Y>400</Y>
<W>700</W>
<H>50</H>
<Z>0</Z>
</Rect>
<RectArrowLeft>
<X>505</X>
<Y>405</Y>
<W>40</W>
<H>40</H>
<Z>0</Z>
</RectArrowLeft>
<RectArrowRight>
<X>1170</X>
<Y>405</Y>
<W>40</W>
<H>40</H>
<Z>0</Z>
</RectArrowRight>
<Color Name="SelectSlideColor" />
<SelColor Name="SelectSlideSelColor" />
<ArrowColor Name="ArrowColor" />
<ArrowSelColor Name="ArrowSelColor" />
<TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" />
<TextH>27</TextH>
<TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY>
<TextMaxW>154</TextMaxW>
<TextFont>Outline</TextFont>
<TextStyle>Bold</TextStyle>
<NumVisible>7</NumVisible>
</SelectSlide>
<SelectSlide Name="SelectSlideRecordPlayer5">
<Skin/>
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
<SkinSelected>SelectSlide</SkinSelected>
<SkinArrowLeftSelected>SelectSlideArrowLeft</SkinArrowLeftSelected>
<SkinArrowRightSelected>SelectSlideArrowRight</SkinArrowRightSelected>
<Rect>
<X>500</X>
<Y>460</Y>
<W>700</W>
<H>50</H>
<Z>0</Z>
</Rect>
<RectArrowLeft>
<X>505</X>
<Y>465</Y>
<W>40</W>
<H>40</H>
<Z>0</Z>
</RectArrowLeft>
<RectArrowRight>
<X>1170</X>
<Y>465</Y>
<W>40</W>
<H>40</H>
<Z>0</Z>
</RectArrowRight>
<Color Name="SelectSlideColor" />
<SelColor Name="SelectSlideSelColor" />
<ArrowColor Name="ArrowColor" />
<ArrowSelColor Name="ArrowSelColor" />
<TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" />
<TextH>27</TextH>
<TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY>
<TextMaxW>154</TextMaxW>
<TextFont>Outline</TextFont>
<TextStyle>Bold</TextStyle>
<NumVisible>7</NumVisible>
</SelectSlide>
<SelectSlide Name="SelectSlideRecordPlayer6">
<Skin/>
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
<SkinSelected>SelectSlide</SkinSelected>
<SkinArrowLeftSelected>SelectSlideArrowLeft</SkinArrowLeftSelected>
<SkinArrowRightSelected>SelectSlideArrowRight</SkinArrowRightSelected>
<Rect>
<X>500</X>
<Y>520</Y>
<W>700</W>
<H>50</H>
<Z>0</Z>
</Rect>
<RectArrowLeft>
<X>505</X>
<Y>525</Y>
<W>40</W>
<H>40</H>
<Z>0</Z>
</RectArrowLeft>
<RectArrowRight>
<X>1170</X>
<Y>525</Y>
<W>40</W>
<H>40</H>
<Z>0</Z>
</RectArrowRight>
<Color Name="SelectSlideColor" />
<SelColor Name="SelectSlideSelColor" />
<ArrowColor Name="ArrowColor" />
<ArrowSelColor Name="ArrowSelColor" />
<TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" />
<TextH>27</TextH>
<TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY>
<TextMaxW>154</TextMaxW>
<TextFont>Outline</TextFont>
<TextStyle>Bold</TextStyle>
<NumVisible>7</NumVisible>
</SelectSlide>
<SelectSlide Name="SelectSlideDelay">
<Skin/>
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
<SkinSelected>SelectSlide</SkinSelected>
<SkinArrowLeftSelected>SelectSlideArrowLeft</SkinArrowLeftSelected>
<SkinArrowRightSelected>SelectSlideArrowRight</SkinArrowRightSelected>
<Rect>
<X>500</X>
<Y>160</Y>
<W>700</W>
<H>50</H>
<Z>0</Z>
</Rect>
<RectArrowLeft>
<X>505</X>
<Y>165</Y>
<W>40</W>
<H>40</H>
<Z>0</Z>
</RectArrowLeft>
<RectArrowRight>
<X>1170</X>
<Y>165</Y>
<W>40</W>
<H>40</H>
<Z>0</Z>
</RectArrowRight>
<Color Name="SelectSlideColor" />
<SelColor Name="SelectSlideSelColor" />
<ArrowColor Name="ArrowColor" />
<ArrowSelColor Name="ArrowSelColor" />
<TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" />
<TextH>27</TextH>
<TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY>
<TextMaxW>123.2</TextMaxW>
<TextFont>Outline</TextFont>
<TextStyle>Bold</TextStyle>
@@ -475,13 +799,13 @@
<SingNotes />
<NameSelections />
<Equalizers>
<Equalizer Name="EqualizerChannel1">
<Equalizer Name="EqualizerPlayer1">
<Skin/>
<Rect>
<X>50</X>
<Y>400</Y>
<W>230</W>
<H>150</H>
<X>270</X>
<Y>220</Y>
<W>100</W>
<H>40</H>
<Z>-1</Z>
</Rect>
<NumBars>12</NumBars>
@@ -490,18 +814,15 @@
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<Color Name="ButtonColor" />
<MaxColor Name="ButtonTextColor" />
<Reflection>
<Height>26</Height>
<Space>10</Space>
</Reflection>
<Reflection />
</Equalizer>
<Equalizer Name="EqualizerChannel2">
<Equalizer Name="EqualizerPlayer2">
<Skin/>
<Rect>
<X>400</X>
<Y>400</Y>
<W>230</W>
<H>150</H>
<X>270</X>
<Y>280</Y>
<W>100</W>
<H>40</H>
<Z>-1</Z>
</Rect>
<NumBars>12</NumBars>
@@ -510,10 +831,75 @@
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<Color Name="ButtonColor" />
<MaxColor Name="ButtonTextColor" />
<Reflection>
<Height>26</Height>
<Space>10</Space>
</Reflection>
<Reflection />
</Equalizer>
<Equalizer Name="EqualizerPlayer3">
<Skin/>
<Rect>
<X>270</X>
<Y>340</Y>
<W>100</W>
<H>40</H>
<Z>-1</Z>
</Rect>
<NumBars>12</NumBars>
<Space>2</Space>
<Style>Columns</Style>
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<Color Name="ButtonColor" />
<MaxColor Name="ButtonTextColor" />
<Reflection />
</Equalizer>
<Equalizer Name="EqualizerPlayer4">
<Skin/>
<Rect>
<X>270</X>
<Y>400</Y>
<W>100</W>
<H>40</H>
<Z>-1</Z>
</Rect>
<NumBars>12</NumBars>
<Space>2</Space>
<Style>Columns</Style>
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<Color Name="ButtonColor" />
<MaxColor Name="ButtonTextColor" />
<Reflection />
</Equalizer>
<Equalizer Name="EqualizerPlayer5">
<Skin/>
<Rect>
<X>270</X>
<Y>460</Y>
<W>100</W>
<H>40</H>
<Z>-1</Z>
</Rect>
<NumBars>12</NumBars>
<Space>2</Space>
<Style>Columns</Style>
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<Color Name="ButtonColor" />
<MaxColor Name="ButtonTextColor" />
<Reflection />
</Equalizer>
<Equalizer Name="EqualizerPlayer6">
<Skin/>
<Rect>
<X>270</X>
<Y>520</Y>
<W>100</W>
<H>40</H>
<Z>-1</Z>
</Rect>
<NumBars>12</NumBars>
<Space>2</Space>
<Style>Columns</Style>
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<Color Name="ButtonColor" />
<MaxColor Name="ButtonTextColor" />
<Reflection/>
</Equalizer>
</Equalizers>
<Playlists />
@@ -9,4 +9,20 @@ This is a new theme-element. Check ScreenOptionsRecord.xml for style-possibiliti
++++++++++
Version 4:
Rename Text 3/4 to TextChannel1/2
Rename Text5 to Text3
Rename Text5 to Text3
++++++++++
Version 5:
Added:
StaticEnergyPlayer1-6
TextPlayer1-6
TextDelayPlayer1-6
SelectSlideRecordPlayer1-6
EqualizerPlayer1-6
Removed:
StaticEnergyChannel1-2
TextChannel1-2
TextDelayChannel1-2
SelectSlideRecordChannel1-2
EqualizerChannel1-2
+11 -15
View File
@@ -520,31 +520,27 @@ namespace Vocaluxe.Base
return (1f / Config.Graphics.MaxFPS) * 1000f;
}
/// <summary>
/// Checks, if there is a mic-configuration
/// </summary>
/// <returns></returns>
public static bool IsMicConfig()
{
ReadOnlyCollection<CRecordDevice> devices = CRecord.GetDevices();
if (devices == null)
return false;
return devices.Any(t => t.PlayerChannel1 != 0 || t.PlayerChannel2 != 0);
}
/// <summary>
/// Checks, if there is a mic-configuration
/// </summary>
/// <param name="player">Player-Number</param>
/// <returns></returns>
public static bool IsMicConfig(int player)
public static bool IsMicConfig(int player = 0)
{
ReadOnlyCollection<CRecordDevice> devices = CRecord.GetDevices();
if (devices == null)
return false;
return devices.Any(t => t.PlayerChannel1 == player || t.PlayerChannel2 == player);
if (player > 0)
return devices.Any(t => t.PlayerChannel.Contains(player));
for (int p = 0; p < CSettings.MaxNumPlayer; ++p)
if (devices.Any(t => t.PlayerChannel.Contains(p+1)))
{
return true;
}
return false;
}
public static int GetMaxNumMics()
+2 -2
View File
@@ -126,8 +126,8 @@ namespace Vocaluxe.Base
{
foreach (CRecordDevice device in devices)
{
device.PlayerChannel1 = _GetPlayerFromMicConfig(device.Name, device.Driver, 1);
device.PlayerChannel2 = _GetPlayerFromMicConfig(device.Name, device.Driver, 2);
for(int ch = 0; ch < device.Channels; ++ch)
device.PlayerChannel[ch] = _GetPlayerFromMicConfig(device.Name, device.Driver, ch+1);
}
return devices;
}
+16 -22
View File
@@ -18,6 +18,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Vocaluxe.Base;
using System;
namespace Vocaluxe.Lib.Sound.Record
{
@@ -76,32 +77,25 @@ namespace Vocaluxe.Lib.Sound.Record
/// <param name="data">Recorded samples, assume Int16 and interleaved for multi-channels</param>
protected void _HandleData(CRecordDevice device, byte[] data)
{
byte[] leftBuffer;
byte[] rightBuffer;
if (device.Channels == 2)
int totalChannels = device.Channels;
int doubleChannels = totalChannels * 2;
byte[][] allBuffers = new byte[totalChannels][];
for (int currChannel = 0; currChannel < totalChannels; ++currChannel)
allBuffers[currChannel] = new byte[data.Length / totalChannels];
for (int i = 0; i < data.Length / doubleChannels; ++i)
{
leftBuffer = new byte[data.Length / 2];
rightBuffer = new byte[data.Length / 2];
//[]: Sample, L: Left channel R: Right channel
//[LR][LR][LR][LR][LR][LR]
//The data is interleaved and needs to be demultiplexed
for (int i = 0; i < data.Length / 4; i++)
{
leftBuffer[i * 2] = data[i * 4];
leftBuffer[i * 2 + 1] = data[i * 4 + 1];
rightBuffer[i * 2] = data[i * 4 + 2];
rightBuffer[i * 2 + 1] = data[i * 4 + 3];
}
for (int j = 0; j < doubleChannels; ++j)
allBuffers[(int)Math.Floor(j / (double)2)][i * 2 + (j % 2)] = data[i * doubleChannels + j];
}
else
leftBuffer = rightBuffer = data;
if (device.PlayerChannel1 > 0)
_Buffer[device.PlayerChannel1 - 1].ProcessNewBuffer(leftBuffer);
if (device.PlayerChannel2 > 0)
_Buffer[device.PlayerChannel2 - 1].ProcessNewBuffer(rightBuffer);
for (int ch = 0; ch < totalChannels; ++ch)
{
if (device.PlayerChannel[ch] > 0)
_Buffer[device.PlayerChannel[ch] - 1].ProcessNewBuffer(allBuffers[ch]);
}
}
/// <summary>
@@ -68,9 +68,15 @@ namespace Vocaluxe.Lib.Sound.Record.DirectSound
foreach (CRecordDevice device in _Devices)
{
if (device.PlayerChannel1 > 0 || device.PlayerChannel2 > 0)
bool usingDevice = false;
for (int ch = 0; ch < device.Channels; ++ch)
{
var source = new CSoundCardSource(device.Driver, (short)device.Channels) {SampleRateKhz = 44.1};
if (device.PlayerChannel[ch] > 0)
usingDevice = true;
}
if (usingDevice)
{
var source = new CSoundCardSource(device.Driver, (short)device.Channels) { SampleRateKhz = 44.1 };
source.SampleDataReady += _OnDataReady;
source.Start();
+2 -6
View File
@@ -27,19 +27,15 @@ namespace Vocaluxe.Lib.Sound.Record
public readonly string Driver;
public readonly int Channels;
public int PlayerChannel1;
public int PlayerChannel2;
public int[] PlayerChannel;
public CRecordDevice(int id, string name, string driver, int channels)
{
ID = id;
Name = name;
Driver = driver;
if (channels > 2)
channels = 2; //more are not supported in vocaluxe
Channels = channels;
PlayerChannel = new int[channels];
}
}
@@ -99,16 +99,21 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio
for (int dev = 0; dev < _Devices.Count; dev++)
{
if (_Devices[dev].PlayerChannel1 > 0 || _Devices[dev].PlayerChannel2 > 0)
bool usingDevice = false;
for (int ch = 0; ch < _Devices[dev].Channels; ++ch) {
if (_Devices[dev].PlayerChannel[ch] > 0)
usingDevice = true;
}
if (usingDevice)
{
PortAudioSharp.PortAudio.PaStreamParameters? inputParams = new PortAudioSharp.PortAudio.PaStreamParameters
{
channelCount = _Devices[dev].Channels,
device = _Devices[dev].ID,
sampleFormat = PortAudioSharp.PortAudio.PaSampleFormat.paInt16,
suggestedLatency = PortAudioSharp.PortAudio.Pa_GetDeviceInfo(_Devices[dev].ID).defaultLowInputLatency,
hostApiSpecificStreamInfo = IntPtr.Zero
};
{
channelCount = _Devices[dev].Channels,
device = _Devices[dev].ID,
sampleFormat = PortAudioSharp.PortAudio.PaSampleFormat.paInt16,
suggestedLatency = PortAudioSharp.PortAudio.Pa_GetDeviceInfo(_Devices[dev].ID).defaultLowInputLatency,
hostApiSpecificStreamInfo = IntPtr.Zero
};
if (!_PaHandle.OpenInputStream(
out _RecHandle[dev],
ref inputParams,
@@ -181,10 +186,7 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio
{
CRecordDevice dev = _Devices[userData.ToInt32()];
uint numBytes;
if (dev.Channels == 2)
numBytes = frameCount * 4;
else
numBytes = frameCount * 2;
numBytes = frameCount * (uint)dev.Channels * 2;
byte[] recbuffer = new byte[numBytes];
+101 -133
View File
@@ -31,13 +31,13 @@ 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 4; }
get { return 5; }
}
private const string _SelectSlideRecordDevices = "SelectSlideRecordDevices";
private const string _SelectSlideRecordChannel1 = "SelectSlideRecordChannel1";
private const string _SelectSlideRecordChannel2 = "SelectSlideRecordChannel2";
private readonly string[] _SelectSlideRecordPlayer = { "SelectSlideRecordPlayer1", "SelectSlideRecordPlayer2", "SelectSlideRecordPlayer3", "SelectSlideRecordPlayer4", "SelectSlideRecordPlayer5", "SelectSlideRecordPlayer6" };
private const string _SelectSlideDelay = "SelectSlideDelay";
private const string _StaticWarning = "StaticWarning";
@@ -46,22 +46,19 @@ namespace Vocaluxe.Screens
private const string _ButtonExit = "ButtonExit";
private const string _ButtonDelayTest = "ButtonDelayTest";
private const string _TextChannel1 = "TextChannel1";
private const string _TextChannel2 = "TextChannel2";
private readonly string[] _TextPlayer = { "TextPlayer1", "TextPlayer2", "TextPlayer3", "TextPlayer4", "TextPlayer5", "TextPlayer6" };
private const string _TextDelayChannel1 = "TextDelayChannel1";
private const string _TextDelayChannel2 = "TextDelayChannel2";
private readonly string[] _TextDelayPlayer = { "TextDelayPlayer1", "TextDelayPlayer2", "TextDelayPlayer3", "TextDelayPlayer4", "TextDelayPlayer5", "TextDelayPlayer6" };
private const string _EqualizerChannel1 = "EqualizerChannel1";
private const string _EqualizerChannel2 = "EqualizerChannel2";
private readonly string[] _EqualizerPlayer = { "EqualizerPlayer1", "EqualizerPlayer2", "EqualizerPlayer3", "EqualizerPlayer4", "EqualizerPlayer5", "EqualizerPlayer6" };
private readonly string[] _StaticEnergyChannel = new string[] {"StaticEnergyChannel1", "StaticEnergyChannel2"};
private readonly string[] _StaticEnergyPlayer = new string[] { "StaticEnergyPlayer1", "StaticEnergyPlayer2", "StaticEnergyPlayer3", "StaticEnergyPlayer4", "StaticEnergyPlayer5", "StaticEnergyPlayer6" };
private float[] _ChannelEnergy;
private ReadOnlyCollection<CRecordDevice> _Devices;
private int _DeviceNr;
private readonly CDelayTest _DelayTest = new CDelayTest(2);
private readonly CDelayTest _DelayTest = new CDelayTest(6);
public override EMusicType CurrentMusicType
{
@@ -73,43 +70,27 @@ namespace Vocaluxe.Screens
base.Init();
var values = new List<string> {_StaticWarning};
values.AddRange(_StaticEnergyChannel);
values.AddRange(_StaticEnergyPlayer);
_ThemeStatics = values.ToArray();
_ThemeTexts = new string[] {_TextWarning, _TextChannel1, _TextChannel2, _TextDelayChannel1, _TextDelayChannel2};
_ThemeTexts = new string[] {_TextWarning, _TextPlayer[0], _TextPlayer[1], _TextPlayer[2], _TextPlayer[3], _TextPlayer[4], _TextPlayer[5], _TextDelayPlayer[0], _TextDelayPlayer[1], _TextDelayPlayer[2], _TextDelayPlayer[3], _TextDelayPlayer[4], _TextDelayPlayer[5] };
_ThemeButtons = new string[] {_ButtonExit, _ButtonDelayTest};
_ThemeSelectSlides = new string[] {_SelectSlideRecordDevices, _SelectSlideRecordChannel1, _SelectSlideRecordChannel2, _SelectSlideDelay};
_ThemeEqualizers = new string[] {_EqualizerChannel1, _EqualizerChannel2};
_ThemeSelectSlides = new string[] {_SelectSlideRecordDevices, _SelectSlideRecordPlayer[0], _SelectSlideRecordPlayer[1], _SelectSlideRecordPlayer[2], _SelectSlideRecordPlayer[3], _SelectSlideRecordPlayer[4], _SelectSlideRecordPlayer[5], _SelectSlideDelay };
_ThemeEqualizers = new string[] {_EqualizerPlayer[0], _EqualizerPlayer[1], _EqualizerPlayer[2], _EqualizerPlayer[3], _EqualizerPlayer[4], _EqualizerPlayer[5]};
}
public override void LoadTheme(string xmlPath)
{
base.LoadTheme(xmlPath);
int max = CSettings.MaxNumPlayer + 1;
if (max > 7)
max = 7;
_SelectSlides[_SelectSlideRecordChannel1].NumVisible = max;
_SelectSlides[_SelectSlideRecordChannel2].NumVisible = max;
_SelectSlides[_SelectSlideRecordChannel1].AddValue(CLanguage.Translate("TR_CONFIG_OFF"));
_SelectSlides[_SelectSlideRecordChannel2].AddValue(CLanguage.Translate("TR_CONFIG_OFF"));
for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
{
_SelectSlides[_SelectSlideRecordChannel1].AddValue(i.ToString());
_SelectSlides[_SelectSlideRecordChannel2].AddValue(i.ToString());
}
for (int i = 0; i < 26; i++)
_SelectSlides[_SelectSlideDelay].AddValue((i * 20) + " ms");
_ChannelEnergy = new float[_StaticEnergyChannel.Length];
_ChannelEnergy = new float[_StaticEnergyPlayer.Length];
for (int i = 0; i < _ChannelEnergy.Length; i++)
{
_Statics[_StaticEnergyChannel[i]].Visible = false;
_Statics[_StaticEnergyPlayer[i]].Visible = false;
_ChannelEnergy[i] = 0f;
}
}
@@ -151,27 +132,11 @@ namespace Vocaluxe.Screens
break;
case Keys.Left:
if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent();
if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
_SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig();
if (_SelectSlides[_SelectSlideDelay].Selected)
_SaveDelayConfig();
_SelectSlideAction();
break;
case Keys.Right:
if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent();
if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
_SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig();
if (_SelectSlides[_SelectSlideDelay].Selected)
_SaveDelayConfig();
_SelectSlideAction();
break;
}
}
@@ -190,15 +155,7 @@ namespace Vocaluxe.Screens
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
{
if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent();
if (_SelectSlides[_SelectSlideRecordChannel1].Selected ||
_SelectSlides[_SelectSlideRecordChannel2].Selected)
_SetMicConfig();
if (_SelectSlides[_SelectSlideDelay].Selected)
_SaveDelayConfig();
_SelectSlideAction();
if (_Buttons[_ButtonExit].Selected)
{
@@ -220,42 +177,32 @@ namespace Vocaluxe.Screens
if (_DelayTest.Running)
{
_DelayTest.Update();
_Texts[_TextDelayChannel1].Text = (_DelayTest.Delays[0] == 0) ? "???" : _DelayTest.Delays[0].ToString("000") + " ms";
_Texts[_TextDelayChannel2].Text = (_DelayTest.Delays[1] == 0) ? "???" : _DelayTest.Delays[1].ToString("000") + " ms";
for (int p = 0; p < CSettings.MaxNumPlayer; ++p)
_Texts[_TextDelayPlayer[p]].Text = (_DelayTest.Delays[p] == 0) ? "??? ms" : _DelayTest.Delays[p].ToString("000") + " ms";
}
if (_CheckMicConfig())
{
int player = _SelectSlides[_SelectSlideRecordChannel1].Selection - 1;
if (player >= 0)
for (int p = 0; p < CSettings.MaxNumPlayer; ++p)
{
_ChannelEnergy[0] = CRecord.GetMaxVolume(player);
_Equalizers[_EqualizerChannel1].Update(CRecord.ToneWeigth(player), CRecord.GetMaxVolume(player));
}
else
{
_ChannelEnergy[0] = 0f;
_Equalizers[_EqualizerChannel1].Reset();
}
player = _SelectSlides[_SelectSlideRecordChannel2].Selection - 1;
if (player >= 0)
{
_ChannelEnergy[1] = CRecord.GetMaxVolume(player);
_Equalizers[_EqualizerChannel2].Update(CRecord.ToneWeigth(player), CRecord.GetMaxVolume(player));
}
else
{
_ChannelEnergy[1] = 0f;
_Equalizers[_EqualizerChannel2].Reset();
if(_SelectSlides[_SelectSlideRecordPlayer[p]].Selection > 0)
{
_ChannelEnergy[p] = CRecord.GetMaxVolume(p);
_Equalizers[_EqualizerPlayer[p]].Update(CRecord.ToneWeigth(p), CRecord.GetMaxVolume(p));
}
else
{
_ChannelEnergy[p] = 0f;
_Equalizers[_EqualizerPlayer[p]].Reset();
}
}
}
else
{
for (int i = 0; i < _ChannelEnergy.Length; i++)
_ChannelEnergy[i] = 0f;
_Equalizers[_EqualizerChannel1].Reset();
_Equalizers[_EqualizerChannel2].Reset();
for (int p = 0; p < CSettings.MaxNumPlayer; ++p)
_Equalizers[_EqualizerPlayer[p]].Reset();
}
bool showWarning = !_CheckMicConfig();
@@ -288,9 +235,8 @@ namespace Vocaluxe.Screens
_UpdateChannels();
}
_SelectSlides[_SelectSlideRecordChannel1].Visible = _Devices != null;
_SelectSlides[_SelectSlideRecordChannel2].Visible = _Devices != null;
for (int p = 0; p < CSettings.MaxNumPlayer; ++p)
_SelectSlides[_SelectSlideRecordPlayer[p]].Visible = _Devices != null;
_Statics[_StaticWarning].Visible = false;
_Texts[_TextWarning].Visible = false;
@@ -309,17 +255,17 @@ namespace Vocaluxe.Screens
{
base.Draw();
for (int i = 0; i < _StaticEnergyChannel.Length; i++)
for (int i = 0; i < _StaticEnergyPlayer.Length; i++)
{
if (_ChannelEnergy[i] > 0f)
{
var rect = new SRectF(_Statics[_StaticEnergyChannel[i]].Rect.X,
_Statics[_StaticEnergyChannel[i]].Rect.Y,
_Statics[_StaticEnergyChannel[i]].Rect.W * _ChannelEnergy[i],
_Statics[_StaticEnergyChannel[i]].Rect.H,
_Statics[_StaticEnergyChannel[i]].Rect.Z);
var rect = new SRectF(_Statics[_StaticEnergyPlayer[i]].Rect.X,
_Statics[_StaticEnergyPlayer[i]].Rect.Y,
_Statics[_StaticEnergyPlayer[i]].Rect.W * _ChannelEnergy[i],
_Statics[_StaticEnergyPlayer[i]].Rect.H,
_Statics[_StaticEnergyPlayer[i]].Rect.Z);
CDraw.DrawTexture(_Statics[_StaticEnergyChannel[i]].Texture, _Statics[_StaticEnergyChannel[i]].Rect,
CDraw.DrawTexture(_Statics[_StaticEnergyPlayer[i]].Texture, _Statics[_StaticEnergyPlayer[i]].Rect,
new SColorF(1f, 1f, 1f, 1f), rect);
}
}
@@ -363,18 +309,14 @@ namespace Vocaluxe.Screens
foreach (CRecordDevice device in _Devices)
{
if (device.PlayerChannel1 > 0)
for (int ch = 0; ch < (uint)device.Channels; ++ch)
{
CConfig.Config.Record.MicConfig[device.PlayerChannel1 - 1].Channel = 1;
CConfig.Config.Record.MicConfig[device.PlayerChannel1 - 1].DeviceName = device.Name;
CConfig.Config.Record.MicConfig[device.PlayerChannel1 - 1].DeviceDriver = device.Driver;
}
if (device.PlayerChannel2 > 0)
{
CConfig.Config.Record.MicConfig[device.PlayerChannel2 - 1].Channel = 2;
CConfig.Config.Record.MicConfig[device.PlayerChannel2 - 1].DeviceName = device.Name;
CConfig.Config.Record.MicConfig[device.PlayerChannel2 - 1].DeviceDriver = device.Driver;
if (device.PlayerChannel[ch] > 0)
{
CConfig.Config.Record.MicConfig[device.PlayerChannel[ch] - 1].Channel = ch+1;
CConfig.Config.Record.MicConfig[device.PlayerChannel[ch] - 1].DeviceName = device.Name;
CConfig.Config.Record.MicConfig[device.PlayerChannel[ch] - 1].DeviceDriver = device.Driver;
}
}
}
CConfig.SaveConfig();
@@ -382,31 +324,62 @@ namespace Vocaluxe.Screens
CRecord.Start();
}
private void _SetPlayerColors()
{
_Texts[_TextChannel1].Color = _SelectSlides[_SelectSlideRecordChannel1].Selection <= 0
? new SColorF(1, 1, 1, 1) : CThemes.GetPlayerColor(_SelectSlides[_SelectSlideRecordChannel1].Selection);
_Texts[_TextChannel2].Color = _SelectSlides[_SelectSlideRecordChannel2].Selection <= 0
? new SColorF(1, 1, 1, 1) : CThemes.GetPlayerColor(_SelectSlides[_SelectSlideRecordChannel2].Selection);
}
private void _SetMicConfig()
{
if (_DeviceNr < 0)
return;
CRecordDevice device = _Devices[_DeviceNr];
device.PlayerChannel1 = _SelectSlides[_SelectSlideRecordChannel1].Selection;
device.PlayerChannel2 = _SelectSlides[_SelectSlideRecordChannel2].Selection;
_SetPlayerColors();
for (int ch = 0; ch < device.Channels; ++ch)
device.PlayerChannel[ch] = 0;
for (int p = 0; p < CSettings.MaxNumPlayer; ++p)
{
int ch = _SelectSlides[_SelectSlideRecordPlayer[p]].Selection;
if (ch > 0)
device.PlayerChannel[ch-1] = p+1;
}
}
private void _SelectSlideAction()
{
if (_SelectSlides[_SelectSlideRecordDevices].Selected)
_OnDeviceEvent();
for (int i = 0; i < _SelectSlideRecordPlayer.Length; ++i)
if (_SelectSlides[_SelectSlideRecordPlayer[i]].Selected)
_SetMicConfig();
if (_SelectSlides[_SelectSlideDelay].Selected)
_SaveDelayConfig();
}
private void _UpdateChannels()
{
_SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].PlayerChannel1;
_SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].PlayerChannel2;
int max = _Devices[_DeviceNr].Channels + 1;
for (int p = 0; p < CSettings.MaxNumPlayer; ++p)
{
_SelectSlides[_SelectSlideRecordPlayer[p]].Clear();
_SelectSlides[_SelectSlideRecordPlayer[p]].NumVisible = max;
_SelectSlides[_SelectSlideRecordPlayer[p]].AddValue(CLanguage.Translate("TR_CONFIG_OFF"));
}
for (int i = 1; i <= _Devices[_DeviceNr].Channels; ++i)
{
for (int p = 0; p < CSettings.MaxNumPlayer; ++p)
_SelectSlides[_SelectSlideRecordPlayer[p]].AddValue(i.ToString());
int pc = _Devices[_DeviceNr].PlayerChannel[i-1];
if (pc > 0)
{
_SelectSlides[_SelectSlideRecordPlayer[pc-1]].Selection = i;
}
}
_SaveMicConfig();
_SetPlayerColors();
}
private bool _CheckMicConfig()
@@ -420,20 +393,15 @@ namespace Vocaluxe.Screens
foreach (CRecordDevice device in _Devices)
{
if (device.PlayerChannel1 > 0)
for (int i = 0; i < device.Channels; ++i)
{
if (isSet[device.PlayerChannel1 - 1])
return false;
if (device.PlayerChannel[i] > 0)
{
if (isSet[device.PlayerChannel[i] - 1])
return false;
isSet[device.PlayerChannel1 - 1] = true;
}
if (device.PlayerChannel2 > 0)
{
if (isSet[device.PlayerChannel2 - 1])
return false;
isSet[device.PlayerChannel2 - 1] = true;
isSet[device.PlayerChannel[i] - 1] = true;
}
}
}
return true;
@@ -443,7 +411,7 @@ namespace Vocaluxe.Screens
{
_SaveMicConfig();
_DelayTest.Reset();
_DelayTest.Start(new int[] {_SelectSlides[_SelectSlideRecordChannel1].Selection - 1, _SelectSlides[_SelectSlideRecordChannel2].Selection - 1});
_DelayTest.Start(new int[] {0, 1, 2, 3, 4, 5});
}
private void _GetFirstConfiguredRecordDevice(ref int device)