Sound Improvements

Everything about development and the OpenMW source code.
User avatar
werdanith
Posts: 295
Joined: 26 Aug 2011, 16:18

Re: Sound Improvements

Post 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?
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Sound Improvements

Post 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).
K1ll
Posts: 184
Joined: 06 Aug 2011, 21:54

Re: Sound Improvements

Post 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.
User avatar
Ace (SWE)
Posts: 887
Joined: 15 Aug 2011, 14:56

Re: Sound Improvements

Post 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.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Sound Improvements

Post by Zini »

Your sound-rewrite doesn't merge cleanly. Can you merge in my master branch please?
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Sound Improvements

Post 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?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Sound Improvements

Post 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.
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Sound Improvements

Post 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).
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Sound Improvements

Post 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.
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Sound Improvements

Post 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.
Post Reply