Audio-fail for a test-free package in .jar
-
Created class.
ResourceLoader
to get a way to pictures:public class ResourceLoader { static ResourceLoader rl = new ResourceLoader(); public static Image getImage(String fileName){ return Toolkit.getDefaultToolkit().getImage(rl.getClass().getResource("images/" + fileName)); } }
How do you get the same way to wav-files from the folder sounds?
-
Okay, I'll describe,
URL resource = Object.class.getResource("/sounds/".concat(NAMESOUNDS)); try { BufferedInputStream sounds = new BufferedInputStream((InputStream) resource.openStream()); //ОТКРЫВАЕМ БУФЕРЕЗИРОВАННЫЙ ПОТОК } catch (IOException ex) { ex.printStackTrace(); }
And then I don't know where you'll use the open wav in the operational memory. Answer one, do something based on Clip.
And P.S. all that's in jar isn't a catalogue for you to see the files that sound in jar, you make a model in this catalogue that sends you references.