From 577859f25eb0ec9ddefc52807bc08f0bac054d26 Mon Sep 17 00:00:00 2001 From: Chi Kim Date: Thu, 7 May 2020 18:43:13 -0400 Subject: [PATCH] Added sound output dialog. --- VOCR.xcodeproj/project.pbxproj | 8 ++++---- VOCR/AppDelegate.swift | 24 ++++++++++++++++++++++-- readme.md | 20 +++++++++----------- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/VOCR.xcodeproj/project.pbxproj b/VOCR.xcodeproj/project.pbxproj index 0877b07..952b1dd 100644 --- a/VOCR.xcodeproj/project.pbxproj +++ b/VOCR.xcodeproj/project.pbxproj @@ -522,7 +522,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 9N598S2535; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -534,7 +534,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = "1.0.0-alpha"; + MARKETING_VERSION = "1.0.0-beta"; PRODUCT_BUNDLE_IDENTIFIER = com.chikim.VOCR; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -549,7 +549,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 9N598S2535; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -561,7 +561,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = "1.0.0-alpha"; + MARKETING_VERSION = "1.0.0-beta"; PRODUCT_BUNDLE_IDENTIFIER = com.chikim.VOCR; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; diff --git a/VOCR/AppDelegate.swift b/VOCR/AppDelegate.swift index e5d63a8..0c78fe4 100644 --- a/VOCR/AppDelegate.swift +++ b/VOCR/AppDelegate.swift @@ -1,5 +1,5 @@ import Cocoa - +import AudioKit @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { @@ -10,6 +10,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ notification: Notification) { let menu = NSMenu() + menu.addItem(withTitle: "Sound Output...", action: #selector(AppDelegate.chooseOutput(_:)), keyEquivalent: "") menu.addItem(withTitle: "About", action: #selector(AppDelegate.displayAboutWindow(_:)), keyEquivalent: "") menu.addItem(withTitle: "Quit", action: #selector(AppDelegate.quit(_:)), keyEquivalent: "") @@ -35,7 +36,26 @@ class AppDelegate: NSObject, NSApplicationDelegate { aboutWindowController.showWindow(nil) } } - + + @objc func chooseOutput(_ sender: Any?) { + let alert = NSAlert() + alert.alertStyle = .informational + alert.messageText = "Sound Output" + alert.informativeText = "Choose an Output for positional audio feedback." + if let devices = AudioKit.outputDevices { + for device in devices { + alert.addButton(withTitle: device.name) + } + } + let modalResult = alert.runModal() + let n = modalResult.rawValue-1000 + if AudioKit.engine.isRunning { + try! AudioKit.stop() + } + try! AudioKit.setOutputDevice(AudioKit.outputDevices![n]) + try! AudioKit.start() + } + @objc func click(_ sender: Any?) { print("Clicked") } diff --git a/readme.md b/readme.md index 0a76489..9d291b6 100644 --- a/readme.md +++ b/readme.md @@ -1,19 +1,16 @@ -# Welcome to VOCR -[![VOCR Demo on Youtube](https://img.youtube.com/vi/maBtR_6KDFs/0.jpg)](https://www.youtube.com/watch?v=maBtR_6KDFs) - -**WARNING**: USE AT YOUR OWN RISK! This is in alpha cycle. Many things may not work and change frequently without notice. - -If you're using earlier MacOS than Catalina 10.15, please use the older [VOCR with tesseract.](https://github.com/chigkim/VOCR/tree/tesseract) +# Welcome to VOCR +**WARNING**: USE AT YOUR OWN RISK! VOCR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, expressed or implied, of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Please see the [GNU General Public License](http://www.gnu.org/licenses/) for more details. -## ***HIGHLY EXPERIMENTAL*** This branch utilizes VisionKit on MacOS Catalina that take advantage of machine learning for OCR. This is a standalone app, and it does not rely on Keyboard Maestro, Imagemagick, and Tesseract that the previous VOCR utilized. +If you're using earlier MacOS than Catalina 10.15, please use the older [VOCR with tesseract.](https://github.com/chigkim/VOCR/tree/tesseract) + ## Download -Here is the direct link to download [VOCR v1.0.0-alpha.3.](https://github.com/chigkim/VOCR/releases/download/v1.0.0-alpha.3/VOCR.v1.0.0-alpha.3.zip) +Here is the direct link to download [VOCR v1.0.0-beta.1.](https://github.com/chigkim/VOCR/releases/download/v1.0.0-beta.1/VOCR.v1.0.0-beta.1.zip) ## Upgrade from Previous VOCR With Tesseract You can simply remove VOCR group from Keyboard Maestro and follow the instruction for setup below. @@ -53,7 +50,7 @@ If you want to verify if it works properly, search images on Google image using If everything goes well, VOCR will report the top 5 image categories in confidence order. If VOCR categorizes the image as a document, it will apply OCR. You can review the OCR result the same way as the section above, but this does not work with mouse movement. ## Settings -Positional audio (command+shift+control+p): As mouse cursor moves you will hear hear audio feedback. Frequency changes responds to vertical move, and pan responds to horizontal move. This feature is useful to explore the interface and discover elements' locations. +Positional audio (command+shift+control+p): As mouse cursor moves you will hear hear audio feedback. Frequency changes responds to vertical move, and pan responds to horizontal move. This feature is useful to explore the interface and discover elements' locations. If you don't hear the audio feedback, choose sound output for VOCR from menu extra. Disable/enable reset position (command+shift+control+r): When disabled, the cursor will not reset to the top left corner after every new scan. This feature is useful when you rescan the same window to find new change without losing previous cursor. @@ -72,9 +69,10 @@ The following shortcuts only works after a scan. * Go to beginning/end horizontally: command+control+left/right arrow * Exit navigation: escape * Save OCR result to file: command+shift+control+s - + ## Troubleshooting * If you hear "nothing found" or just hear the word "the", most likely either you need to turn off VoiceOver screen curtain with vo+shift+f11, or fix accessibility and screen recording permission in security and privacy preference. * If you do not hear anything after recognize image under VoiceOver cursor, most likely you need to give VOCR permissions to 1. send Apple Events, 2. control VoiceOver, and 3. access desktop folder. Usually relaunching VOCR and reissuing the command usually retrigger the alerts to reappear in the system dialogs. - + Lastly, please enjoy and send me your feedback! +