AudioTee Swift CLI repo

This commit is contained in:
Nick Payne
2025-06-11 15:33:40 +01:00
commit 4a8bc657e3
26 changed files with 1559 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
import Foundation
// Unified message types for all AudioTee output
public enum MessageType: String, Codable {
// Stream lifecycle
case metadata
case streamStart = "stream_start"
case streamStop = "stream_stop"
// Audio data
case audio
// Logging
case info
case error
case debug
}
// Base message envelope that wraps all outputs
public struct Message<T: Codable>: Codable {
public let timestamp: Date
public let type: MessageType
public let data: T?
public enum CodingKeys: String, CodingKey {
case timestamp
case type = "message_type"
case data
}
public init(type: MessageType, data: T? = nil) {
self.timestamp = Date()
self.type = type
self.data = data
}
}
// Simple log data for logging messages
public struct LogData: Codable {
public let message: String
public let context: [String: String]?
public init(message: String, context: [String: String]? = nil) {
self.message = message
self.context = context
}
}