Gandi Posted September 19, 2011 Share Posted September 19, 2011 Title says it all I think. I could play the sound until the sound state is no longer "Playing" but that's kind of an ugly way since I would need to know the duration before I play it. Quote Link to comment Share on other sites More sharing options...
Naughty Alien Posted September 19, 2011 Share Posted September 19, 2011 ..unfortunately, there is no direct commands LE provide out of box, for such info (at least not to my knowledge)..so, what i did in order to access such informations, as well as tons of other useful things , sound related, is rigged Bass audio library...hopefully some out of box commands will be included in LE3.x..or if there is some open source library similar to BASS, it will be nice to have it and maybe made some community project out of it for benefit of all.. EDIT: actually it should be relatively easy to write some small lib to read such data from sound file header.. ALuint LoadALBuffer(string path) { // Variables to store data which defines the buffer. ALenum format; ALsizei size; // THIS IS YOUR SOUND FILE DURATION ALvoid* data; ALsizei freq; ALboolean loop; // Buffer id and error checking variable. ALuint buffer; ALenum result; // Generate a buffer. Check that it was created successfully. alGenBuffers(1, &buffer); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Read in the wav data from file. Check that it loaded correctly. alutLoadWAVFile(szFilePath, &format, &data, &size, &freq, &loop); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Send the wav data into the buffer. Check that it was received properly. alBufferData(buffer, format, data, size, freq); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Get rid of the temporary data. alutUnloadWAV(format, data, size, freq); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Return the buffer id. return buffer; } ..ill play with this over weekend .. now im curious.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.