diff --git a/LiveKitExample-dev.xcworkspace/xcshareddata/swiftpm/Package.resolved b/LiveKitExample-dev.xcworkspace/xcshareddata/swiftpm/Package.resolved index 32b52b5..d45b628 100644 --- a/LiveKitExample-dev.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/LiveKitExample-dev.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "33f65a3cbc52f8c19295723af9cbecc2195484e1", - "version" : "3.5.0" + "revision" : "46072478ca365fe48370993833cb22de9b41567f", + "version" : "3.5.2" } }, { @@ -54,6 +54,15 @@ "version" : "1.0.0" } }, + { + "identity" : "swift-krisp-noise-filter", + "kind" : "remoteSourceControl", + "location" : "https://github.com/livekit/swift-krisp-noise-filter", + "state" : { + "revision" : "5c4608111033f1ac13edf64a335a1b9902c5496e", + "version" : "0.0.3" + } + }, { "identity" : "swift-log", "kind" : "remoteSourceControl", @@ -68,8 +77,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "9f0c76544701845ad98716f3f6a774a892152bcb", - "version" : "1.26.0" + "revision" : "e17d61f26df0f0e06f58f6977ba05a097a720106", + "version" : "1.27.1" } }, { @@ -77,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/livekit/webrtc-xcframework.git", "state" : { - "revision" : "5640582dbac33b193608574d4aa2a8d5d825db74", - "version" : "125.6422.2" + "revision" : "c0395fecffce2bc694835501aec11b17d793afaf", + "version" : "125.6422.4" } } ], diff --git a/LiveKitExample.xcodeproj/project.pbxproj b/LiveKitExample.xcodeproj/project.pbxproj index 02200e1..0fca838 100644 --- a/LiveKitExample.xcodeproj/project.pbxproj +++ b/LiveKitExample.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ 6867533C27A65652003707B9 /* AppContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6867533A27A65652003707B9 /* AppContext.swift */; }; 687230F82B14AE0A0098CCE6 /* PublishOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 687230F72B14AE0A0098CCE6 /* PublishOptionsView.swift */; }; 687230F92B14AE0A0098CCE6 /* PublishOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 687230F72B14AE0A0098CCE6 /* PublishOptionsView.swift */; }; + 687B93942BA7307D00FDD013 /* LiveKitKrispNoiseFilter in Frameworks */ = {isa = PBXBuildFile; productRef = 687B93932BA7307D00FDD013 /* LiveKitKrispNoiseFilter */; }; 68816CC127B4D6BC00E24622 /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = 68816CC027B4D6BC00E24622 /* KeychainAccess */; }; 68816CC327B4D94200E24622 /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = 68816CC227B4D94200E24622 /* KeychainAccess */; }; 68816CC527B4DCD500E24622 /* SecureStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68816CC427B4DCD500E24622 /* SecureStore.swift */; }; @@ -64,6 +65,16 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ + 683522152BA705A100FD50A9 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; 68EA18EB27F2E91100F9AE48 /* Embed Foundation Extensions */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -124,6 +135,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 687B93942BA7307D00FDD013 /* LiveKitKrispNoiseFilter in Frameworks */, 68FBA43F2A38B49C0015853E /* LiveKit in Frameworks */, 680FE2F227A8EF7700B6F6DB /* SFSafeSymbols in Frameworks */, 68816CC127B4D6BC00E24622 /* KeychainAccess in Frameworks */, @@ -283,6 +295,7 @@ 68B38540271E780700711D5F /* Frameworks */, 68B38541271E780700711D5F /* Resources */, 68EA18EB27F2E91100F9AE48 /* Embed Foundation Extensions */, + 683522152BA705A100FD50A9 /* Embed Frameworks */, ); buildRules = ( ); @@ -294,6 +307,7 @@ 680FE2F127A8EF7700B6F6DB /* SFSafeSymbols */, 68816CC027B4D6BC00E24622 /* KeychainAccess */, 68FBA43E2A38B49C0015853E /* LiveKit */, + 687B93932BA7307D00FDD013 /* LiveKitKrispNoiseFilter */, ); productName = "Multiplatform-SwiftUI (iOS)"; productReference = 68B38543271E780700711D5F /* LiveKitExample.app */; @@ -356,6 +370,7 @@ 680FE2F027A8EF7700B6F6DB /* XCRemoteSwiftPackageReference "SFSafeSymbols" */, 68816CBF27B4D6BC00E24622 /* XCRemoteSwiftPackageReference "KeychainAccess" */, 68FBA43D2A38B49C0015853E /* XCRemoteSwiftPackageReference "client-sdk-swift" */, + 68A4AEFC2C51E6A3001F3DA9 /* XCRemoteSwiftPackageReference "swift-krisp-noise-filter" */, ); productRefGroup = 68B38544271E780700711D5F /* Products */; projectDirPath = ""; @@ -839,6 +854,14 @@ minimumVersion = 4.2.2; }; }; + 68A4AEFC2C51E6A3001F3DA9 /* XCRemoteSwiftPackageReference "swift-krisp-noise-filter" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/livekit/swift-krisp-noise-filter"; + requirement = { + kind = exactVersion; + version = 0.0.3; + }; + }; 68FBA43D2A38B49C0015853E /* XCRemoteSwiftPackageReference "client-sdk-swift" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/livekit/client-sdk-swift"; @@ -868,6 +891,10 @@ isa = XCSwiftPackageProductDependency; productName = LiveKit; }; + 687B93932BA7307D00FDD013 /* LiveKitKrispNoiseFilter */ = { + isa = XCSwiftPackageProductDependency; + productName = LiveKitKrispNoiseFilter; + }; 68816CC027B4D6BC00E24622 /* KeychainAccess */ = { isa = XCSwiftPackageProductDependency; package = 68816CBF27B4D6BC00E24622 /* XCRemoteSwiftPackageReference "KeychainAccess" */; diff --git a/LiveKitExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/LiveKitExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index eb5392e..4291ccd 100644 --- a/LiveKitExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/LiveKitExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "bf59b79f5d4ea0a54ef7e929b035c5821f5094ee990a7a369ad0cb3713f6c62d", + "originHash" : "d4d1ddd5dbcd10b536e607b5cee6e6e561f9e6b49a06ae90e7bc0ed8971f7540", "pins" : [ { "identity" : "client-sdk-swift", @@ -28,6 +28,15 @@ "version" : "5.3.0" } }, + { + "identity" : "swift-krisp-noise-filter", + "kind" : "remoteSourceControl", + "location" : "https://github.com/livekit/swift-krisp-noise-filter", + "state" : { + "revision" : "5c4608111033f1ac13edf64a335a1b9902c5496e", + "version" : "0.0.3" + } + }, { "identity" : "swift-log", "kind" : "remoteSourceControl", @@ -42,8 +51,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "9f0c76544701845ad98716f3f6a774a892152bcb", - "version" : "1.26.0" + "revision" : "e17d61f26df0f0e06f58f6977ba05a097a720106", + "version" : "1.27.1" } }, { diff --git a/Shared/Controllers/AppContext.swift b/Shared/Controllers/AppContext.swift index 51b4c4a..8ffcf96 100644 --- a/Shared/Controllers/AppContext.swift +++ b/Shared/Controllers/AppContext.swift @@ -18,6 +18,10 @@ import Combine import LiveKit import SwiftUI +#if os(iOS) + import LiveKitKrispNoiseFilter +#endif + // This class contains the logic to control behavior of the whole app. final class AppContext: ObservableObject { private let store: ValueStore @@ -66,6 +70,18 @@ final class AppContext: ObservableObject { didSet { AudioManager.shared.isSpeakerOutputPreferred = preferSpeakerOutput } } + #if os(iOS) + // Krisp noise filter example + lazy var krispProcessor = LiveKitKrispNoiseFilter() + + @Published var isKrispEnabled: Bool = false { + didSet { + // Runtime toggling of audio processor + krispProcessor.isEnabled = isKrispEnabled + } + } + #endif + public init(store: ValueStore) { self.store = store @@ -86,5 +102,9 @@ final class AppContext: ObservableObject { self.inputDevice = audioManager.inputDevice } } + + #if os(iOS) + AudioManager.shared.capturePostProcessingDelegate = krispProcessor + #endif } } diff --git a/Shared/LiveKitExample.swift b/Shared/LiveKitExample.swift index bf7f9d8..000176b 100644 --- a/Shared/LiveKitExample.swift +++ b/Shared/LiveKitExample.swift @@ -76,6 +76,12 @@ struct RoomContextView: View { .environmentObject(roomCtx.room) .environment(\.colorScheme, .dark) .foregroundColor(Color.white) + .onAppear { + #if os(iOS) + // Attach RoomDelegate to KrispProcessor + roomCtx.room.add(delegate: appCtx.krispProcessor) + #endif + } .onDisappear { print("\(String(describing: type(of: self))) onDisappear") Task { diff --git a/Shared/RoomView.swift b/Shared/RoomView.swift index 10394c4..6329ce7 100644 --- a/Shared/RoomView.swift +++ b/Shared/RoomView.swift @@ -589,6 +589,9 @@ struct RoomView: View { Toggle("Prefer speaker output", isOn: $appCtx.preferSpeakerOutput) Toggle("E2EE enabled", isOn: $roomCtx.isE2eeEnabled) + #if os(iOS) + Toggle("Krisp Audio Filter Enabled", isOn: $appCtx.isKrispEnabled) + #endif } } label: {