mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
#4096 - Added locked mode transition and animations, locked recording mode and real time waveform.
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
import Foundation
|
||||
import AVFoundation
|
||||
|
||||
private let silenceThreshold: Float = -50.0
|
||||
|
||||
protocol VoiceMessageAudioRecorderDelegate: AnyObject {
|
||||
func audioRecorderDidStartRecording(_ audioRecorder: VoiceMessageAudioRecorder)
|
||||
func audioRecorderDidFinishRecording(_ audioRecorder: VoiceMessageAudioRecorder)
|
||||
@@ -104,11 +106,7 @@ class VoiceMessageAudioRecorder: NSObject, AVAudioRecorderDelegate {
|
||||
}
|
||||
|
||||
private func normalizedPowerLevelFromDecibels(_ decibels: Float) -> Float {
|
||||
if decibels < -60.0 || decibels == 0.0 {
|
||||
return 0.0
|
||||
}
|
||||
|
||||
return powf((powf(10.0, 0.05 * decibels) - powf(10.0, 0.05 * -60.0)) * (1.0 / (1.0 - powf(10.0, 0.05 * -60.0))), 1.0 / 2.0)
|
||||
return decibels / silenceThreshold
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user