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

AUD_Handle * AUD_SoftwareDevice::play ( AUD_IFactory factory,
bool  keep = false 
) [virtual]

Plays a sound source.

Parameters:
factory The factory to create the reader for the sound source.
keep When keep is true the sound source will not be deleted but set to paused when its end has been reached.
Returns:
Returns a handle with which the playback can be controlled. This is NULL if the sound couldn't be played back.
Exceptions:
AUD_Exception Thrown if there's an unexpected (from the device side) error during creation of the reader.

Implements AUD_IDevice.

Definition at line 174 of file AUD_SoftwareDevice.cpp.

References AUD_IFactory::createReader(), AUD_IReader::getSpecs(), AUD_SoftwareHandle::keep, lock(), m_mixer, m_playback, m_playingSounds, playing(), AUD_IMixer::prepare(), AUD_SoftwareHandle::reader, unlock(), and AUD_SoftwareHandle::volume.

{
      AUD_IReader* reader = factory->createReader();

      if(reader == NULL)
            AUD_THROW(AUD_ERROR_READER);

      // prepare the reader
      reader = m_mixer->prepare(reader);
      if(reader == NULL)
            return NULL;

      AUD_Specs rs = reader->getSpecs();

      // play sound
      AUD_SoftwareHandle* sound = new AUD_SoftwareHandle; AUD_NEW("handle")
      sound->keep = keep;
      sound->reader = reader;
      sound->volume = 1.0;

      lock();
      m_playingSounds->push_back(sound);

      if(!m_playback)
            playing(m_playback = true);
      unlock();

      return sound;
}


Generated by  Doxygen 1.6.0   Back to index