Commit Graph

37 Commits

Author SHA1 Message Date
Paramat
0df3671a34 Fix recent commit: std::max -> std::fmax for floats (#6469)
Fixes commit a455297d297c0819a7eff89e51e5f01a5ac731c3
<cmath> header was already present in commit.
2017-09-27 23:03:41 +02:00
paramat
a455297d29 Positional sound: Limit volume when closer than 1 node
Change OpenAL distance model from AL_INVERSE_DISTANCE to
AL_INVERSE_DISTANCE_CLAMPED to avoid excessive volume when very close
to the sound location, for example MTG doors, and MTG fire sounds which
are combined at an average position and often located in air nodes.

Because AL_REFERENCE_DISTANCE has been reduced to 1 node (the distance
under which gain is clamped), multiply volume by the same factor to keep
sound gains the same as before, since the gain is calculated as:

gain = (AL_REFERENCE_DISTANCE / distance)
2017-09-25 19:09:21 +01:00
Loïc Blot
ae9b5e0098 Modernize code: very last fixes (#6290)
Last modernization fixes
2017-08-20 19:37:29 +02:00
Loïc Blot
1c1c97cbd1 Modernize source code: last part (#6285)
* Modernize source code: last par

* Use empty when needed
* Use emplace_back instead of push_back when needed
* For range-based loops
* Initializers fixes
* constructors, destructors default
* c++ C stl includes
2017-08-20 13:30:50 +02:00
Loïc Blot
7528986e44 Code modernization: src/p*, src/q*, src/r*, src/s* (partial) (#6282)
* Code modernization: src/p*, src/q*, src/r*, src/s* (partial)

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* C++ STL header style
* Spelling: vertice -> vertex
2017-08-19 14:25:35 +02:00
Rui
bbe3dd9a7a Fix no sound bug (#5968) 2017-06-14 17:21:08 +02:00
Rui
ff73c7a5da Sound: Add pitch option (#5960)
* Sound: Add pitch option
2017-06-11 13:58:26 +02:00
Loïc Blot
a98baef5e4 C++11 patchset 2: remove util/cpp11.h and util/cpp11_container.h (#5821) 2017-06-04 21:00:04 +02:00
Brandon
bd921a7916 Sound API: Add fading sounds 2017-05-03 03:12:45 +01:00
paramat
a5ee7139a5 OpenAL sound: Use a simpler distance model
In createPlayingSoundAt(), AL_ROLLOFF_FACTOR is not set, so it has
the default value of 1.0, this makes the equation of the currently
used AL_EXPONENT_DISTANCE distance model identical to the equation
of the simpler AL_INVERSE_DISTANCE distance model.

Using AL_INVERSE_DISTANCE means an exponent is not processed,
exponents are quite intensive to process.
There is no change in sound attenuation behaviour.

The commented-out AL_ROLLOFF_FACTOR value is removed as it would
now have a different effect if used.
2017-02-09 00:10:35 +00:00
Loic Blot
5f084cd98d Make some maps unordered to improve performance
* This permit to improve performance on C++11 builds
* use some existing typedefs in tools maps
* minor code style changes
2016-10-05 07:30:32 +02:00
David Carlier
48b3bb980d couple of memory leaks fixes. 2016-08-10 16:59:32 +02:00
Jay Arndt
6fead2818a Remove unused OpenALSoundManager::m_can_vorbis and EXT_vorbis check 2015-12-01 00:36:11 +00:00
est31
bdfb761dd0 sound_openal.cpp: remove unused header 2015-11-15 08:17:32 +01:00
est31
395ef21c86 Load sound from memory
* Remove trailing lines from src/sound_openal.cpp
* Don't do a horribly ugly copy of the file's path, allocating and deallocating a
	10 kb buffer in the process. This copy was needed for backwards compatibility
	with libvorbis 1.3.1 and earlier, as the removed comment explains.
	However, even Ubuntu precise has 1.3.2 already. Dropping support and sparing
	the ugly copy can therefore be considered safe.
* Actually load sounds from the memory, not caching them at the disk first,
	removing the old hack. This is the main motivation for the commit.
2015-11-14 18:17:32 +01:00
ShadowNinja
96cc5b34fe Use warningstream for log messages with WARNING
Remove DTIME macro and its uses, too
2015-10-14 01:36:48 -04:00
David Jones
34b7a147dc Change i++ to ++i 2015-08-25 18:33:52 -04:00
Craig Robbins
ced6d20295 For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives 2015-03-07 22:41:47 +10:00
Anton
10e0cf8b2c Use std::string::empty() instead of size() where applicable 2014-12-12 15:16:24 -05:00
Selat
7cac34c807 Pass arguments by reference 2014-03-12 17:34:48 -04:00
sapier
e7247c1a66 fix memory leak on sound shutdown 2013-04-07 23:43:34 -04:00
Sfan5
6d0ea26c2d Update Copyright Years 2013-02-24 20:15:24 +01:00
PilzAdam
497ff1ecd6 Change Minetest-c55 to Minetest 2013-02-24 18:49:03 +01:00
Thomas Lauro
7a14171be4 Fix issue with openal mac os x compile 2012-09-01 18:19:59 +03:00
Perttu Ahola
d0ea6f9920 Properly and efficiently use split utility headers 2012-06-17 02:40:36 +03:00
Perttu Ahola
1bc37d576c Initially split utility.h to multiple files in util/ 2012-06-17 01:29:13 +03:00
Perttu Ahola
037b259197 Switch the license to be LGPLv2/later, with small parts still remaining as GPLv2/later, by agreement of major contributors 2012-06-05 18:54:07 +03:00
Perttu Ahola
6a57eabb14 Handle failing openal init properly, add enable_sound and sound_volume settings 2012-04-06 15:30:36 +03:00
Perttu Ahola
5436f1c7d5 Attempt to fix sound left-right channels 2012-04-06 00:39:37 +03:00
Perttu Ahola
cbe11fc7aa Do a dumb-ass static string copy for const-incorrect old versions of ov_fopen 2012-03-27 00:06:26 +03:00
Perttu Ahola
db0928add3 Sound loading from memory (by using a quick hack) 2012-03-25 15:52:43 +03:00
Perttu Ahola
1cac1de3b2 Almost support loading sounds from server 2012-03-25 14:48:22 +03:00
Perttu Ahola
77621568fd Fix build on MinGW (as compared to Linux) 2012-03-24 23:16:09 +02:00
Perttu Ahola
601d1936c9 Lua API for playing sounds 2012-03-24 19:01:26 +02:00
Perttu Ahola
93219e3b9d Add sounds, tune things 2012-03-24 04:24:26 +02:00
Perttu Ahola
8c2f3bb378 c55sound continued 2012-03-24 04:24:25 +02:00
Perttu Ahola
c301e3c82a celeron55's sound system initial framework 2012-03-24 04:24:23 +02:00