1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 22:19:54 +00:00
Commit graph

444 commits

Author SHA1 Message Date
Chris Robinson
4bd235284b Rename a couple members to avoid confusion 2015-12-02 16:09:24 -08:00
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.
2015-12-02 16:09:24 -08:00
Chris Robinson
816015d6e6 Avoid inheriting from Sound for sound types 2015-12-02 16:09:24 -08:00
Alexander "Ace" Olofsson
24340bff95 Add a space 2015-11-30 17:47:36 +01:00
Alexander "Ace" Olofsson
6823298516 Different way to solve the type deduction issue 2015-11-30 17:42:25 +01:00
Alexander "Ace" Olofsson
a69e751089 Revert "Fix windows builds"
This reverts commit b085c09f86.
2015-11-30 17:38:46 +01:00
Alexander "Ace" Olofsson
b085c09f86 Fix windows builds
Can't instantiate a container (at least with MSVC) without knowing the exact size of the object being stored, forward-declares only work with pointers.
I couldn't see a simple way to remove the forward declare, so pointers and memory management it is.
2015-11-30 13:36:15 +01:00
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.
2015-11-27 09:47:14 -08:00
Chris Robinson
0f05ccf72a Use a non-recursive mutex and properly end the streaming thrread 2015-11-27 08:13:23 -08:00
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.
2015-11-27 06:01:50 -08:00
Chris Robinson
f3c035907c Rename Sound::update to Sound::applyUpdates 2015-11-27 04:55:17 -08:00
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.
2015-11-27 04:30:09 -08:00
Chris Robinson
4a078725d4 Play player voices locally 2015-11-27 02:57:44 -08:00
Chris Robinson
449eca4fb4 Properly mark streams as 2D or 3D 2015-11-27 02:36:33 -08:00
Chris Robinson
21bb2e9314 Use a deque for loudness buffers with a map lookup
Similar to Sound_Buffer, this allows individual Sound_Loudness objects to
retain a constant pointer when new ones are inserted on to the end.
2015-11-27 02:01:18 -08:00
Chris Robinson
5f8a09df97 Play player sounds (except footsteps) local to the listener 2015-11-27 02:01:18 -08:00
Chris Robinson
82f3651f81 Treat the sound offset as the offset in seconds 2015-11-27 02:01:17 -08:00
Chris Robinson
8b7587f9a6 Track whether a sound is 3D 2015-11-27 02:01:17 -08:00
Chris Robinson
fc912b135f Avoid unnecessarily friending classes 2015-11-27 02:01:17 -08:00
Chris Robinson
d4238a6d91 Add config options for the sound buffer cache size
The cache size is specified with a min/max range, intended to avoid constant
unloading once the limit is reached. This way, buffers can be unloaded down to
a reasonable mimimum, allowing some more buffers to be subsequently loaded
without causing more unloading.
2015-11-26 02:13:37 -08:00
Chris Robinson
8715add72f Store sound buffers in a deque that's filled in as needed
A deque allows existing Sound_Buffer references to remain valid as long as new
ones are back-inserted. These references can be used instead of indices.
2015-11-26 01:26:33 -08:00
Chris Robinson
8f08ca9cba Revert "Avoid unsafe sizeof(x)/sizeof(x[0]) constructs for array counting"
This reverts commit 0d4fea896c.
2015-11-25 06:06:27 -08:00
Chris Robinson
04f885d8cc Rename mReferences to mUses 2015-11-25 04:24:27 -08:00
Chris Robinson
0d4fea896c Avoid unsafe sizeof(x)/sizeof(x[0]) constructs for array counting 2015-11-25 04:24:27 -08:00
Chris Robinson
a1bdb544db Avoid an unnecessary string copy 2015-11-25 04:24:27 -08:00
Chris Robinson
aac903484c Remove a really unnecessary method 2015-11-25 04:24:26 -08:00
Chris Robinson
73448c72f6 Replace Play_NoTrack with playManualSound3D, and rename the latter 2015-11-25 04:24:26 -08:00
Chris Robinson
caae305ddd Use a sorted list for unused buffers
Helps ensure the buffers being unloaded due to cache limits are not likely to
be needed anytime soon.
2015-11-25 04:24:26 -08:00
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.
2015-11-25 04:24:26 -08:00
Chris Robinson
ea70b0baee Don't store the buffer in the sound struct 2015-11-25 04:24:25 -08:00
Chris Robinson
fd7d58fe7e Reset the sound handle back to null after unloading 2015-11-25 04:24:25 -08:00
Chris Robinson
4801661b34 Stop all sounds of the given id 2015-11-25 04:24:25 -08:00
Chris Robinson
8a69f676ec Remove some duplicate code 2015-11-25 04:24:25 -08:00
Chris Robinson
45628316f8 Remove an unnecessary check 2015-11-25 04:24:25 -08:00
Chris Robinson
574c1923fe Clear unused buffers after unloading them all 2015-11-25 04:24:25 -08:00
Chris Robinson
5ad772c3b3 Fix streaming sound time 2015-11-25 04:24:25 -08:00
Chris Robinson
3ce6aee98b Return a decoder from the loadVoice function 2015-11-25 04:24:25 -08:00
Chris Robinson
24f8c78fca Store sound buffer references by index instead of string 2015-11-25 04:24:24 -08:00
Chris Robinson
f7218f5a25 Use proper mutex mechanisms and don't check al errors in the stream thread 2015-11-25 04:24:24 -08:00
Chris Robinson
f9e18cd966 Prepare all Sound_Buffer objects when one is needed
This simply sets up the Sound record data to be used by the sound output. The
actual audio buffers, stored in the Sound_Handle, are still loaded on-demand.
2015-11-25 04:24:24 -08:00
Chris Robinson
6c3953766e Use separate lists for the sound name and its buffer
This should make sound lookup a bit more efficient, especially when an integer
ID can be used.
2015-11-25 04:24:24 -08:00
Chris Robinson
fbfcc4050f Stream voice clips
Voices tend to be a bit long, and not individually replayed often. So it's
better to stream them instead of loading theminto a sound buffer. The loudness
data is very small, though, so that can be kept buffered indefinitely.
2015-11-25 04:24:24 -08:00
Chris Robinson
eee6a19e31 Add a method to stream sounds in 3D 2015-11-25 04:24:24 -08:00
Chris Robinson
f1a1dc8408 Pass relevant sound parameters to the OpenAL_SoundStream constructor 2015-11-25 04:24:24 -08:00
Chris Robinson
83721092f2 Refactor the audio streaming code to be a bit saner 2015-11-25 04:24:23 -08:00
Chris Robinson
16f72886e9 Use separate lists for openal sounds and streams 2015-11-25 04:24:23 -08:00
Chris Robinson
0f33f41d8d Actually unload sounds when running over 2015-11-25 04:24:23 -08:00
Chris Robinson
22a6811425 Limit the sound buffer cache to 15MB 2015-11-25 04:24:23 -08:00
Chris Robinson
0b2747098c Keep track of unused sound buffers 2015-11-25 04:24:23 -08:00
Chris Robinson
4073495070 Add some missing sound handling 2015-11-25 04:24:23 -08:00