Commit Graph

174 Commits (359e748c28671700cd6ed98eef096928f54f9491)

Author SHA1 Message Date
Andrei Kortunov 359e748c28 Initialize some missing fields in constructors 6 years ago
Andrei Kortunov a68de93308 Initialize srate variable in openal_output 6 years ago
Andrei Kortunov e5db5e2651 Fix 'maybe-uninitialized' warning in openal_output 6 years ago
Chris Robinson 08e947319a Restore exception throwing to the decoder 7 years ago
Chris Robinson 06ae61479a If a sound effect fails to load, substitute silence. 7 years ago
Chris Robinson aecf74e7bb Don't throw exceptions from the audio decoder 7 years ago
Chris Robinson 41bb35655b Avoid an extra call to get the buffer size 7 years ago
Chris Robinson 4b448c74d2 Use range-for loops instead of for_each 7 years ago
Chris Robinson 9dbb713b7c Print a bit more information for sound initialization 7 years ago
Chris Robinson acd6d9cd72 Try opening the default device fallback in OpenAL_Output 7 years ago
Chris Robinson d68e1581ee Use an std::array for the OpenAL stream buffers 7 years ago
Chris Robinson 780e82480d Make the PlayMode and PlayType enums scoped
Also shorten them by putting them in the MWSound namespace
7 years ago
Chris Robinson 0c1ad7c74e Replace a few more explicit loops 7 years ago
Chris Robinson 3757571d46 Set HRTF when initializing the device 7 years ago
Chris Robinson c17edfd547 Don't be so throw-happy in the sound manager 7 years ago
Chris Robinson 605c937572 Ensure 3D sources are spatialized
Standard OpenAL does not spatialize non-mono sounds, although the game has some
stereo sounds meant to play in 3D. The desired behavior can be achieved with
the AL_SOFT_source_spatialize extension.
7 years ago
Chris Robinson edfba68eb5 Apply reverb and a low-pass filter when underwater
This replaces the pitch-shift effect when available.
7 years ago
Chris Robinson 0b720cd90c Set the appropriate meter/unit scale for sound 7 years ago
Chris Robinson c790fedd3f Load an effect and filter for underwater 7 years ago
Chris Robinson 3d37cb3cf6 Load EFX functions when available 7 years ago
Chris Robinson 9e7a49f66e Include alext.h to get OpenAL extension definitions 7 years ago
Chris Robinson 1fe60dd8e2 Replace some shared_ptrs with pointers to deque entries 7 years ago
Ewan Higgs 38a2de3c51 convert std::autor_ptr to std::unique_ptr, originally by Ewan Higgs and updated by Bret Curtis 7 years ago
Jules Blok e9d8ff532f OpenAL_Output: When a source is finished, rewind it instead of stopping it.
This works around a bug in the MacOS OpenAL implementation.
7 years ago
scrawl 530fb61ad0 Use OpenThreads instead of boost thread
This should allow OpenMW to work better with git versions of openscenegraph. OSG dev version 3.5.5 added the setting of thread affinity for the main thread. The problem is that in the boost/standard threading libraries, the affinity of a thread is inherited by any further threads launched from that thread, leading to these threads always running on the same core as the main thread unless you tell them not to.

With OpenThreads, the default affinity of a thread is none, no matter what parent thread it was launched from.

So, when using custom threading with OSG 3.6+, we have these options:
1. explicitely tell OSG to *not* set the thread affinity
or 2. explicitely set the thread affinity of additional threads created (possible with boost, but not possible with std::thread)
or 3. use OpenThreads
or 4. accept the suboptimal performance of non-OSG threads (in OpenMW's case the sound streaming & video threads) running on the same core as the main thread

This patch opts for 3.)

Reference: http://forum.openscenegraph.org/viewtopic.php?t=16158
8 years ago
scrawl 4699a8098b Include fix 8 years ago
scrawl dc1b010cf0 Don't analyze the loudness for sounds that don't need it 8 years ago
scrawl 965aaebbdb Analyze the loudness data as the stream is decoded for playback
Instead of getting the loudness data for the whole file in advance, we now get it piece by piece as the sound is streamed.

The benefit is that we need to decode the audio just once instead of twice.

We no longer need to rewind() the stream when the first decoding is done, this should hopefully fix bug #3453 .
8 years ago
Chris Robinson 7fc2df153a Rename stopSound/stopStream to finishSound/finishStream
Since they're also used to clean up output resources, not just stopping.
9 years ago
scrawl 1264651af7 Fix coverity defects 9 years ago
scrawl e69750905a Fix gcc warning about function casts 9 years ago
Chris Robinson c75303b652 Add an option to select and enable HRTF 9 years ago
Chris Robinson 2face3d0a9 Combine duplicate code 9 years ago
Chris Robinson 1407366e51 Use a premade SoundStream object for the output's streamSound functions 9 years ago
Chris Robinson 2ee3265b66 Use a premade Sound object for the output's playSound functions 9 years ago
Chris Robinson 2883cdba5c Initialize the Sound object before modifying the pitch variable 9 years ago
Chris Robinson a6db96b2d8 Update sound and stream parameters 9 years ago
Chris Robinson 4bd235284b Rename a couple members to avoid confusion 9 years ago
Chris Robinson 1ce3e7f5b9 Use a separate type for streams
They're basically the same, but it's to help avoid accidents with passing non-
streaming sounds to the stream functions, or vice-versa.
9 years ago
Chris Robinson 816015d6e6 Avoid inheriting from Sound for sound types 9 years ago
Chris Robinson 4ee409af84 Load loudness data asynchronously
Currently abuses the output audio streams' background processing thread to do
the work, since there's no generalized threaded processing mechanism.
9 years ago
Chris Robinson 0f05ccf72a Use a non-recursive mutex and properly end the streaming thrread 9 years ago
Chris Robinson b5ed2e65f8 Add a method to get the sound stream delay
This helps avoid a lock during the movie player's read method, since it needs
to sync with the current playback position which would otherwise need to get
the movie decoder's current position.
9 years ago
Chris Robinson f3c035907c Rename Sound::update to Sound::applyUpdates 9 years ago
Chris Robinson 9568aa6a84 Use a condition variable to wake up the audio stream thread
This should make starting streams a bit more responsive, and allows us to do
more in it that really shouldn't wait for its next wake up.
9 years ago
Chris Robinson 82f3651f81 Treat the sound offset as the offset in seconds 9 years ago
Chris Robinson 8f08ca9cba Revert "Avoid unsafe sizeof(x)/sizeof(x[0]) constructs for array counting"
This reverts commit 0d4fea896c.
9 years ago
Chris Robinson 0d4fea896c Avoid unsafe sizeof(x)/sizeof(x[0]) constructs for array counting 9 years ago
Chris Robinson a1bdb544db Avoid an unnecessary string copy 9 years ago
Chris Robinson 669b7a2295 Batch update changes together, when possible
Certain OpenAL implementations, including Rapture3D, Creative's hardware
drivers, and more recent versions of OpenAL Soft, can batch together changes so
that they all occur at once, avoiding potential discontinuities with one sound
being changed before another, or the listeenr being changed before sounds are.

On other implementaitons, this is a no-op and maintains existing behavior.
9 years ago