mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
#4094 - Various tweaks, bug fixes and improvements following code review.
This commit is contained in:
@@ -17,8 +17,6 @@
|
||||
import Foundation
|
||||
import AVFoundation
|
||||
|
||||
private let silenceThreshold: Float = -50.0
|
||||
|
||||
protocol VoiceMessageAudioRecorderDelegate: AnyObject {
|
||||
func audioRecorderDidStartRecording(_ audioRecorder: VoiceMessageAudioRecorder)
|
||||
func audioRecorderDidFinishRecording(_ audioRecorder: VoiceMessageAudioRecorder)
|
||||
@@ -31,6 +29,10 @@ enum VoiceMessageAudioRecorderError: Error {
|
||||
|
||||
class VoiceMessageAudioRecorder: NSObject, AVAudioRecorderDelegate {
|
||||
|
||||
private enum Constants {
|
||||
static let silenceThreshold: Float = -50.0
|
||||
}
|
||||
|
||||
private var audioRecorder: AVAudioRecorder?
|
||||
|
||||
var url: URL? {
|
||||
@@ -105,7 +107,7 @@ class VoiceMessageAudioRecorder: NSObject, AVAudioRecorderDelegate {
|
||||
}
|
||||
|
||||
private func normalizedPowerLevelFromDecibels(_ decibels: Float) -> Float {
|
||||
return decibels / silenceThreshold
|
||||
return decibels / Constants.silenceThreshold
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user