Files
Mastermind/native/MastermindPOC/Sources/MastermindPOCCore/AudioPipelineStats.swift
T

25 lines
844 B
Swift

public struct AudioPipelineStats: Equatable {
public private(set) var microphoneFrames: Int
public private(set) var microphoneBytes: Int
public private(set) var systemFrames: Int
public private(set) var systemBytes: Int
public init(microphoneFrames: Int = 0, microphoneBytes: Int = 0, systemFrames: Int = 0, systemBytes: Int = 0) {
self.microphoneFrames = microphoneFrames
self.microphoneBytes = microphoneBytes
self.systemFrames = systemFrames
self.systemBytes = systemBytes
}
public mutating func recordFrame(source: AudioSource, byteCount: Int) {
switch source {
case .microphone:
microphoneFrames += 1
microphoneBytes += byteCount
case .system:
systemFrames += 1
systemBytes += byteCount
}
}
}