AmbientNoiseMonitor
public class AmbientNoiseMonitor
The AmbientNoiseMonitor
class is used to monitor the ambient noise level in an environment to determine whether
or not the conditions are sufficient for a lung function measurement.
-
The object that acts as the delegate of the monitor.
Declaration
Swift
public weak var delegate: AmbientNoiseMonitorDelegate?
-
Indicates whether the ambient noise level is below or above the allowed threshold.
Declaration
Swift
public fileprivate(set) var isBelowThreshold: Bool = true
-
Indicates whether the monitor is active or not.
Declaration
Swift
public fileprivate(set) var isActive = false
-
Initializes an instance of the
AmbientNoiseMonitor
class.Declaration
Swift
public init()
-
Starts measuring the ambient noise level.
Throws
AmbientNoiseMonitorError.microphonePermissionDenied
if the user denys permission to access the microphone.Throws
AmbientNoiseMonitorError.recorderConfigurationError
if any errors occur while configuring the audio session.Declaration
Swift
public func start(completion: @escaping (Error?) -> Void)
-
Stops measuring the ambient noise level.
Declaration
Swift
public func stop()