alGetSourcei始终失败,并在alGetError()上返回AL_INVALID_NAME(40961)。 首先,我认为声音缓冲是错误的。但是没有,因为alSourcePlay确实可以正常工作。
我该如何解决这个问题?
ALuint buffer = /*some valid openal buffer*/;
ALint state;
alGetSourcei(buffer, AL_SOURCE_STATE, &state);
ALenum error = alGetError();
if (error != AL_NO_ERROR)
std::cout << (int)error << std::endl; // In here, always return 40961
// This seems like the buffer is wrong.
// But, buffer is correct.
// Because alSourcePlay() works properly!!
顺便说一句,状态始终为32766。