Hi, I am trying to get the length of a song with OpenAL.
The song streamed rather than fully loaded. I am using .ogg files. A java version of the below code just returns 0.
1 2 3 4 5 6 7 8 9 10 11 12 13
| ALfloat GetBufferLength(ALuint buffer) { ALint size, bits, channels, freq;
alGetBufferi(buffer, AL_SIZE, &size); alGetBufferi(buffer, AL_BITS, &bits); alGetBufferi(buffer, AL_CHANNELS, &channels); alGetBufferi(buffer, AL_FREQUENCY, &freq); if(alGetError() != AL_NO_ERROR) return -1.0f;
return (ALfloat)((ALuint)size/channels/(bits/8)) / (ALfloat)freq; } |
I think it's because the song is streaming? Is there any way to fix this?
thanks,
roland