This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem playing sound from application  RSS feed

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Playing sounds is usually done in applets, but using

import sun.audio.*;

We can play sounds..


When I start program, and call sound it works fine, but second time I call it nothing happens, my code is too large and complex to post, but I wondered if there was an obvious reason for this.

Thanks
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well it kinda seems like a sound is like a tape cassete.
Once you've played it, you have to rewind it before you can play it again,
so when I refresh the value it plays again, don't think this is the proper way to do it.

Any thoughts?
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well!!!
i think the reason explained by you is right but instead of refreshing
each time why dont you try the concept of EOF(End of File)......since you are using the AudoiPlayer but i am not familiar with it i have never triedi am not sure if this will be applicable to it or not..........what i can suggest is you start to play the file and it should play till the end of file....then later if you want it to play again just put it into loop...so that it is replayed.............i hope it will help you atlest to some extent....
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!