Commit Graph

184 Commits

Author SHA1 Message Date
e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
5f11e15571 Merge pull request #37504 from qarmin/out_of_bound_cursor
Fix array out of bounds access caused by uninitialised variables
2020-04-02 13:07:55 +02:00
359bebd8c0 Fix out of bound array access caused by unassigned variable 2020-04-01 19:29:35 +02:00
cd4e46ee65 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.
2020-03-30 09:05:53 +02:00
9d24541597 Remove unused classes and stray headers
Found by reviewing headers with 1 or less matching includes:
```
find -name thirdparty -prune -o -name "*.h" -exec basename {} \; | sort -u > headers
for header in $(cat headers); do echo "$header: "; rg -l "#include \"(.*/)?$header\"" | wc -l; done > list-includes
```
2020-03-24 09:50:51 +01:00
cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +01:00
18fbdbb456 Reimplement Mutex with C++'s <mutex>
Main:
- It's now implemented thanks to `<mutex>`. No more platform-specific implementations.
- `BinaryMutex` (non-recursive) is added, as an alternative for special cases.
- Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes.
- Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts.
- A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this.
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- Thread-safe utilities are therefore simpler now.

Misc.:
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
- Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock).
- `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
2020-02-26 20:40:10 +01:00
33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
3c0059650d Added StringName as a variant type.
Also changed all relevant properties defined manually to StringName.
2020-02-21 14:25:29 +01:00
3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
f0db13502a Remove duplicate WARN_PRINT macro. 2020-02-05 11:13:24 +01:00
bb6c0d3e8b doc: Complete documentation for VideoStreams
Also quick clean up of the matching C++ files.
2020-01-26 11:29:07 +01:00
837adb30fd Revert "Exposes capture methods to AudioServer + documentation" #30468
Reverts the following commits:

- c81ec6f26d:
  "Exposes capture methods to AudioServer, variable renames for
  consistency, added documentation."
- 47c558b98a:
  "Expose audio callbacks as signals."
- dabaa11b3c:
  "Fix to make sure the capture buffers are deallocated at shutdown.
  Silences warnings."

Some documentation improvements were kept for pre-existing methods.

See rationale for reverting these changes in #30468.
2020-01-20 13:18:01 +01:00
a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
86096313be Fixed an issue with recording audio.
Prior to this fix, AudioEffectRecordInstance::init() was called before recording_active is set to true in AudioEffectRecord::set_recording_active(). This was setting is_recording to false in AudioEffectRecordInstance, because is_recording updates to the value of recording_active in AudioEffectRecordInstance::_io_thread_process(). To fix this issue, AudioEffectRecordInstance::init() is now called after recording_active is set to true.
2019-12-12 10:28:46 -05:00
2143f46df2 Merge pull request #33516 from qarmin/small_fixes
Memory leaks and crash fixes
2019-11-10 10:17:19 +01:00
7dda9309f9 Memory leak and crash fixes 2019-11-10 09:49:13 +01:00
fea58321e6 Fix 'r1' (and r2) may be used uninitialized warning in eq.cpp. 2019-11-08 08:37:06 +01:00
d8ba9f1824 Fix recording bus regression. 2019-08-12 08:10:56 +01:00
5ca7460421 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in "main" and "servers" directories 2019-08-09 11:27:39 -03:00
af935af38d Merge pull request #30468 from SaracenOne/expose_audio_capture
Exposes capture methods to AudioServer + documentation
2019-08-07 13:27:25 +02:00
12ae7a4c02 Update some dead links in the codebase 2019-07-23 21:06:12 -03:00
c81ec6f26d Exposes capture methods to AudioServer, variable renames for consistency,
added documentation.
2019-07-15 15:12:29 +01:00
9387114ce1 Tweak audio cutoff property hints to allow reasonable values only
This also makes all cutoff property hints consistent.

This closes #29588.
2019-07-12 22:44:17 +02:00
6b30f284a0 Merge pull request #29980 from Dentrax/directed-by-qarmin
Fix some editor crashes
2019-07-01 14:59:29 +02:00
380bf04566 Merge pull request #29413 from YeldhamDev/global_rate_scale
Add 'global_rate_scale' to the AudioServer
2019-07-01 13:53:04 +02:00
7d8d337b2c fix some crashes 2019-07-01 14:28:29 +03:00
4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
1c2ba35074 Add 'global_rate_scale' to the AudioServer
Closes #28953.
2019-06-19 11:36:46 -03:00
38d3bfe971 Made use of semicolons more consitent, fixed formatting 2019-06-19 15:24:31 +02:00
0eb8484c8a Merge pull request #29037 from mdahlgrengadd/master
Make FFT size and oversampling adjustable in smbPitchShifter, add windowing to smbFFT
2019-06-19 12:31:09 +02:00
f18121824c Add missing license headers
Make `fix_headers.py` script compatible with Python 3.
2019-06-11 15:33:32 +02:00
17adece6ad Add windowing before FFT to avoid flickering spectrogram 2019-06-03 12:58:33 +02:00
f78c7377c9 Make FFT size and oversampling adjustable for pitchshifting 2019-06-03 12:56:45 +02:00
47f628a013 Fix getting max magnitude in AudioEffectSpectrumAnalyzer 2019-05-24 12:40:04 +02:00
e0574e1d98 Fix typos with codespell
Using codespell 1.15.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
doubleclick
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-05-19 13:10:35 +02:00
9285aad8b3 Fix AudioEffectRecord messing up the effect stack by not writing to dst_frames 2019-05-09 18:03:08 +03:00
af9bb0ea15 Clean up latency related functions 2019-04-27 12:23:05 -03:00
a342131eba Merge pull request #27673 from qarmin/small_fixes
Small fixes, mostly duplicated code
2019-04-22 12:00:34 +02:00
d0f2b5c8ab Bind AudioEffectSpectrumAnalyzer::FFT_Size enums 2019-04-16 18:00:19 +02:00
e33764744c Added generator audio stream, and spectrum analyzer audio effect
Made AudioFrame and Vector2 equivalent for casting.
Added ability to obtain the playback object from stream players.
Added ability to obtain effect instance from audio server.
2019-04-10 12:58:06 -03:00
856a8226a5 Small fixes, mostly dupicated code 2019-04-08 11:03:37 +02:00
f529649cec Fix possible crash on AudioDriver::input_buffer_write 2019-03-02 19:41:45 -03:00
f04bff349b Fix possible crash when AudioDriver::capture_start fails 2019-03-01 09:33:15 -03:00
e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
7de7f0ef17 Fix all -Wtype-limits warnings. 2019-02-21 19:34:35 +01:00
8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
4148eed943 Merge pull request #24324 from volzhs/access-mic
Request mic access only when is needed
2018-12-14 08:57:22 +01:00