diff --git a/Vocaluxe/Base/CRecord.cs b/Vocaluxe/Base/CRecord.cs index 97b9bf16..43c8f099 100644 --- a/Vocaluxe/Base/CRecord.cs +++ b/Vocaluxe/Base/CRecord.cs @@ -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(); diff --git a/Vocaluxe/Lib/Sound/Record/CRecordBase.cs b/Vocaluxe/Lib/Sound/Record/CRecordBase.cs index 5dd64987..62c67da7 100644 --- a/Vocaluxe/Lib/Sound/Record/CRecordBase.cs +++ b/Vocaluxe/Lib/Sound/Record/CRecordBase.cs @@ -5,7 +5,7 @@ using Vocaluxe.Base; namespace Vocaluxe.Lib.Sound.Record { /// - /// Base class to implement common functionality for Record classes + /// Base class to implement common functionality for Record classes /// abstract class CRecordBase { @@ -53,7 +53,7 @@ namespace Vocaluxe.Lib.Sound.Record } /// - /// Procedure to be called by descendent classes with data that got recorded + /// Procedure to be called by descendent classes with data that got recorded /// /// Device from which the data was recorded /// Recorded samples, assume Int16 and interleaved for multi-channels @@ -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; diff --git a/Vocaluxe/Lib/Sound/Record/IRecord.cs b/Vocaluxe/Lib/Sound/Record/IRecord.cs index 709a77df..7f020daa 100644 --- a/Vocaluxe/Lib/Sound/Record/IRecord.cs +++ b/Vocaluxe/Lib/Sound/Record/IRecord.cs @@ -118,6 +118,22 @@ namespace Vocaluxe.Lib.Sound.Record /// Maximum volume between 0 and 1 float GetMaxVolume(int player); + /// + /// Gets the treshold for detecting silence + /// Value (0-1) for which everything below is considered silence + /// 0-based player index + /// Threshold + /// + float GetVolumeThreshold(int player); + + /// + /// Sets the treshold for detecting silence + /// Value (0-1) for which everything below is considered silence + /// 0-based player index + /// Threshold + /// + void SetVolumeThreshold(int player, float threshold); + /// /// Returns whether the current tone is valid. That includes, if maximum volume is higher than the threshold ///