Example #1
0
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);
}
Example #2
0
static ALCcontext* CDECL wine_alcGetThreadContext(ALCvoid)
{
    return alcGetThreadContext();
}
Example #3
0
	void protect()
	{
		old_ctx = (alcGetThreadContext ? alcGetThreadContext() : NULL);
		if(alcSetThreadContext)
			alcSetThreadContext(alcGetCurrentContext());
	}