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

43
LINES

< > BotCompany Repo | #1020797 // Send Voice Output To Other Machine

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

Uses 911K of libraries. Click here for Pure Java version (12727L/70K).

1  
!7
2  
3  
cmodule VoiceOutput > DynTextArea {
4  
  S computerID;
5  
  bool enabled, printStackTraces;
6  
  
7  
  S switchableFields() { ret 'printStackTraces; }
8  
9  
  start {
10  
    dm_vmBus_answerToMessage('voiceOutputModule, func { dm_moduleID() });
11  
  }
12  
  
13  
  visualize {
14  
    JComponent ta = super.visualize();
15  
    enableWordWrapForTextArea(textArea);
16  
    onCtrlEnter(textArea, rThread sayIt);
17  
    ret centerAndSouthWithMargins(ta,
18  
      jvstackWithSpacing(
19  
        centerAndEastWithMargin(withLabel("Send to computer:", dm_fieldTextField('computerID)), jbutton("Say", rThread sayIt)),
20  
        dm_rightAlignedFieldCheckBox('enabled)));
21  
  }
22  
  
23  
  // API
24  
  
25  
  void say(S s) enter {
26  
    { lock lock; setText(s); }
27  
    if (printStackTraces) printStackTrace();
28  
    sayItIfEnabled();
29  
  }
30  
  
31  
  void sayItIfEnabled { if (enabled) sayIt(); }
32  
  
33  
  void sayIt enter {
34  
    if (!isComputerID(computerID)) ret;
35  
    S s = trim(getText());
36  
    if (empty(s)) ret;
37  
    dm_evalOnOtherMachine(computerID, "dm_say(" + quote(s) + ");");
38  
  }
39  
  
40  
  void clear() { setText(""); }
41  
  void setVoice(S voice) {}
42  
  void preload(S s) {}
43  
}

Author comment

Began life as a copy of #1016614

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020797
Snippet name: Send Voice Output To Other Machine
Eternal ID of this version: #1020797/9
Text MD5: 14f7cca0952abccab4c3291668659f6f
Transpilation MD5: 96249ee1165ed3be020166803d4fb200
Author: stefan
Category: javax / dynamic modules
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-17 13:58:05
Source code size: 1124 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 300 / 10591
Version history: 8 change(s)
Referenced in: [show references]