replacement for alutLoadWAVFile
The 开发者_运维技巧following function calls are deprecated in OpenAL 1.1, what is a proper replacement?? THe only answer i found in google was "write your own function!!" ;-)
alutLoadWAVFile
alutUnloadWAV
There are 8 file loading functions in ALUT (not including the three deprecated functions alutLoadWAVFile
, alutLoadWAVMemory
, and alutUnloadWAV
).
The prefix of the function determines where the data is going; four of them start alutCreateBuffer
(create a new buffer and put the sound data into it), and the other four start alutLoadMemory
(allocate a new memory region and put the sound data into it).
The suffix of the function determines where the data comes from. Your options are FromFile
(from a file!), FromFileImage
(from a memory region), HelloWorld
(fixed internal data of someone saying "Hello, world!"), and Waveform
(generate a waveform).
I believe the correct replacement for alutLoadWAVFile
would therefore be alutCreateBufferFromFile
.
However, I would not use this blindly - it's suitable for short sound clips, but for e.g. a music track you probably want to load it in chunks and queue up multiple buffers, to ease the memory load.
These functions are all covered in the alut documentation, by the way.
"write your own" is pretty much the correct answer.
You can usually get away with using the deprecated functions since most implementations still include the WAV file handling functions, with one notable exception being iOS, for which you'd need to use audio file services.
I'd suggest making a standard prototype for "load wav file" and then depending on the OS, use a different loading routine. You can just stub it with a call to alutLoadWAVFile for systems known to still support it.
精彩评论