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

23
LINES

< > BotCompany Repo | #1009559 // playWAVAndWait

JavaX fragment (include)

1  
lib 1001094 // JavaLayer 1.0.1
2  
3  
import javazoom.jl.player.*;
4  
5  
static void playWAVAndWait(File wav) ctex {
6  
  if (callService('playWAVAndWait, wav)) ret;
7  
  S method = soundPlayMethod();
8  
  if (eq(method, "aplay")) {
9  
    print("Playing WAV (aplay)...");
10  
    backtick("aplay " + bashQuote(wav));
11  
  } else if (eq(method, "cmdmp3.exe")) {
12  
    print("Playing WAV (cmdmp3.exe)...");
13  
    backtick(winQuote(cmdmp3_exe()) + " " + winQuote(wav));
14  
  } else {
15  
    print("Playing WAV (JavaZoom), " + fileSize(wav) + " bytes...");
16  
    final Player player = new Player(new FileInputStream(wav));
17  
    player.play();
18  
    repeat with sleep 10 {
19  
      if (player.isComplete()) break;
20  
    }
21  
    player.close();
22  
  }
23  
}

Author comment

Began life as a copy of #1003613

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1009559
Snippet name: playWAVAndWait
Eternal ID of this version: #1009559/14
Text MD5: 1e998d087eccf694ff080e50ad6776db
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-12 15:15:08
Source code size: 715 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 595 / 626
Version history: 13 change(s)
Referenced in: [show references]