Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25
  1. #21
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Playing audio clips

    I know the sound doesn't play sometimes on my computer. I have no other computer to test it on. If there is no problem running it on another computer then I'm wasting everyone's time.

  2. #22
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default Re: Playing audio clips

    When there were overlapping calls to the play() method, sometimes a play of the sound was missed. When I added code to serialize the play using Semaphore and sleep() all the calls to play() made sounds.
    If you don't understand my response, don't ignore it, ask a question.

  3. #23
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Playing audio clips

    OK, thank you. I have made significant progress. I created a 1sec wav file to make it easier to hear the interruptions. From this I could clearly see that the AudioClip.play() method returns immediately. Which leads me to think that there's no need to run it on another thread (it creates it's own thread), please correct me if I'm wrong. I got rid of my new thread and it ran on the EDT with the same results as before.

    I could also see that sometimes the old sound was cleanly interrupted by the new one, but sometimes the new one just stopped the old one and the new one didn't play. So I put a sound.stop() before the sound.play() and, except when I try and make them play ridiculously fast, they never fail to play. This just leads me to ask one more question. Since play() appears to create its own new thread is it OK to call it on the EDT?

  4. #24
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default Re: Playing audio clips

    Since it returns immediately, it's probably OK.
    If you don't understand my response, don't ignore it, ask a question.

  5. #25
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Playing audio clips

    That's what I thought. Great then, thank you very much for you help!

Page 2 of 2 FirstFirst 12

Similar Threads

  1. playing wav files
    By treeface99 in forum New To Java
    Replies: 12
    Last Post: 02-07-2012, 12:12 PM
  2. Playing a WAV or MP3
    By meesterpickles in forum New To Java
    Replies: 7
    Last Post: 12-19-2011, 02:59 AM
  3. Video clips in side bar start playing automagically.
    By JosAH in forum Suggestions & Feedback
    Replies: 10
    Last Post: 05-26-2011, 09:01 AM
  4. Highlight text on playing audio
    By archanaanbu in forum Java Applets
    Replies: 1
    Last Post: 02-22-2011, 01:34 PM
  5. playing audio in J-App??
    By ashton in forum New To Java
    Replies: 3
    Last Post: 01-30-2009, 08:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •