Exemplo n.º 1
0
IAEStream *CPulseAE::FreeStream(IAEStream *stream)
{
  RemoveStream(stream);

  CPulseAEStream *istream = (CPulseAEStream *)stream;

  delete istream;

  return NULL;
}
Exemplo n.º 2
0
void csSndSysRendererOpenAL::Update()
{
  // Listener is created on open, but EventHandler is setup at init,
  // so, in some cases we can get here without the listener having been
  // created yet.
  if (!m_Listener)
    return;
  // Get exclusive access to the OpenAL context.
  ScopedRendererLock lock (*this);

  // Make sure the context, not really necessary as we requested a async
  // context, but documentation recommends it, in case async contexts are not
  // supported.
  //alcProcessContext (m_Context);

  // Update the listeners state.
  bool ExternalUpdates = m_Listener->Update();

  // Update the sources
  size_t iMax = m_Sources.GetSize();
  for (size_t i=0;i<iMax;i++)
  {
    m_Sources[i]->PerformUpdate( ExternalUpdates );
	if (m_Sources[i]->GetStream()->GetPauseState() == CS_SNDSYS_STREAM_PAUSED &&
        m_Sources[i]->GetStream()->GetAutoUnregisterRequested() == true) // sound has finished and is not looping
	{
	  RemoveStream(m_Sources[i]->GetStream());
	  RemoveSource(m_Sources[i]);
	  i--;    // changing the vector in mid-loop means we back up here
	  iMax--; // array is also one shorter now
	}
  }
  // Check for any errors
  ALCenum err = alcGetError (m_Device);
  if (err != ALC_NO_ERROR)
  {
    Report (CS_REPORTER_SEVERITY_ERROR, "An OpenAL error occured: %s", alcGetString (m_Device, err));
    CS_ASSERT (err == ALC_NO_ERROR);
  }

}