Ma-Shell Posted June 18, 2014 Share Posted June 18, 2014 Hi, I noticed, when playing a sound via (C++): Sound* s = Sound::Load("Sound\\Footsteps\\jump.wav"); s->Play(); the RefCount of the Sound will be increased but not decreased after the sound is done playing. However, playing the sound via Entity* e = world->entities.front(); e->EmitSound(s); will increase the RefCount but also decrease it, after it is done playing. This should be consistent, because this has consequences: When using Play(), I can instantly after playing the sound release it with s->Release(); When using EmitSound() and doing the same, after the sound is done playing, I get into the DebugErrorHook with the message "OpenAL: AL_INVALID_OPERATION" and the game stops. I guess, this happens, because the latter method releases the sound after finishing playing it and thus the RefCount gets decreased and reaches 0, so that the sound gets deleted which is somehow a problem for OpenAL. Link to comment Share on other sites More sharing options...
Josh Posted July 20, 2014 Share Posted July 20, 2014 Thanks. I am modifying the behavior. Sound::Play() will increment the sound refcount, then auto-collect it when done playing. Proper usage: Sound* sound = Sound::Load("blah.,wav"); sound->Play(); sound->Release(); My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts