The Artima Developer Community
Sponsored Link

Java Answers Forum
Problem with JMF: playing .wav files

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
brian duffy

Posts: 1
Nickname: brianduffy
Registered: Mar, 2003

Problem with JMF: playing .wav files Posted: Mar 10, 2003 6:59 AM
Reply to this message Reply
Advertisement
Hello, any help at all greatly appreciated.

I need a dead-certain way of playing sounds with my java application.
Java media player doesn't seem to be working with sound files with a duration of longer than 30 seconds.

I need a way of accessing the windows sound API from inside my java app.

I have a method that gets passed filenames and plays those files.
The problem is, when I pass a .wav file that's 30 seconds long - it oftentimes fails to play the file completely.

I think that it's somethin to do with the file being context switched out and losing the processor - so I need a solution.

The code shown below works fine - with short (1 second) sound clips - but not so with any that last 30 seconds.

I'm programming on windows - and could do with some advice..



Here's the code:

public void playSound(String letter){
try {

File file = new File(letter + ".wav");
AudioClip clip = Applet.newAudioClip(file.toURL());

clip.play();
}

catch (Exception e)
{
System.err.println("File input error");
}
}



Anyone have any ideas??????

Topic: pls help by giving some clues Previous Topic   Next Topic Topic: java.mail imap critical problems

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use