Page 2 of 3

Re: Sound Improvements

Posted: 18 Mar 2012, 22:49
by werdanith
Ace (SWE) wrote:Unfortunately I disagree with removing Audiere support, both ffmpeg and mpg123+libsndfile need a Cygwin and MingW install to properly compile and use in Windows.
Well, won't we be needing ffmpeg anyway for the Bink support?

Re: Sound Improvements

Posted: 18 Mar 2012, 23:05
by Chris
SDL_sound might be an easier alternative to Audiere. It can load wav and mp3 files, and is probably easier to get a hold of on Windows and Linux.

Unless something else comes along, though, ffmpeg will be needed to support Bink videos. AFAIK, it's the only free and open lib that can decode both video and audio from it (gstreamer can, but only because of its ffmpeg plugin, and gstreamer itself doesn't work too well for general audio decoding).

Re: Sound Improvements

Posted: 18 Mar 2012, 23:51
by K1ll
Ace (SWE) wrote:Unfortunately I disagree with removing Audiere support, both ffmpeg and mpg123+libsndfile need a Cygwin and MingW install to properly compile and use in Windows.
This is not true. They are probably mostly used in such setups but they have native (as in .lib/.dll) builds for windows. i don't know if they have visual studio projects for building but as they ship precompiled binaries this shouldn't be a reason to hold on longer to an outdated lib like Audiere.
Chris wrote:SDL_sound might be an easier alternative to Audiere. It can load wav and mp3 files, and is probably easier to get a hold of on Windows and Linux.

Unless something else comes along, though, ffmpeg will be needed to support Bink videos. AFAIK, it's the only free and open lib that can decode both video and audio from it (gstreamer can, but only because of its ffmpeg plugin, and gstreamer itself doesn't work too well for general audio decoding).
I completely disagree with using SDL_sound because it depends on SDL and this will result in having a lot of unnecessary dependencies. Also i would consider mixing OGRE and SDL as generally bad.

Re: Sound Improvements

Posted: 19 Mar 2012, 00:06
by Ace (SWE)
K1ll wrote:This is not true. They are probably mostly used in such setups but they have native (as in .lib/.dll) builds for windows. i don't know if they have visual studio projects for building but as they ship precompiled binaries this shouldn't be a reason to hold on longer to an outdated lib like Audiere.
ffmpeg does include a dev build, you need to edit the headers a bit though as it was built against cygwin and uses some includes that don't exist in a native Windows environment.
Got OpenMW to compile against it after modifying a few files, unfortunately so far it refuses to run because of .dll issues. I'll report back later if I get it working, otherwise I think I can take the task of keeping Audiere support.

Re: Sound Improvements

Posted: 20 Mar 2012, 13:57
by Zini
Your sound-rewrite doesn't merge cleanly. Can you merge in my master branch please?

Re: Sound Improvements

Posted: 20 Mar 2012, 14:23
by Chris
Zini wrote:Your sound-rewrite doesn't merge cleanly. Can you merge in my master branch please?
Done. I hope it did that correctly.

BTW, how should I handle resource loading (reading sound files, etc)? The original/current code mainly uses normal IO functions, but that obviously won't work with BSAs, so I'm not sure what it should be using. The Mangle::VFS/OgreVFS stuff? Or should I just use Ogre's resource functions directly?

Re: Sound Improvements

Posted: 20 Mar 2012, 14:28
by Zini
If you know how to integrate sound with the OGRE resources system that would be the best option. Currently sound resources have a separate implementation and everything is run through OGRE. Obviously that is far from ideal.

Re: Sound Improvements

Posted: 20 Mar 2012, 21:17
by Chris
It seems to be working now using Ogre's resource management stuff. Something odd I noticed is that the music files are each listed 3 times. I think that's due to OMW::Engine::loadBSA loading the same data dir 3 times (as Morrowind.bsa, Tribunal.bsa, and Bloodmoon.bsa are all in ./data, and each BSA loaded also loads the directory it's in).

Re: Sound Improvements

Posted: 21 Mar 2012, 08:28
by Zini
I am not sure if I understand exactly what you mean. But having a file show up multiple times is expected (depending on the state of your MW installation). The same file existing in a bsa and in the file system is one issue. The same file existing in multiple data path locations is another (currently disabled). At some point we need to implement a conflict resolution method for these cases, that is based on file priority.

Re: Sound Improvements

Posted: 21 Mar 2012, 19:30
by Chris
Zini wrote:I am not sure if I understand exactly what you mean. But having a file show up multiple times is expected (depending on the state of your MW installation). The same file existing in a bsa and in the file system is one issue. The same file existing in multiple data path locations is another (currently disabled). At some point we need to implement a conflict resolution method for these cases, that is based on file priority.
In apps/openmw/engine.cpp:

Code: Select all

void OMW::Engine::loadBSA()
{
    const Files::MultiDirCollection& bsa = mFileCollections.getCollection (".bsa");
    std::string dataDirectory;
    for (Files::MultiDirCollection::TIter iter(bsa.begin()); iter!=bsa.end(); ++iter)
    {
        std::cout << "Adding " << iter->second.string() << std::endl;
        Bsa::addBSA(iter->second.string());

        dataDirectory = iter->second.parent_path().string();
        std::cout << "Data dir " << dataDirectory << std::endl;
        Bsa::addDir(dataDirectory, mFSStrict);
    }
}
For every loaded BSA, the directory it's in is added. With Tribunal and Bloodmoon installed, this causes the Data Files directory to be added three times since that's where they are. So when I search Music/*, for instance, I get (in no particular order):
Battle, Explore, Special, Battle, Explore, Special, Battle, Explore, and Special.

If I search one of those sub-directories, e.g. Music/Explore/*, I get each explore music listed three times. The music directory only exists on disk in the Data Files directory.