It wont throw any errors even if the file does not exist. .toURL() is also depricated you should use f.toURI().toURL()
The Java Sound API is limited and even more limited when you use the Applet code to start it up. You'll get more fine grained control is you use the Sound API http://www.oracle.co...dex-139508.html
However, most of the APIs like the Sound API have been neglected for years so they haven't been updated properly to meet todays standards. You'll probably find your wav happens to have one of those settings that the Sound API just doesn't support.
I would suggest looking into a different sound API for Java and avoid using the neglected one. Your code will work fine if you use a midi.
You might look into some of the OpenAL Api's like lwjgl http://lwjgl.org/ which they are more up to date then what comes with java. Though that means you will have to have your app bundle the correct native libraries for the supported systems.
Show differencesHistory of post edits
#1medv4380
Posted 12 January 2012 - 04:14 PM
It wont throw any errors even if the file does not exit. .toURL() is also depricated you should use f.toURI().toURL()
The Java Sound API is limited and even more limited when you use the Applet code to start it up. You'll get more fine grained control is you use the Sound API http://www.oracle.com/technetwork/java/index-139508.html
However, most of the APIs like the Sound API have been neglected for years so they haven't been updated properly to meet todays standards. You'll probably find your wav happens to have one of those settings that the Sound API just doesn't support.
I would suggest looking into a different sound API for Java and avoid using the neglected one. Your code will work find if you use a midi.
You might look into some of the OpenAL Api's like lwjgl http://lwjgl.org/ which they are more up to date then what comes with java. Though that means you will have to have your app bundle the correct native libraries for the supported systems.
The Java Sound API is limited and even more limited when you use the Applet code to start it up. You'll get more fine grained control is you use the Sound API http://www.oracle.com/technetwork/java/index-139508.html
However, most of the APIs like the Sound API have been neglected for years so they haven't been updated properly to meet todays standards. You'll probably find your wav happens to have one of those settings that the Sound API just doesn't support.
I would suggest looking into a different sound API for Java and avoid using the neglected one. Your code will work find if you use a midi.
You might look into some of the OpenAL Api's like lwjgl http://lwjgl.org/ which they are more up to date then what comes with java. Though that means you will have to have your app bundle the correct native libraries for the supported systems.