Decrease threshold for delay test
This commit is contained in:
1 parent
6913a1f7b9
commit
c31050926d
1 file changed
+24
-10
@@ -15,6 +15,7 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Vocaluxe.Base;
|
||||
|
||||
@@ -26,6 +27,7 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
{
|
||||
public int Channel;
|
||||
public bool Finished;
|
||||
public float OrigThreshold;
|
||||
}
|
||||
|
||||
private const float _MaxDelayTime = 1000;
|
||||
@@ -51,24 +53,39 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
Reset();
|
||||
for (int i = 0; i < _DelaysChannel.Length; i++)
|
||||
{
|
||||
if (i < channels.Length)
|
||||
if (i < channels.Length && channels[i] >= 0)
|
||||
{
|
||||
_DelaysChannel[i].Finished = false;
|
||||
_DelaysChannel[i].Channel = channels[i];
|
||||
_DelaysChannel[i].OrigThreshold = CRecord.GetVolumeThreshold(channels[i]);
|
||||
CRecord.SetVolumeThreshold(channels[i], _DelaysChannel[i].OrigThreshold / 3);
|
||||
}
|
||||
else
|
||||
_DelaysChannel[i].Finished = true;
|
||||
_DelaysChannel[i].Channel = -1;
|
||||
}
|
||||
_Stream = CSound.PlaySound(ESounds.T440, false);
|
||||
Running = true;
|
||||
}
|
||||
|
||||
private void _Stop()
|
||||
{
|
||||
if (!Running)
|
||||
return;
|
||||
Running = false;
|
||||
_Timer.Stop();
|
||||
_CloseStream();
|
||||
foreach (SDelayChannel delay in _DelaysChannel)
|
||||
{
|
||||
if (delay.Channel >= 0)
|
||||
CRecord.SetVolumeThreshold(delay.Channel, delay.OrigThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Running = false;
|
||||
_Stop();
|
||||
for (int i = 0; i < _DelaysChannel.Length; i++)
|
||||
Delays[i] = 0;
|
||||
_CloseStream();
|
||||
}
|
||||
|
||||
private void _CloseStream()
|
||||
@@ -99,21 +116,18 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
{
|
||||
if (_DelaysChannel[i].Channel < 0 || _DelaysChannel[i].Finished)
|
||||
continue;
|
||||
if (CRecord.GetMaxVolume(_DelaysChannel[i].Channel) > 0.1f && CRecord.GetTone(_DelaysChannel[i].Channel) == 9)
|
||||
if (CRecord.GetTone(_DelaysChannel[i].Channel) == 9)
|
||||
{
|
||||
Delays[i] = (int)_Timer.ElapsedMilliseconds;
|
||||
_DelaysChannel[i].Finished = true;
|
||||
}
|
||||
else
|
||||
isActive = true;
|
||||
Console.WriteLine(CRecord.GetMaxVolume(_DelaysChannel[i].Channel));
|
||||
}
|
||||
}
|
||||
if (!isActive)
|
||||
{
|
||||
Running = false;
|
||||
_CloseStream();
|
||||
_Timer.Stop();
|
||||
}
|
||||
_Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user