Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

59
LINES

< > BotCompany Repo | #1016461 // Katze [Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (14842L/104K).

1  
!7
2  
3  
set flag NoAI.
4  
5  
sclass Katze extends DynModule {
6  
  transient O catModule;
7  
  transient S imageID = #1101205;
8  
  
9  
  JComponent visualize() {
10  
    ret withBottomMargin(centerAndSouth(
11  
      centerPart(),
12  
      buttons()));
13  
  }
14  
  
15  
  JComponent centerPart() {
16  
    ret jimage(imageID);
17  
  }
18  
  
19  
  JComponent buttons() {
20  
    ret vstack2(
21  
      withMargin(jcenteredbutton("Start Listening", rThread startListening)),
22  
      jcenteredbutton("Stop Listening", rThread stopListening));
23  
  }
24  
  
25  
  bool loadCat() {
26  
    if (catModule == null && !hasBot("Chrome Speech."))
27  
      ret true with actuallyLoadCat();
28  
    false;
29  
  }
30  
  
31  
  void actuallyLoadCat {
32  
    catModule = runDependent(#1013936);
33  
  }
34  
  
35  
  void listenJustOnce {
36  
    print('listenJustOnce);
37  
    temp enter();
38  
    loadCat();
39  
    send("Chrome Speech.", "just once");
40  
  }
41  
  
42  
  void startListening {
43  
    print('startListening);
44  
    temp enter();
45  
    if (!loadCat())
46  
      send("Chrome Speech.", "start recognition");
47  
  }
48  
  
49  
  void stopListening {
50  
    temp enter();
51  
    sendOpt("Chrome Speech.", "stop recognition");
52  
  }
53  
  
54  
  start {
55  
    dm_putRecognizedSpeechInAIBar();
56  
  }
57  
  
58  
  void cleanMeUp_katze { cleanUp(catModule); catModule = null; }
59  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1016461
Snippet name: Katze [Dyn Module]
Eternal ID of this version: #1016461/34
Text MD5: 7a74ee8988e87be940714af032e40020
Transpilation MD5: 0e6842575f393bff9b71ad1cc3aef2f6
Author: stefan
Category: javax / speech
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-05 13:48:03
Source code size: 1243 bytes / 59 lines
Pitched / IR pitched: No / No
Views / Downloads: 621 / 15552
Version history: 33 change(s)
Referenced in: [show references]