Ciao , riscontro vari problemi nella riproduzione di un file audio mediante java sampled
ad esempio facendo:
ottengo l'eccezzione:codice:File f = new File (getClass ().getResource (stringaPercorsoFile)); AudioFormat af = AudioSystem.getAudioFileFormat(f).getFormat(); AudioInputStream ais = AudioSystem.getAudioInputStream(f); ...
alla prima riga del codice sopra citatocodice:Exception in thread "main" java.lang.IllegalArgumentException: URI is not hierar chical ...
Ho provato a passare per stream:
ottengo ora:codice:InputStram f = getClass ().getResourceAsStream (stringaPercorsoFile); AudioFormat af = AudioSystem.getAudioFileFormat(f).getFormat(); AudioInputStream ais = AudioSystem.getAudioInputStream(f); ...
alla seconda riga del codice sopra citatocodice:java.io.IOException: mark/reset not supported ...
Mediante ricerca web ho trovato il suggerimento di passare per BufferedInputStream del tipo:
ma neanche così va bene , infatti ottengocodice:InputStream f = getClass ().getResourceAsStream (stringaPercorsoFile); AudioFormat af = AudioSystem.getAudioFileFormat(((InputStream)new BufferedInputStream (f))).getFormat(); AudioInputStream ais = AudioSystem.getAudioInputStream(((InputStream)new BufferedInputStream (f))); ...
alla terza riga del codice sopra citato...codice:javax.sound.sampled.UnsupportedAudioFileException: could not get audio input str eam from input stream ...
Dunque?Come posso risolvere il problema???

Rispondi quotando
