Exemplo n.º 1
0
bool CSoundItem::IdleTask()
{
	if ( m_ALSource == 0 )
		return false;

	HandleFade();

	if (m_LastPlay && m_ALSource)
	{
		CScopeLock lock(m_ItemMutex);
		int proc_state;
		alGetSourcei(m_ALSource, AL_SOURCE_STATE, &proc_state);
		AL_CHECK;
		m_ShouldBePlaying = (proc_state != AL_STOPPED);
		return (proc_state != AL_STOPPED);
	}
	return true;
}
Exemplo n.º 2
0
bool CStreamItem::IdleTask()
{
	AL_CHECK
	HandleFade();
	AL_CHECK

	int proc_state;
	alGetSourceiv(m_ALSource, AL_SOURCE_STATE, &proc_state);
	AL_CHECK
	
	if (proc_state == AL_STOPPED)
	{
		if (m_LastPlay)
			return (proc_state != AL_STOPPED);
	}
	else
	{
		COggData* tmp = (COggData*)m_SoundData;
		
		if (! tmp->IsFileFinished())
		{
			int num_processed;
			alGetSourcei(m_ALSource, AL_BUFFERS_PROCESSED, &num_processed);
			AL_CHECK
			
			if (num_processed > 0)
			{
				ALuint* al_buf = new ALuint[num_processed];
				alSourceUnqueueBuffers(m_ALSource, num_processed, al_buf);
				AL_CHECK
				int didWrite = tmp->FetchDataIntoBuffer(num_processed, al_buf);
				alSourceQueueBuffers(m_ALSource, didWrite, al_buf);
				AL_CHECK
				delete[] al_buf;
			}
		}
		else if (GetLooping())
Exemplo n.º 3
0
bool CBufferItem::IdleTask()
{
	if ( m_ALSource == 0 )
		return false;

	HandleFade();
	
	if (m_LastPlay)
	{
		CScopeLock lock(m_ItemMutex);
		int proc_state;
		alGetSourcei(m_ALSource, AL_SOURCE_STATE, &proc_state);
		AL_CHECK;
		m_ShouldBePlaying = (proc_state != AL_STOPPED);
		return (proc_state != AL_STOPPED);
	}
	
	if (GetLooping())
	{
		int num_processed;
		AL_CHECK;
		alGetSourcei(m_ALSource, AL_BUFFERS_PROCESSED, &num_processed);
		
		AL_CHECK;
		for (int i = 0; i < num_processed; i++)
		{
			ALuint al_buf;
			alSourceUnqueueBuffers(m_ALSource, 1, &al_buf);
			AL_CHECK;
			alSourceQueueBuffers(m_ALSource, 1, &al_buf);
			AL_CHECK;
		}
	}

	return true;
}