From 7ae4f62ab65cc3a8c4fb5fdef40c0ed3e7d0f9aa Mon Sep 17 00:00:00 2001 From: Beingpax Date: Mon, 7 Apr 2025 17:52:58 +0545 Subject: [PATCH] Refactor: Prioritize recording start before showing UI --- VoiceInk.xcodeproj/project.pbxproj | 16 ++--- VoiceInk/Models/PredefinedModels.swift | 90 -------------------------- VoiceInk/Whisper/WhisperState+UI.swift | 10 +-- 3 files changed, 13 insertions(+), 103 deletions(-) diff --git a/VoiceInk.xcodeproj/project.pbxproj b/VoiceInk.xcodeproj/project.pbxproj index 78f1d25..619c3d5 100644 --- a/VoiceInk.xcodeproj/project.pbxproj +++ b/VoiceInk.xcodeproj/project.pbxproj @@ -7,8 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - E129E77B2D943393009322D9 /* whisper.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = E129E77A2D943393009322D9 /* whisper.xcframework */; }; - E129E77C2D943393009322D9 /* whisper.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E129E77A2D943393009322D9 /* whisper.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + E136D0112DA3EE57000E1E8A /* whisper.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = E136D0102DA3EE57000E1E8A /* whisper.xcframework */; }; + E136D0122DA3EE57000E1E8A /* whisper.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E136D0102DA3EE57000E1E8A /* whisper.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; E1A261122CC143AC00B233D1 /* KeyboardShortcuts in Frameworks */ = {isa = PBXBuildFile; productRef = E1A261112CC143AC00B233D1 /* KeyboardShortcuts */; }; E1ADD45A2CC5352A00303ECB /* LaunchAtLogin in Frameworks */ = {isa = PBXBuildFile; productRef = E1ADD4592CC5352A00303ECB /* LaunchAtLogin */; }; E1ADD45F2CC544F100303ECB /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = E1ADD45E2CC544F100303ECB /* Sparkle */; }; @@ -32,13 +32,13 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - E129E77D2D943393009322D9 /* Embed Frameworks */ = { + E136D00D2DA3EBE0000E1E8A /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( - E129E77C2D943393009322D9 /* whisper.xcframework in Embed Frameworks */, + E136D0122DA3EE57000E1E8A /* whisper.xcframework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -49,7 +49,7 @@ E11473B02CBE0F0A00318EE4 /* VoiceInk.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VoiceInk.app; sourceTree = BUILT_PRODUCTS_DIR; }; E11473C32CBE0F0B00318EE4 /* VoiceInkTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = VoiceInkTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; E11473CD2CBE0F0B00318EE4 /* VoiceInkUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = VoiceInkUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - E129E77A2D943393009322D9 /* whisper.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = whisper.xcframework; path = "../whisper.cpp/build-apple/whisper.xcframework"; sourceTree = ""; }; + E136D0102DA3EE57000E1E8A /* whisper.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = whisper.xcframework; path = "../Downloads/build-apple/whisper.xcframework"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ @@ -75,7 +75,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E129E77B2D943393009322D9 /* whisper.xcframework in Frameworks */, + E136D0112DA3EE57000E1E8A /* whisper.xcframework in Frameworks */, E1ADD45A2CC5352A00303ECB /* LaunchAtLogin in Frameworks */, E1ADD45F2CC544F100303ECB /* Sparkle in Frameworks */, E1A261122CC143AC00B233D1 /* KeyboardShortcuts in Frameworks */, @@ -123,7 +123,7 @@ E114741C2CBE1DE200318EE4 /* Frameworks */ = { isa = PBXGroup; children = ( - E129E77A2D943393009322D9 /* whisper.xcframework */, + E136D0102DA3EE57000E1E8A /* whisper.xcframework */, ); name = Frameworks; sourceTree = ""; @@ -138,7 +138,7 @@ E11473AC2CBE0F0A00318EE4 /* Sources */, E11473AD2CBE0F0A00318EE4 /* Frameworks */, E11473AE2CBE0F0A00318EE4 /* Resources */, - E129E77D2D943393009322D9 /* Embed Frameworks */, + E136D00D2DA3EBE0000E1E8A /* Embed Frameworks */, ); buildRules = ( ); diff --git a/VoiceInk/Models/PredefinedModels.swift b/VoiceInk/Models/PredefinedModels.swift index c01540a..b8c30b3 100644 --- a/VoiceInk/Models/PredefinedModels.swift +++ b/VoiceInk/Models/PredefinedModels.swift @@ -76,74 +76,6 @@ import Foundation ramUsage: 0.3, hash: "c78c86eb1a8faa21b369bcd33207cc90d64ae9df" ), - PredefinedModel( - name: "ggml-base", - displayName: "Base", - size: "142 MiB", - supportedLanguages: getLanguageDictionary(isMultilingual: true), - description: - "Base model, good balance of speed and accuracy, supports multiple languages", - speed: 0.8, - accuracy: 0.75, - ramUsage: 0.5, - hash: "465707469ff3a37a2b9b8d8f89f2f99de7299dac" - ), - PredefinedModel( - name: "ggml-base.en", - displayName: "Base (English)", - size: "142 MiB", - supportedLanguages: PredefinedModels.getLanguageDictionary(isMultilingual: false), - description: "Base model optimized for English, good balance of speed and accuracy", - speed: 0.8, - accuracy: 0.8, - ramUsage: 0.5, - hash: "137c40403d78fd54d454da0f9bd998f78703390c" - ), - PredefinedModel( - name: "ggml-small", - displayName: "Small", - size: "466 MiB", - supportedLanguages: getLanguageDictionary(isMultilingual: true), - description: - "Small model, slower but more accurate than base, supports multiple languages", - speed: 0.6, - accuracy: 0.85, - ramUsage: 0.7, - hash: "55356645c2b361a969dfd0ef2c5a50d530afd8d5" - ), - PredefinedModel( - name: "ggml-small.en", - displayName: "Small (English)", - size: "466 MiB", - supportedLanguages: PredefinedModels.getLanguageDictionary(isMultilingual: false), - description: "Small model optimized for English, slower but more accurate than base", - speed: 0.6, - accuracy: 0.9, - ramUsage: 0.7, - hash: "db8a495a91d927739e50b3fc1cc4c6b8f6c2d022" - ), - PredefinedModel( - name: "ggml-medium", - displayName: "Medium", - size: "1.5 GiB", - supportedLanguages: getLanguageDictionary(isMultilingual: true), - description: "Medium model, slow but very accurate, supports multiple languages", - speed: 0.4, - accuracy: 0.92, - ramUsage: 2.5, - hash: "fd9727b6e1217c2f614f9b698455c4ffd82463b4" - ), - PredefinedModel( - name: "ggml-medium.en", - displayName: "Medium (English)", - size: "1.5 GiB", - supportedLanguages: PredefinedModels.getLanguageDictionary(isMultilingual: false), - description: "Medium model optimized for English, slow but very accurate", - speed: 0.4, - accuracy: 0.95, - ramUsage: 2.0, - hash: "8c30f0e44ce9560643ebd10bbe50cd20eafd3723" - ), PredefinedModel( name: "ggml-large-v2", displayName: "Large v2", @@ -155,17 +87,6 @@ import Foundation ramUsage: 3.8, hash: "0f4c8e30f21cf1769f637135f521436792c48186" ), - PredefinedModel( - name: "ggml-large-v2-q5_0", - displayName: "Large v2 (Quantized)", - size: "1.1 GiB", - supportedLanguages: getLanguageDictionary(isMultilingual: true), - description: "Quantized version of Large v2, faster with slightly lower accuracy", - speed: 0.35, - accuracy: 0.95, - ramUsage: 1.5, - hash: "129fccc931774148e43113c57dd5a4e04891c04c" - ), PredefinedModel( name: "ggml-large-v3", displayName: "Large v3", @@ -177,17 +98,6 @@ import Foundation ramUsage: 3.9, hash: "ad82bf6a9043ceed055076d0fd39f5f186ff8062" ), - PredefinedModel( - name: "ggml-large-v3-q5_0", - displayName: "Large v3 (Quantized)", - size: "1.1 GiB", - supportedLanguages: getLanguageDictionary(isMultilingual: true, isLargeV3: true), - description: "Quantized version of Large v3, faster with slightly lower accuracy", - speed: 0.3, - accuracy: 0.97, - ramUsage: 1.5, - hash: "e6e2ed78495d403bef4b7cff42ef4aaadcfea8de" - ), PredefinedModel( name: "ggml-large-v3-turbo", displayName: "Large v3 Turbo", diff --git a/VoiceInk/Whisper/WhisperState+UI.swift b/VoiceInk/Whisper/WhisperState+UI.swift index 7691419..42b962d 100644 --- a/VoiceInk/Whisper/WhisperState+UI.swift +++ b/VoiceInk/Whisper/WhisperState+UI.swift @@ -43,12 +43,12 @@ extension WhisperState { } } else { SoundManager.shared.playStartSound() - - await MainActor.run { - isMiniRecorderVisible = true - } - + await toggleRecord() + + await MainActor.run { + isMiniRecorderVisible = true // This will call showRecorderPanel() via didSet + } } }