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).

!7

cmodule VoiceOutput > DynTextArea {
  S computerID;
  bool enabled, printStackTraces;
  
  S switchableFields() { ret 'printStackTraces; }

  start {
    dm_vmBus_answerToMessage('voiceOutputModule, func { dm_moduleID() });
  }
  
  visualize {
    JComponent ta = super.visualize();
    enableWordWrapForTextArea(textArea);
    onCtrlEnter(textArea, rThread sayIt);
    ret centerAndSouthWithMargins(ta,
      jvstackWithSpacing(
        centerAndEastWithMargin(withLabel("Send to computer:", dm_fieldTextField('computerID)), jbutton("Say", rThread sayIt)),
        dm_rightAlignedFieldCheckBox('enabled)));
  }
  
  // API
  
  void say(S s) enter {
    { lock lock; setText(s); }
    if (printStackTraces) printStackTrace();
    sayItIfEnabled();
  }
  
  void sayItIfEnabled { if (enabled) sayIt(); }
  
  void sayIt enter {
    if (!isComputerID(computerID)) ret;
    S s = trim(getText());
    if (empty(s)) ret;
    dm_evalOnOtherMachine(computerID, "dm_say(" + quote(s) + ");");
  }
  
  void clear() { setText(""); }
  void setVoice(S voice) {}
  void preload(S s) {}
}

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: 238 / 10508
Version history: 8 change(s)
Referenced in: [show references]