Hello all,
I have small sized mp3 files that i can play via Java using JLayerPlayer that takes the address of mp3 files , JLayerPlayer objects can be played creating threads and starting. The problem is when i have for example 9 sounds and i want it them to play in consecutively , so i put them in for loop like:
for(int i=1;i<mainNotaL ist.size()+1;i+ +)
{
neyBox1.arrange NeyImage(mainNo taList.get(i-1));
showNames(mainN otaList.get(i-1));
txtAciklama.set Text(mainNotaLi st.get(i-1).getAciklama( ));
Thread currentThread=n ew Thread(mainNota List.get(i-1).getSoundLaye r());
porteImgs[i].activate();
currentThread.s tart();
try {
currentThread.j oin();
} catch (InterruptedExc eption ex) {
Logger.getLogge r(Ney1View.clas s.getName()).lo g(Level.SEVERE, null, ex);
}
}
This codes starts and plays the sound consecutively but
this codes
neyBox1.arrange NeyImage(mainNo taList.get(i-1));
showNames(mainN otaList.get(i-1));
txtAciklama.set Text(mainNotaLi st.get(i-1).getAciklama( ));
are not being executed sync with the sound. they all are executed after all the sounds are played. How can i execute this codes first then play one sound, execute this codes play one sound...
I am new to java and the project due is this week , Desperately need solution.
Every suggestion helps. Thanks.
I have small sized mp3 files that i can play via Java using JLayerPlayer that takes the address of mp3 files , JLayerPlayer objects can be played creating threads and starting. The problem is when i have for example 9 sounds and i want it them to play in consecutively , so i put them in for loop like:
for(int i=1;i<mainNotaL ist.size()+1;i+ +)
{
neyBox1.arrange NeyImage(mainNo taList.get(i-1));
showNames(mainN otaList.get(i-1));
txtAciklama.set Text(mainNotaLi st.get(i-1).getAciklama( ));
Thread currentThread=n ew Thread(mainNota List.get(i-1).getSoundLaye r());
porteImgs[i].activate();
currentThread.s tart();
try {
currentThread.j oin();
} catch (InterruptedExc eption ex) {
Logger.getLogge r(Ney1View.clas s.getName()).lo g(Level.SEVERE, null, ex);
}
}
This codes starts and plays the sound consecutively but
this codes
neyBox1.arrange NeyImage(mainNo taList.get(i-1));
showNames(mainN otaList.get(i-1));
txtAciklama.set Text(mainNotaLi st.get(i-1).getAciklama( ));
are not being executed sync with the sound. they all are executed after all the sounds are played. How can i execute this codes first then play one sound, execute this codes play one sound...
I am new to java and the project due is this week , Desperately need solution.
Every suggestion helps. Thanks.
Comment