我已經創建了一個可以播放歌曲的程序,但是我無法讓它暫停/停止,當我再次單擊播放按鈕時,歌曲會一遍又一遍地循環播放。我怎樣才能讓歌曲暫停或停止? 這裏是我下面的源代碼,以播放歌曲: public void sound(String nm) {
AudioStream BGM; //Backround Music
try {
InputStream test = ne
我試圖播放.wav聲音每一個用戶按下一個按鈕,而是一個異常被拋出: Exception in thread "Thread-0" java.lang.IllegalArgumentException: Invalid format
at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.createStream(PulseAudioD
我正在研究遊戲的聲音代碼。我用的是下面的代碼: import java.io.*;
import java.net.URL;
import javax.sound.sampled.*;
/**
* This enum encapsulates all the sound effects of a game, so as to separate the sound playing
* c