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

23
LINES

< > BotCompany Repo | #1009559 // playWAVAndWait

JavaX fragment (include)

lib 1001094 // JavaLayer 1.0.1

import javazoom.jl.player.*;

static void playWAVAndWait(File wav) ctex {
  if (callService('playWAVAndWait, wav)) ret;
  S method = soundPlayMethod();
  if (eq(method, "aplay")) {
    print("Playing WAV (aplay)...");
    backtick("aplay " + bashQuote(wav));
  } else if (eq(method, "cmdmp3.exe")) {
    print("Playing WAV (cmdmp3.exe)...");
    backtick(winQuote(cmdmp3_exe()) + " " + winQuote(wav));
  } else {
    print("Playing WAV (JavaZoom), " + fileSize(wav) + " bytes...");
    final Player player = new Player(new FileInputStream(wav));
    player.play();
    repeat with sleep 10 {
      if (player.isComplete()) break;
    }
    player.close();
  }
}

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: 594 / 625
Version history: 13 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)