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

27
LINES

< > BotCompany Repo | #1026782 // AI Sounds

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

Uses 1796K of libraries. Click here for Pure Java version (12083L/65K).

1  
!7
2  
3  
// TODO: volume
4  
5  
concept Sound {
6  
  S name, dataID;
7  
}
8  
9  
cmodule AISounds > DynCRUD<Sound> {
10  
  afterVisualize {
11  
    addSelectionDependentButton("Play", rThread {
12  
      playSound(selected());
13  
    });
14  
  }
15  
  
16  
  // API
17  
  
18  
  void playSound(Sound sound) {
19  
    if (sound == null) ret;
20  
    print("Playing sound: " + sound.name);
21  
    playAudioFile(loadLibrary(sound.dataID));
22  
  }
23  
  
24  
  void playSound(S soundName) {
25  
    playSound(random(conceptsWhereCI Sound(name := soundName)));
26  
  }
27  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1026782
Snippet name: AI Sounds
Eternal ID of this version: #1026782/8
Text MD5: 9efdc6fa344468038f5cf6156267f956
Transpilation MD5: 59d4ec3db9f3dd2f494b6f0d164a6396
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-22 14:44:25
Source code size: 503 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 218 / 757
Version history: 7 change(s)
Referenced in: [show references]