Add method to set and get volume thresholds
This commit is contained in:
1 parent
0e2b968072
commit
6913a1f7b9
3 files changed
+41
-2
No files matched your search
@@ -96,6 +96,16 @@ namespace Vocaluxe.Base
|
||||
return _Record.GetMaxVolume(player);
|
||||
}
|
||||
|
||||
public static float GetVolumeThreshold(int player)
|
||||
{
|
||||
return _Record.GetVolumeThreshold(player);
|
||||
}
|
||||
|
||||
public static void SetVolumeThreshold(int player, float threshold)
|
||||
{
|
||||
_Record.SetVolumeThreshold(player, threshold);
|
||||
}
|
||||
|
||||
public static int NumHalfTones(int player)
|
||||
{
|
||||
return _Record.NumHalfTones();
|
||||
|
||||
@@ -5,7 +5,7 @@ using Vocaluxe.Base;
|
||||
namespace Vocaluxe.Lib.Sound.Record
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class to implement common functionality for Record classes
|
||||
/// Base class to implement common functionality for Record classes
|
||||
/// </summary>
|
||||
abstract class CRecordBase
|
||||
{
|
||||
@@ -53,7 +53,7 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Procedure to be called by descendent classes with data that got recorded
|
||||
/// Procedure to be called by descendent classes with data that got recorded
|
||||
/// </summary>
|
||||
/// <param name="device">Device from which the data was recorded</param>
|
||||
/// <param name="data">Recorded samples, assume Int16 and interleaved for multi-channels</param>
|
||||
@@ -125,6 +125,19 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
return _Initialized ? _Buffer[player].MaxVolume : 0f;
|
||||
}
|
||||
|
||||
public float GetVolumeThreshold(int player)
|
||||
{
|
||||
return _Initialized ? _Buffer[player].VolTreshold : 0f;
|
||||
}
|
||||
|
||||
public void SetVolumeThreshold(int player, float threshold)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
|
||||
_Buffer[player].VolTreshold = threshold;
|
||||
}
|
||||
|
||||
public bool ToneValid(int player)
|
||||
{
|
||||
return _Initialized && _Buffer[player].ToneValid;
|
||||
|
||||
@@ -118,6 +118,22 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
/// <returns>Maximum volume between 0 and 1</returns>
|
||||
float GetMaxVolume(int player);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the treshold for detecting silence
|
||||
/// Value (0-1) for which everything below is considered silence
|
||||
/// <param name="player">0-based player index</param>
|
||||
/// <returns>Threshold</returns>
|
||||
/// </summary>
|
||||
float GetVolumeThreshold(int player);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the treshold for detecting silence
|
||||
/// Value (0-1) for which everything below is considered silence
|
||||
/// <param name="player">0-based player index</param>
|
||||
/// <param name="threshold">Threshold</param>
|
||||
/// </summary>
|
||||
void SetVolumeThreshold(int player, float threshold);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the current tone is valid. That includes, if maximum volume is higher than the threshold
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user