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

39
LINES

< > BotCompany Repo | #1016940 // Voice Output v1 [Just the voice output dialog, Dyn Module]

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

Uses 206K of libraries. Click here for Pure Java version (15785L/113K).

!7

sclass VoiceOutput > DynTextArea {
  S voice;
  
  void start {
    if (empty(voice))
      setField(voice := first(cereprocVoices()));
  }
  
  JComponent visualize() {
    bindComboBoxToLiveValue_debug.set(true);
    JComponent c = super.visualize();
    enableWordWrapForTextArea(textArea);
    jPreemptEnterKey(textArea, rThread sayIt);
    ret centerAndSouthWithMargins(c,
      centerAndEastWithMarginInbetween(withLabel("Voice:", jLiveValueComboBox(cereprocVoices(), dm_fieldLiveValue('voice))),
        jbutton("Say", rThread sayIt)));
  }
  
  void say(S s) {
    {
      temp enter();
      setText(s);
    }
    sayIt();
  }
  
  void sayIt {
    S s = trim(getText());
    if (empty(s) || empty(voice)) ret;
    if (isCereprocVoice(voice))
      cereproc(voice, s);
    else
      print("Missing voice: " + voice);
  }

  void clear() { setText(""); }
}

Author comment

Began life as a copy of #1016614

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016940
Snippet name: Voice Output v1 [Just the voice output dialog, Dyn Module]
Eternal ID of this version: #1016940/2
Text MD5: 80740d648e186c91f9bab9251c9e21bf
Transpilation MD5: 2222fa0480ec8fe5f892e290a72bd1e3
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: 2018-07-09 13:01:47
Source code size: 909 bytes / 39 lines
Pitched / IR pitched: No / No
Views / Downloads: 335 / 430
Version history: 1 change(s)
Referenced in: [show references]