Commit Graph

270 Commits

Author SHA1 Message Date
rdb fb8a2f2af0 Revert "openal: Grab volume from manager instead of assuming max volume."
This reverts commit 7fb30ae070.

See #64 for discussion.
2018-12-04 15:54:02 +01:00
rdb 7ed9655e06 openal: fix leak of sound data when uncache_sound on stream
This is an addendum to cd2ea97b1f (fix for #428) which did
not properly delete the SoundData when uncaching sounds that were loaded as streams.
2018-11-27 21:11:57 +01:00
Sam Edwards a9dfd8352e general: Distinguish local/system includes
This changes includes so that local includes are consistently
#include "localFile.h"
while system and third-party includes are consistently
#include <systemFile.h>

This commit mostly converts the former to the latter; the two
exceptions are in android_main.cxx and fmodAudioSound.h, where
the reverse was necessary.
2018-11-10 18:00:10 -07:00
rdb cd2ea97b1f openal: fix issues with uncache_sound not uncaching sound:
* Previously it only looked for the resolved path, but sounds are not stored with resolved path in the cache (possibly a different bug?)
* It only uncached samples, not streams

Fixes #428
2018-11-08 15:38:20 +01:00
rdb 98e767c370 fmod: fix FmodAudioSound::get_speaker_mix() 2018-11-06 20:33:56 +01:00
rdb 17bf50f1e8 audio: get_sound and uncache_sound should take Filename, not string 2018-09-02 20:55:58 +02:00
Sam Edwards 4695557a5d general: Don't require BUILDING_* for static builds 2018-08-31 23:54:32 -06:00
rdb abe20fc489 fmod: return NullAudioSound if file does not exist
This matches the OpenAL behaviour, and is needed to fix the unit tests on macOS.
2018-07-08 21:49:37 +02:00
Sam Edwards b2bfb31114 general: Remove `using std::*` from headers
Also remove most `using namespace std;` statements. The only one that remains is in py_panda.h.

Closes #350
Closes #335
2018-06-14 16:04:49 +02:00
Sam Edwards 3c6ebb56bd general: pvector<unsigned char> -> vector_uchar 2018-06-10 02:25:10 -06:00
Sam Edwards 7790f8429d general: Fully qualify header references into the std namespace
Closes #341
2018-06-07 10:35:12 +02:00
Sam Edwards e2b4353800 general: Replace NULL (and 0 as pointer) with C++11 nullptr
Exceptions to this replacement are:
- .c files
- Headers included by a .c file
- stb_image.h
- dr_flac.h
- Strings
- Comments
2018-06-03 16:35:13 -06:00
Sam Edwards 52e7c952b3 putil: Rename config_util to config_putil 2018-05-14 02:36:42 -06:00
Sam Edwards 9dd37e9dbc general: Add guards to ensure proper BUILDING_ macros defined
This is designed to sanity-check the buildsystem, ensuring that the
expected BUILDING_ macros are defined at the expected time. It
also helps catch cases where the wrong BUILDING_/EXPCL_ macros
are used.
2018-03-25 13:17:52 -06:00
Sam Edwards d8b48a3837 openal: `ptr != 0` -> `ptr != NULL` 2018-03-06 19:02:05 -07:00
Sam Edwards 99dc462174 openal: assert -> nassert 2018-03-06 19:02:05 -07:00
Sam Edwards c89bb3d030 openal: "reattempt" -> "retry" 2018-03-06 19:02:05 -07:00
Sam Edwards cb85d01de6 openal: Always use INLINE in .I files 2018-03-06 19:02:05 -07:00
Sam Edwards a10cd7d8bb openal: Always use release_sound_data
This simplifies cleanup() a little bit.
2018-03-06 19:02:05 -07:00
Sam Edwards 9a5d7d8254 openal: Add several asserts
This also includes a few slight style fixes.
2018-03-06 19:02:05 -07:00
Sam Edwards 1a6fb5300b openal: Be explicit about what constructs like `_sound != 0` mean 2018-03-06 19:02:05 -07:00
Sam Edwards fd5ce687b3 openal: Add cleanup guards to buffer functions
Without this, the audio might encounter an error, call cleanup()
on itself, and (if in the middle of update()) try to dereference
its recently cleaned-up _sd pointer.

Fixes #230
2018-03-06 19:02:05 -07:00
Sam Edwards 6ca0a68042 openal: Retry deleting a buffer until success
The rationale for this change is Apple's OpenAL implementation,
which needs a little time after the
`alSourcei(source, AL_BUFFER, 0);`
call before any buffers used by that source are free for deletion.

The defaults in the config variables are such that the OpenAL manager
will attempt to delete a buffer up to 6 times (that is, the original
attempt plus 5 reattempts), with delays of 1ms, 2ms, 4ms, 8ms, and 16ms
before each reattempt - which means it'll wait a grand total of 31ms for
a buffer to be free before assuming that some even greater problem must
be happening and giving up.
2018-03-06 19:02:05 -07:00
Sam Edwards 1862100bac openal: Don't assume alSourceUnqueueBuffers is FIFO 2018-03-06 19:02:05 -07:00
Sam Edwards 50b3b87ad5 openal: Explicitly signal a needed cleanup from require_sound_data 2018-02-20 00:55:49 -07:00
Sam Edwards f970bc3229 openal: Don't return OpenALAudioSounds that fail to initialize
Also don't register them in _all_sounds, where they won't remove themselves
due to having already called cleanup() on themselves.

Additionally stops a sound in a cleaned-up state from being passed to the
app and played.
2018-02-20 00:55:49 -07:00
Sam Edwards 8a7b47d501 audio: Fix memory leak in OpenAL 2018-02-04 23:06:34 -07:00
nosyliam b562aba4e0 Support static linking with FMOD
Closes #241
2018-02-02 23:19:23 +01:00
rdb 5980b0b9ab openal: fix warning spam every frame in newer AL implementations
This fixes error messages being generated of the form:
AL lib: (WW) alSetError: Error generated on context 0x801cf8800, code 0xa003

This is caused by alSourceUnqueueBuffers being called without first checking whether processed buffers are available using alGetSourcei.

Fixes #180
2018-01-05 13:37:00 +01:00
rdb 4cd826e63a Merge branch 'fix-audio-distance-factor' of github.com:nikolmiv/panda3d
Closes: #13
2017-10-31 19:31:27 +01:00
rdb a866f9fbcb audio: fix case of get_speaker_setup/set_speaker_setup methods 2017-07-09 15:47:09 +02:00
rdb 4ed199cece Fix various compile warnings and a few code consistency issues 2017-01-09 20:36:53 +01:00
rdb 1049088f11 Clean up some of the dtool_config.h variables 2016-10-24 22:10:46 +02:00
rdb 18874fa151 Replace PN_int/uint types with stdint.h types, since all compilers we support have them.
Plus, we already had code that relied on them being available anyway.
2016-05-11 00:27:58 +02:00
rdb 288452a861 Changes to help with static build, allow linking OpenAL statically 2016-04-29 19:54:24 +02:00
rdb dc09e28ed9 Also accept a .gz wherever a .pz file is accepted 2016-04-29 16:54:25 +02:00
tobspr 0fcfb8e372 New file headers, new comment style 2016-02-17 17:47:48 +01:00
rdb 090e912ce6 Cleanup of comments and whitespace 2016-02-01 22:30:43 +01:00
Harvir 7fb30ae070 openal: Grab volume from manager instead of assuming max volume. 2015-11-29 01:33:03 +00:00
rdb 3c2f820ad8 Merge branch 'release/1.9.x'
Conflicts:
	direct/src/p3d/DeploymentTools.py
2015-11-24 13:39:36 +01:00
rdb a98d50cd61 Fix for older OpenAL versions 2015-11-23 16:33:16 +01:00
rdb f84b9e1f63 More reliable OpenAL device selection mechanism, add fallbacks, prefer "OpenAL Soft" over "Generic Software" 2015-11-23 16:17:44 +01:00
rdb db3ab953e4 Remove ppremake, genPyCode, and all hacks created to support them 2015-11-09 19:06:49 +01:00
Ed Swartz 4916aaca54 Add 'openal-device' configuration variable for selecting OpenAL device 2015-08-11 09:29:26 -05:00
rdb 82b3268786 Prevent crash when OpenAL device creation fails 2015-04-01 02:55:20 +02:00
Nikola Milentijevic c0b2468b04 Consolidate distance factor for 3D audio
The semantics of distance factor is now same for both OpenAL and Fmod.
The value is given in units per meter, and the default is 1.0.
This means that Panda units are understood to be meters by default.
For example, for feet one would have to set this value to 3.28.
2015-03-16 22:24:29 +01:00
rdb 8a5f07f9c3 Forgot two HAVE_FMODEX lines 2015-01-05 18:10:45 +01:00
rdb 936fa653b0 Remove unneeded HAVE_ flags from dtool_config.h generation 2015-01-04 20:34:59 +01:00
rdb a65b477734 Commit patches by cfsworks:
cxx: Fix missing includes masked by composite builds.
misc: Fix typos in comments.
config: Fix missing config forward-declarations.
direct: Adjust Python imports to panda3d.* instead of pandac.*.
display: Split graphicsWindow out into an extension.
framework: Use if/elif/elif/endif instead of ifdef/elif/elif/endif.
ode: Remove erroneous INLINE declarations.
interval: Fix missing import.
2014-10-19 22:41:47 +00:00
rdb 28ba81f82d Commit patch by cfsworks to properly mark OpenAL sounds as inactive when they are created while the manager is inactive 2014-04-24 13:01:01 +00:00