Commit Graph

467 Commits (openmw-39)

Author SHA1 Message Date
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.
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
Chris Robinson ea70b0baee Don't store the buffer in the sound struct 9 years ago
Chris Robinson fd7d58fe7e Reset the sound handle back to null after unloading 9 years ago
Chris Robinson 4801661b34 Stop all sounds of the given id 9 years ago
Chris Robinson 8a69f676ec Remove some duplicate code 9 years ago
Chris Robinson 45628316f8 Remove an unnecessary check 9 years ago
Chris Robinson 574c1923fe Clear unused buffers after unloading them all 9 years ago
Chris Robinson 5ad772c3b3 Fix streaming sound time 9 years ago
Chris Robinson 3ce6aee98b Return a decoder from the loadVoice function 9 years ago
Chris Robinson 24f8c78fca Store sound buffer references by index instead of string 9 years ago
Chris Robinson f7218f5a25 Use proper mutex mechanisms and don't check al errors in the stream thread 9 years ago
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.
9 years ago
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.
9 years ago
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.
9 years ago
Chris Robinson eee6a19e31 Add a method to stream sounds in 3D 9 years ago
Chris Robinson f1a1dc8408 Pass relevant sound parameters to the OpenAL_SoundStream constructor 9 years ago
Chris Robinson 83721092f2 Refactor the audio streaming code to be a bit saner 9 years ago
Chris Robinson 16f72886e9 Use separate lists for openal sounds and streams 9 years ago
Chris Robinson 0f33f41d8d Actually unload sounds when running over 9 years ago
Chris Robinson 22a6811425 Limit the sound buffer cache to 15MB 9 years ago
Chris Robinson 0b2747098c Keep track of unused sound buffers 9 years ago
Chris Robinson 4073495070 Add some missing sound handling 9 years ago
Chris Robinson e362896817 Combine some duplicate code 9 years ago
Chris Robinson febc7b510a Remove an unneeded method 9 years ago
Chris Robinson 3fdc3c4ea9 Use a separate map for say sounds
Also restores lip movement
9 years ago
Chris Robinson 9d0018e1bc Reorder active sound data to make lookup by Ptr better 9 years ago
Chris Robinson 495e138907 Load sound loudness and store it with the Sound_Buffer
Still not used for say yet, though
9 years ago
Chris Robinson f4c22ec49e Hold a separate list for voice sound buffers
This fixes say. Ideally voices would be streamed, but the loudness/"lip" buffer
extraction should be separated from the buffer loading code.
9 years ago
Chris Robinson 4571218827 Load the sound as needed and pass it directly to the play methods
This breaks say sounds, loudness handling, and the cache limit. Fixes are
forthcoming.
9 years ago
Chris Robinson e2beefd8b5 Store info calculated from the ESM::Sound record 9 years ago
scrawl f08cfa19ea Fix SoundManager::isPlaying to consider multiple entries with the same Ptr/id
Now it returns true if *any* sounds matching the given Ptr and id are playing. The previous behaviour was causing problems with "zombie" sounds (sounds that have finished playing, but weren't removed from the map yet) making the isPlaying method return false even though there's another legitimately playing sound in the map.
9 years ago
Bret Curtis 3ea3d07d44 really purge libav 9 years ago
dteviot 77a1d947cc extracted MWMechanics::getPlayer() 10 years ago
scrawl cd2e6d4436 Move the __STDC_CONSTANT_MACROS define to cmakelists 10 years ago
scrawl 4bb3cbf0fb Remove last remains of Ogre 10 years ago
scrawl 84fd682e4e Fix for unnecessary exceptions when opening sounds
This would throw often during normal play, even though the throws are caught and ignored, can be annoying when the debugger is set to 'catch throw'.
10 years ago
scrawl 76dd3e4034 Fix lip animation regression 10 years ago
scrawl 152d690a7a Minor cleanup 10 years ago
scrawl 22f01b1232 Merge branch 'master' of https://github.com/OpenMW/openmw into osg
Conflicts:
	apps/launcher/graphicspage.cpp
	apps/opencs/editor.cpp
	apps/opencs/model/doc/document.cpp
	apps/opencs/view/render/cell.cpp
	apps/opencs/view/render/mousestate.cpp
	apps/opencs/view/render/textoverlay.cpp
	apps/opencs/view/render/worldspacewidget.cpp
	apps/openmw/mwclass/creature.cpp
	apps/openmw/mwclass/npc.cpp
	apps/openmw/mwgui/inventorywindow.cpp
	apps/openmw/mwgui/loadingscreen.cpp
	apps/openmw/mwgui/mapwindow.cpp
	apps/openmw/mwgui/pickpocketitemmodel.cpp
	apps/openmw/mwgui/waitdialog.cpp
	apps/openmw/mwmechanics/combat.cpp
	apps/openmw/mwmechanics/mechanicsmanagerimp.cpp
	apps/openmw/mwrender/globalmap.cpp
	apps/openmw/mwworld/physicssystem.cpp
	apps/openmw/mwworld/refdata.cpp
	apps/openmw/mwworld/scene.cpp
	apps/openmw/mwworld/worldimp.cpp
	components/sdlutil/sdlinputwrapper.cpp
	extern/shiny/Main/Factory.cpp
	extern/shiny/Main/MaterialInstance.cpp
	extern/shiny/Main/Platform.cpp
	extern/shiny/Main/ShaderSet.cpp
10 years ago
Rohit Nirmal 396fba7fa9 Silence -Wreorder warnings, and remove -Wno-reorder. 10 years ago
scrawl 7a3bc69df7 Readded sound listener 10 years ago
scrawl a59940a2c7 Move MyGUI platform to components 10 years ago
scrawl 8c810e3620 Move rng to components 10 years ago
scrawl c53a56ed6e clear stream errors before attempting the read 10 years ago
scrawl 92ef9b1c57 Rename to osg-ffmpeg-videoplayer 10 years ago
scrawl 42f6d9e15b Port video player 10 years ago
scrawl 8c7c89a4aa Port SoundManager 10 years ago
scrawl 4e69e7cc0f OpenMW compiles and runs w/o render window 10 years ago
Marc Zinnschlag 86d39cede9 Merge remote-tracking branch 'dteviot/Rng' 10 years ago
dteviot 3f28634d1f consolidate random number logic
Note, I suspect Rng::rollClosedProbability() is not needed.  The only difference between it and rollProbability() is that one time in 37k (on Windows), it will give an output of 1.0.
On some versions of Linux, the value of 1.0 will occur about 1 time in 4 billion.
10 years ago
dteviot 1d7f3474fa Fixed more MSVC 2013 warnings. 10 years ago
scrawl 3879ce6ac1 Get rid of "player" string checks (Fixes #2216) 10 years ago
dteviot e197f5318b fixing MSVC 2013 warning C4244: & C4305
conversion from 'const float' to 'int', possible loss of data
conversion from 'double' to 'int', possible loss of data
conversion from 'float' to 'int', possible loss of data
10 years ago
dteviot 407cd50890 fixed warning C4099:
type name first seen using 'class' now seen using 'struct'
10 years ago
scrawl ad8790fba0 Fix setWaterLevel script instruction not affecting physics 10 years ago
scrawl fec8cf91f5 Add exception handling to various uses of DataStream::read 10 years ago
scrawl 855fe33c59 Add vanilla-compatible range limiting for playloopsound (Fixes #244, Fixes #1342) 10 years ago
scrawl cf85cbbc8e Switch sound distance model to AL_INVERSE_DISTANCE 10 years ago
scrawl fbed429b25 Use GMSTs for sound fading distance 10 years ago
Marc Zinnschlag 29c9b6bd01 Merge remote-tracking branch 'scrawl/master' 10 years ago
scrawl 17cb181f88 Use av_get_default_channel_layout for unknown channel layouts 10 years ago
scrawl efa4d09c48 Fix crash when avcodec_decode_audio4 doesn't return a full frame (Fixes #2088) 10 years ago
Marc Zinnschlag 8b3d876534 Merge remote-tracking branch 'lgro/ffmpeg_decoder' 10 years ago
scrawl ac067564ea Don't include al.h in decoder classes, format support check will need to be redone later. For now, resample all formats that might not be supported on any hardware. 10 years ago
scrawl 55c9c0a266 Audio resampling fixes
- Don't try to use float audio or extended channel layouts if the hardware does not support them
- Add channel layout resampling support to ffmpeg_decoder
10 years ago
scrawl b39d69e98c Videoplayer fixes, play/pause & seeking
- Fix rindex overflow
 - Fix audio sample size bugs (was using sample_fmt and channel count of the decoder, instead of the resampled settings). We didn't notice this bug before, because the OpenAL MovieAudioFactory tries to resample to a format of the same byte size.
 - Add support for play/pause and seeking controls (not used by cutscenes in OpenMW)
 - Closing the video when arriving at the stream end is now handled by the user (we may also want to keep the video open and seek back)

The video player now has a standalone demo, at https://github.com/scrawl/ogre-ffmpeg-videoplayer
10 years ago
scrawl eb1c24ffe6 Refactor video player engine to get rid of MWSound dependencies
- Split video player to separate source files.
 - Move video player engine sources to extern/ (repository will be set up on github soon).
 - Audio is handled in a MovieAudioFactory, implemented by the user (here in MWSound subsystem).
 - Handle conversion of unsupported channel layouts via ffmpeg's swresample.
10 years ago
Marc Zinnschlag eb45793eab Merge remote-tracking branch 'thoronador/fix-numeric-limits-usage' 10 years ago
Thoronador 4d62541b62 fix usage of numeric_limits static functions min() and max()
Functions min() and max() of std::numeric_limits<T> are static
and can therefore be accessed via class name and :: operator.
10 years ago
scrawl 9edcc332ec Don't remove player's sounds when unloading a cell 10 years ago
scrawl 7252cb63a6 Fix cppcheck issues 10 years ago
Lukasz Gromanowski c72369fafe Simplified casting when comparing to AV_NOPTS_VALUE.
AV_NOPTS_VALUE is casted to int64_t when compared with pts,
so with libavc >= 56.1 it should be no-op because in that version
it's already signed int.

Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
10 years ago
Lukasz Gromanowski 7ad6a94523 Removed a warning about comparision between signed and unsigned variable in ffmpeg_decoder.
Added ifdefs because changes in API were introduced in libavc 56.1
and this code doesn't compile with older versions (ie. on Ubuntu, or Debian)

Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
10 years ago
Lukasz Gromanowski 6987dd768a Removed a warning about comparision between signed and unsigned variable in ffmpeg_decoder.
Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
10 years ago
cc9cii 1107156334 Workaround incorrectly reported channel_layout 10 years ago
cc9cii 675d11c0e5 Mental note: need to get a linux box 10 years ago
cc9cii 8fe6877cb2 More include madness b/w different systems & compilers 10 years ago
cc9cii de41dfc314 Add includes. 10 years ago
cc9cii 0121fdca2c Don't use C99 in printf. 10 years ago
cc9cii be74db8b24 Don't use to_string() 10 years ago
cc9cii ecd9dd81ea Moved debug statements before exception.. 10 years ago
cc9cii ce3077c970 Test version with debug statements. Also moved some common code out to a separate file. 10 years ago
cc9cii 48a36442c6 Add libswresample and libavresample support for sounds. 10 years ago
scrawl 45af34d189 Merge branch 'master' of https://github.com/OpenMW/openmw 11 years ago
scrawl a59620f643 Cache loudness vector in the buffer cache 11 years ago
scrawl 0943ff0886 Fix normalizing sample values 11 years ago
scrawl 598c0c4ae7 Implement mouth animation for NPCs based on say sound (Fixes #642) 11 years ago
bogglez b56cb7e5ee Remove defunct option for building without FFmpeg
- Added REQUIRED to find_package(FFmpeg)
- Removed USE_FFMPEG option from CMakeLists.txt
- Always use FFmpeg for sound input
- Removed SOUND_DEFINE from CMakeLists.txt
- Removed #else branch from videoplayer.cpp with dummy VideoState code
  (FFmpeg is now guaranteed to exist and the code was incomplete)
- Remove #ifdef OPENMW_USE_FFMPEG in ffmpeg_decoder.cpp, it is guaranteed to be used
- Remove #ifdef OPENMW_USE_FFMPEG from soundmanagerimp.cpp, it is guaranteed to be used
11 years ago
scrawl 7b1e1d03d8 Merge branch 'master' of https://github.com/OpenMW/openmw
Conflicts:
	apps/openmw/mwrender/sky.hpp
11 years ago
scrawl 09926a86cb Fix comparing outdated listener position with up-to-date cell (Fixes #1499) 11 years ago
slothlife 9ea22324f7 Fix some MSVC warnings.
Several fixes are warnings about truncations on 64-bit, while others are
complaints about mixed signed / unsigned integer operations.
11 years ago
scrawl 80f66e2157 Fix crash when avformat_open_input fails (Fixes #1522) 11 years ago
scrawl be6f1fe4fe Fix a sign error 11 years ago
scrawl d970cc06d7 Don't play the same music track twice in a row (Fixes #746) 11 years ago
Marc Zinnschlag f7c89015f9 Merge remote-tracking branch 'scrawl/master' 11 years ago
scrawl e5a21aca53 Refactor projectiles to no longer use MW-objects 11 years ago
slothlife f33559fead Fixes for MSVC warnings, less overall changes
Kept some fixes from the first round of review. Found out that several
targets weren't being built with the same basic warnings disabled.
Disabled a few warnings for external libraries specifically, rather than
applying them to all targets.
11 years ago
slothlife c160a04ede Revert "Fixes for warnings when building with MSVC"
This reverts commit 46eb20b98c.
11 years ago
slothlife 46eb20b98c Fixes for warnings when building with MSVC
Most warnings are innocuous (wrong type-specifier for forward
declarations, conversion of literals into unsigned integers, warnings
about methods optimized out), but I believe actual bugs were revealed in
vartypedelegate.cpp and combat.cpp.
11 years ago