Esempio n. 1
0
 void SoundManager::stopSound(const std::string& soundId)
 {
     IDMap::iterator it = mLoopedSounds.find(soundId);
     if(it != mLoopedSounds.end())
     {
         SoundPtr snd = it->second.lock();
         if(snd) snd->stop();
         mLoopedSounds.erase(it);
     }
 }
Esempio n. 2
0
 virtual void actionPerformed(const ActionEventPtr e)
  {
      TutorialSound->stop(TutorialSoundChannelID);
      std::cout << "Stop Action" << std::endl;
      NodePtr s = makeTorus(.5, 2, 16, 16);
      beginEditCP(scene, Node::ChildrenFieldMask);
          while(scene->getNChildren() > 0)
          {
              scene->subChild(scene->getNChildren()-1);
          }
          scene->addChild(s);
      endEditCP(scene, Node::ChildrenFieldMask);
      
      segUpdate = 0;
  }
Esempio n. 3
0
    // Clears all the sub-elements of a given iterator, and then
    // removes it from 'sounds'.
    void clearAll(PtrMap::iterator it)
    {
      IDMap::iterator sit = it->second.begin();

      while(sit != it->second.end())
        {
          // Get sound pointer, if any
          SoundPtr snd = sit->second.lock();

          // Stop the sound
          if(snd) snd->stop();

          sit++;
        }

      // Remove the ptr reference
      sounds.erase(it);
    }
Esempio n. 4
0
 // Stop a sound and remove it from the list. If id="" then
 // remove the entire object and stop all its sounds.
 void remove(MWWorld::Ptr ptr, const std::string &id = "")
 {
   PtrMap::iterator it = sounds.find(ptr);
   if(it != sounds.end())
     {
       if(id == "")
         // Kill all references to 'ptr'
         clearAll(it);
       else
         {
           // Only find the id we're looking for
           IDMap::iterator it2 = it->second.find(id);
           if(it2 != it->second.end())
             {
               // Stop the sound and remove it from the list
               SoundPtr snd = it2->second.lock();
               if(snd) snd->stop();
               it->second.erase(it2);
             }
         }
     }
 }