posted 12 years ago
Hi all,
I'm fairly new to this so I hope I've posted this to the correct place.
I'm completing a project where a user gets to press a few buttons and they will see a waveform change and hear the amplitude of a sound increase or decrease. To get the sounds to play I'm using javax.sound.sampled.*
My code is as follows (the buttons the user presses are in a seperate GUI built class):-
The actual sounds are 10 seconds long so I want them to loop continuously until the user either increases or decreases the amplitude.
All my code is working fine. However, the problem I'm having is that everytime the user clicks the increase amplitude button and calls the playSound method, a new audio line gets opened and the sounds play at the same time.
Is there a way I can close all existing audio lines before a new one is opened? I've been looking for a couple of hours now but am getting more and more frustrated/confused.
Any help would be much appreciated.
Al.