• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sounds

 
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using a sound manager class that looks as follows:



The strange thing is that for arrow.wav and cannonball.wav (two short sounds, <3 seconds), it works fine. However, for doom.wav ( a longer sound, about 4 minutes ), it seems to keep starting the sound over and over again, so you get a mash of 100 versions of it playing at once. Whyzat?

Thanks,
Nick

I picked the applets forum because this is a method of applets, if there's a better forum, feel free to move.
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might try using Thread.sleep to pause the application for a number of seconds after you start playing a sound.
 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No dice.

I picked a song that has an opening noise, and then relative silence, so I know that the song keeps starting, and isn't just really fuzzy.

Thanks
 
Keith Lynn
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried playing it through an applet to test the file?
 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know beans about applets, never made one in me life.

Honestly, I don't even really think it's an Applets question, I wonder if people will be annoyed if Icrosspost
[ April 16, 2006: Message edited by: Nick George ]
 
Keith Lynn
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This would be the code for the appplet.



Compile the class and then load this HTML file in a browser or appletviewer.



Where you place the name of the sound you want to play as the value in the param tag.

Note that in this example, the sound file should be in the same directory as the .class file and HTML file.
 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, but I'm not planning on going down the applet path... is that just for testing purposes?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to Java in General (intermediate) at author's request.
 
Keith Lynn
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The applet will let you test the files to see if they do the same thing as they do when you play them in an application.
 
reply
    Bookmark Topic Watch Topic
  • New Topic