I can’t seem to get fmod to take whatever ByteBuffer I send it when I call FSound.FSOUND_Sample_Load(int, ByteBuffer, int, int, int). The result is always a null pointer exception which I’m assuming means the buffer wasn’t correct and therefore means the Sample’s memory location is invalid.
Anyone have a tried and true method to break down a wav into a ByteBuffer? I’ve seen various examples on how to create an acceptable wav ByteBuffer for OpenAL, however, none of those work (I’m assuming that this is beacuse OpenAL and FMOD require the buffer to be created differently)
Also, is there any reason why FMUSIC_MODULE and FSOUND_STREAM types can be loaded by file whereas an FSOUND_SAMPLE needs a buffer? Perhaps FSOUND_SAMPLE isn’t supported yet?
Thanks in advance!
Edit: I found a way around the problem by loading the wav first as a FSOUND_STREAM. I then use FSound.FSOUND_Stream_GetSample(stream) to convert the stream into a sample. It’s a hack, however, it works until a true solution is found.
Edit2: Ok, well, Fsound.FSOUND_STream_GetSample(stream) doesn’t work like I thought. Apparantly it only gets the header of the stream, which works fine if the sound I want to play is very short. If the sample is long, i’m back to the drawing board.
Edit3: OK! It’s another hack but it sorta works. I’m a musician by trade so I went oldschool and used a tracker to hold a few samples. Using FMusic.FMUSIC_GetSample(module, sample#) I was able to rip the samples from my own modules. Again, this works but it’s very much a hack. However, there is some novelty to having all sounds loaded and stored in one file.
There are known bugs and there are unimplemented methods. I would love to get a copy of your FMOD stuff, since most of what I have is really basic.