Logo Search packages:      
Sourcecode: blender version File versions  Download package

bool AUD_SoftwareDevice::stop ( AUD_Handle handle  )  [virtual]

Stops a played back or paused sound. The handle is definitely invalid afterwards.

Parameters:
handle The handle returned by the play function.
Returns:
  • true if the sound has been stopped.
  • false if the handle is invalid.

Implements AUD_IDevice.

Definition at line 256 of file AUD_SoftwareDevice.cpp.

References lock(), m_pausedSounds, m_playback, m_playingSounds, playing(), and unlock().

Referenced by mix().

{
      bool result = false;

      lock();

      for(AUD_HandleIterator i = m_playingSounds->begin();
            i != m_playingSounds->end(); i++)
      {
            if(*i == handle)
            {
                  delete (*i)->reader; AUD_DELETE("reader")
                  delete *i; AUD_DELETE("handle")
                  m_playingSounds->erase(i);
                  if(m_playingSounds->empty())
                        playing(m_playback = false);
                  result = true;
                  break;
            }
      }
      if(!result)
      {
            for(AUD_HandleIterator i = m_pausedSounds->begin();
                  i != m_pausedSounds->end(); i++)
            {
                  if(*i == handle)
                  {
                        delete (*i)->reader; AUD_DELETE("reader")
                        delete *i; AUD_DELETE("handle")
                        m_pausedSounds->erase(i);
                        result = true;
                        break;
                  }
            }
      }

      unlock();

      return result;
}


Generated by  Doxygen 1.6.0   Back to index