Beispiel #1
0
    SoundImpl(Ogre::Root *root, Ogre::Camera *camera,
              const ESMS::ESMStore &str,
              const std::string &soundDir)
      : mgr(new OEManager(SoundFactoryPtr(new SOUND_FACTORY)))
      , updater(mgr)
      , cameraTracker(mgr)
      , store(str)
      , files(soundDir)
    {
      cout << "Sound output:  " << SOUND_OUT << endl;
      cout << "Sound decoder: " << SOUND_IN << endl;

      // Attach the camera to the camera tracker
      cameraTracker.followCamera(camera);

      // Tell Ogre to update the sound system each frame
      root->addFrameListener(&updater);
    }
Beispiel #2
0
    SoundManager::SoundManager(Ogre::Root *root, Ogre::Camera *camera,
        const Files::PathContainer& dataDirs,
        bool useSound, bool fsstrict, MWWorld::Environment& environment)
        : mFSStrict(fsstrict)
        , mEnvironment(environment)
        , mgr(new OEManager(SoundFactoryPtr(new SOUND_FACTORY)))
        , updater(mgr)
        , cameraTracker(mgr)
        , mCurrentPlaylist(NULL)
    {
        if(useSound)
        {
            // The music library will accept these filetypes
            // If none is given then it will accept all filetypes
            std::vector<std::string> acceptableExtensions;
            acceptableExtensions.push_back(".mp3");
            acceptableExtensions.push_back(".wav");
            acceptableExtensions.push_back(".ogg");
            acceptableExtensions.push_back(".flac");

            // Makes a list of all sound files, searches in reverse for priority reasons
            for (Files::PathContainer::const_reverse_iterator it = dataDirs.rbegin(); it != dataDirs.rend(); ++it)
            {
                Files::FileLister(*it / std::string("Sound"), mSoundFiles, true);
            }

            // Makes a FileLibrary of all music files, searches in reverse for priority reasons
            for (Files::PathContainer::const_reverse_iterator it = dataDirs.rbegin(); it != dataDirs.rend(); ++it)
            {
                mMusicLibrary.add(*it / std::string("Music"), true, mFSStrict, acceptableExtensions);
            }

            std::string anything = "anything";      // anything is better that a segfault
            mCurrentPlaylist = mMusicLibrary.section(anything, mFSStrict); // now points to an empty path

            std::cout << "Sound output:  " << SOUND_OUT << std::endl;
            std::cout << "Sound decoder: " << SOUND_IN << std::endl;
            // Attach the camera to the camera tracker
            cameraTracker.followCamera(camera);

            // Tell Ogre to update the sound system each frame
            root->addFrameListener(&updater);
        }
      }
Beispiel #3
0
 OpenAL_Audiere_Factory()
   {
     set(SoundFactoryPtr(new OpenAL_Factory),
         SampleSourceLoaderPtr(new AudiereLoader));
   }
Beispiel #4
0
 OpenAL_Mpg123_Factory()
   {
     set(SoundFactoryPtr(new OpenAL_Factory),
         SampleSourceLoaderPtr(new Mpg123Loader));
   }