goxr3plus / java-stream-player

🌌Java Advanced Audio Controller Library (WAV, AU, AIFF, MP3, OGG VORBIS, FLAC, MONKEY's AUDIO and SPEEX audio formats )
GNU General Public License v3.0
147 stars 33 forks source link

Block main Thread #13

Closed Elikill58 closed 5 years ago

Elikill58 commented 5 years ago

Hello,

I have open a new Issue because it's a different problem. I have a JFrame, which contains button. When i click on the button, it play a sound. The problem is, when i click on a button and i click a second time, it wait the end of the sound to replay it. When i try to play only in a program (like "playSound(file) playSound(file)) it works.

Do you want some code ?

goxr3plus commented 5 years ago

There is a stop method in the Stream Player you can call it to immideately stop the player :)

goxr3plus commented 5 years ago

There are also pause and resume.

Elikill58 commented 5 years ago

I want to play multiple sound at the same time !

goxr3plus commented 5 years ago

You can create two instances of Stream Player

goxr3plus commented 5 years ago

Stream Player actually uses a different thread to play the audio. Create two instances and call play eith the given file for them.

Elikill58 commented 5 years ago

Yes, that just because i can't start the same sound two time at the same time. But, i have stop my projet now, maybe i will restart my projet soon.