From 0ec18825ec89285aafb46c24f32505eef6f7da4c Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Tue, 22 Feb 2022 23:54:31 -0500 Subject: [PATCH] Send a message to indicate that all text has been typed. This allows the sender to pace things and reduce the amount of re-typing that is required if the recognizer is indecisive. --- .../xcschemes/xcschememanagement.plist | 8 ++++---- Listener/Readme.md | 1 - Listener/main.c | 17 +++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Listener.xcodeproj/xcuserdata/jrand.xcuserdatad/xcschemes/xcschememanagement.plist b/Listener.xcodeproj/xcuserdata/jrand.xcuserdatad/xcschemes/xcschememanagement.plist index c7e1312..3a48605 100644 --- a/Listener.xcodeproj/xcuserdata/jrand.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Listener.xcodeproj/xcuserdata/jrand.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,17 +7,17 @@ Archive.xcscheme_^#shared#^_ orderHint - 2 + 3 Binary.xcscheme_^#shared#^_ orderHint - 1 + 2 DiskImage.xcscheme_^#shared#^_ orderHint - 3 + 4 Listener.xcscheme_^#shared#^_ @@ -27,7 +27,7 @@ doNotBuild.xcscheme_^#shared#^_ orderHint - 4 + 1 diff --git a/Listener/Readme.md b/Listener/Readme.md index c74eb0d..6f08138 100644 --- a/Listener/Readme.md +++ b/Listener/Readme.md @@ -40,7 +40,6 @@ Start speaking. Best to speak slowly and clearly to get the best results. Voic There are a number of improvements to make: -* The speech dictation on iOS is often indecisive which leads to lots of backspacing and re-writing of text. There are a couple of things that can be done about this. First, I think the speech APIs provides a confidence value with the transcription so the app could ignore low quality speech and not send anything until iOS is more confident. Second, I could have the GS tell the app when it is ready for more text and in the meantime, if iOS has changed its mind about the text four or more times, it will only send the latest best transcription. * The iOS app needs to be "good enough" to pass Apple's review process. * Perhaps a Siri shortcut so you can just tell your phone to dictate to your GS without even starting the ListenerApp. * Maybe a mode where instead of dictating text, you can dictate commands like "close window", "copy" and "paste" and the right standard commands are sent as key strokes. diff --git a/Listener/main.c b/Listener/main.c index 9cfa58c..fed0351 100644 --- a/Listener/main.c +++ b/Listener/main.c @@ -37,6 +37,7 @@ #define LISTEN_STATE_MSG 1 #define LISTEN_TEXT_MSG 2 +#define LISTEN_SEND_MORE 3 #define WINDOW_CHAR_WIDTH 50 @@ -568,6 +569,14 @@ void sendKey(void) globals->textListHead = textList->header.next; free(textList); + + // If there is no more text to type, let the other end know we are ready for more. + if ((globals->textListHead == NULL) && + ((globals->state == LISTEN_STATE_AWAITING_TEXT) || + (globals->state == LISTEN_STATE_AWAITING_MSG_HEADER))) { + uint16_t msg = LISTEN_SEND_MORE; + TCPIPWriteTCP(globals->connIpid, (Pointer)&msg, sizeof(msg), FALSE, FALSE); + } } @@ -589,14 +598,6 @@ void HandleControl(EventRecord *event) void HandleKey(EventRecord *event) { -#if 0 - if (globals->winPtr != NULL) { - sprintf(globals->line1, "what = $%X", event->what); - sprintf(globals->line2, "message = $%lX", event->message); - sprintf(globals->line3, "modifiers = $%X", event->modifiers); - InvalidateWindow(); - } -#endif }