Maximal file size for AudioTrack?

Hi,



I have a 30 mb .wav music file but it can't be loaded!



I've figured out in the OpenALSystem is the limit:


private static final long MAX_MEMORY = 16 * 1024 * 1024; // 16 MB



stackstrace:


Exception in thread "Thread-5" java.lang.OutOfMemoryError: Java heap space
   at java.util.Arrays.copyOf(Arrays.java:2786)
   at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
   at com.jmex.audio.util.AudioLoader.read(AudioLoader.java:124)
   at com.jmex.audio.util.AudioLoader.loadWAV(AudioLoader.java:92)
   at com.jmex.audio.util.AudioLoader.fillBuffer(AudioLoader.java:63)
   at com.jmex.audio.openal.OpenALSystem.createAudioTrack(OpenALSystem.java:180)
   at com.jmex.audio.openal.OpenALSystem.createAudioTrack(OpenALSystem.java:1)
   at mce.game.data.audio.AudioLoadThread.run(AudioLoadThread.java:29)



Why is the max memory 16 mb?

i dont think 16 mb is the max size.



try to increase the java heap space with a jvm parameter -Xmx<size>

I have not done this myself… but it should also be possible to stream audio, so that less of it is in the memory at the same time…

Yeah, I was wrong to say there is a file limit.

There is actually no size limit for audio track files. I can now load everything.



After I tuned my VM in Eclipse for more memory allocation everything works.



I put this argument in the run configuration like said in other posts:


-Xmx1G



I haven't tried audio streaming yet, but I'm going to as soon as my network works.

Any code snippset to show audio streaming would be a good start nevertheless ;)

I do not have any examples ready for this, but I think it is as simple as passing 'true' to the stream parameter when you do AudioSystem.getSystem().createAudioTrack.