void StopStream(alureStream *stream) { EnterCriticalSection(&cs_StreamPlay); std::list<AsyncPlayEntry>::iterator i = AsyncPlayList.begin(), end = AsyncPlayList.end(); while(i != end) { if(i->stream == stream) { AsyncPlayEntry ent(*i); AsyncPlayList.erase(i); ALCcontext *old_ctx = (alcGetThreadContext ? alcGetThreadContext() : NULL); if(alcSetThreadContext) { if(alcSetThreadContext(ent.ctx) == ALC_FALSE) goto ctx_err; } alSourceStop(ent.source); alSourcei(ent.source, AL_BUFFER, 0); alDeleteBuffers(ent.buffers.size(), &ent.buffers[0]); alGetError(); if(alcSetThreadContext) { if(alcSetThreadContext(old_ctx) == ALC_FALSE) alcSetThreadContext(NULL); } ctx_err: if(ent.eos_callback) ent.eos_callback(ent.user_data, ent.source); break; } i++; } LeaveCriticalSection(&cs_StreamPlay); }
static ALCcontext* CDECL wine_alcGetThreadContext(ALCvoid) { return alcGetThreadContext(); }
void protect() { old_ctx = (alcGetThreadContext ? alcGetThreadContext() : NULL); if(alcSetThreadContext) alcSetThreadContext(alcGetCurrentContext()); }