Commit graph

36 commits

Author SHA1 Message Date
Rémi Verschelde
140350d767
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2021-05-05 15:02:01 +02:00
Rémi Verschelde
a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde
b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Hein-Pieter van Braam-Stewart
6e9cea9fd2 An update to the dylibloader for older inttypes
This #define's older inttypes to their newer versions and #includes
<stdint.h> in the generated files. This will help with older
glibc/compiler versions using headers generated on newer systems.

cherry picked from 5233d78f49
2021-02-20 01:25:19 +01:00
Pedro J. Estébanez
6d89f675b1 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez
4ddcdc031b Modernize Mutex
- Based on C++11's `mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
- `BinaryMutex` added for special cases as the non-recursive version
- `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`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
2021-02-18 11:58:08 +01:00
Hein-Pieter van Braam-Stewart
228803e9db Dynamically load libpulse.so.0 and libasound.so.1 on Linux
By generating stubs using https://github.com/hpvb/dynload-wrapper we
can dynamically load libpulse and libasound on systems where it is available.
Both are still a build-time requirement but no longer a run-time dependency.

For maintenance purposes the wrappers should not need to be re-generated
unless we want to bump pulse or asound to an incompatible version. It is
unlikely we will want to do this any time soon.

cherry-pick from 09f82fa6ea
2021-02-17 10:31:52 +01:00
Rémi Verschelde
49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Cooper Harasyn
4bf141a47e
Prevent ALSA audio corruption
When using the ALSA driver, corruption would occur if `snd_pcm_writei`
was unable to consume the entire sound buffer. This would occur
frequently on the Raspberry Pi 3 which uses the `snd_bcm2835` audio
driver.

This bug resulted from incorrect pointer math on line 187, resulting in
the sample source pointer being advanced by `total * ad->channels` bytes
instead of `total * ad->channels` samples. In my opinion, the best fix
is to change `*src` to type `int16_t`, since that is the sample type in
use.

Fixes #43927.

(cherry picked from commit 25b2f82ccf)
2020-12-01 09:00:53 +01:00
Fabio Alessandrelli
92031098bf Move mixrate and latency definition to AudioServer
Each driver used to define the (same) project settings value, but the
setting names are not driver specific. Ovverriding is still possible via
platform tags.

(cherry picked from commit 90c7102b51)
2020-05-18 16:40:33 +02:00
Rémi Verschelde
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
qarmin
50be65bf43 Changed some code found by Clang Tidy and Coverity 2019-09-22 18:45:08 +02:00
Rémi Verschelde
b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Wilson E. Alvarez
08f22f1cf0
Moved member variables to initializer list 2018-12-11 18:33:01 -05:00
Rémi Verschelde
277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Rémi Verschelde
de59fe04e7 Add print_verbose to print to stdout only in verbose mode
Equivalent of the cumbersome:
if (OS::get_singleton()->is_stdout_verbose())
	print_line(msg);
2018-08-24 09:23:20 +02:00
Hein-Pieter van Braam
0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Ibrahn Sahir
3e85e89dc5 correctly close handle in alsa audio driver. 2018-07-23 13:14:04 +01:00
Marcelo Fernandez
9f6536bd0a Add Audio Server profiling time to the profiler 2018-07-17 10:11:56 -03:00
Marcelo Fernandez
ecc1b34cbc Added new audio device functions to set/get the audio device 2018-03-26 17:41:05 -03:00
Rémi Verschelde
e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde
b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Marcelo Fernandez
f231eadc9e Corrections to audio buffer size calculations 2017-09-01 11:12:13 -03:00
Rémi Verschelde
bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Marcelo Fernandez
eab850524e Add closest_power_of_2 func and implement mix_rate/latency on OS X 2017-08-17 19:51:13 -03:00
Juan Linietsky
25678b1876 -Renamed GlobalConfig to ProjectSettings, makes more sense.
-Added system for feature overrides, it's pretty cool :)
2017-07-19 17:06:03 -03:00
Rémi Verschelde
df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
Rémi Verschelde
5dbf1809c6 A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
2017-03-05 16:44:50 +01:00
Juan Linietsky
de0045cf1b -renamed globals.h to global_config.cpp (this seems to have caused a few modified files)
-.pck and .zip exporting redone, seems to be working..
2017-02-21 00:06:30 -03:00
Rémi Verschelde
7b059965e8 Adapt platforms to AudioServer refactoring
Fixes compilation on Windows and likely other platforms (at least
as far as AudioServer changes were concerned), though they were
not tested.
2017-01-16 19:19:45 +01:00
Juan Linietsky
b400c69cd4 Oops! Audio engine has vanished :D 2017-01-15 16:07:51 -03:00
lonesurvivor
da6b6c2dd7 Fix for the huge audio latency of the SamplePlayer (>200 ms)
- fixes PulseAudio, ALSA and RtAudio driver
- cleans up the driver files for better readability (mostly whitespace-related stuff)
- makes ALSA and Pulseaudio actually use the global setting "audio/mix_rate" for the sample rate instead of a
fixed value (RtAudio did this already)
2017-01-05 15:36:29 +01:00
Rémi Verschelde
c7bc44d5ad Welcome in 2017, dear changelog reader!
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer
with state-of-the-art rendering techniques tuned to work as low as middle
end handheld devices - without compromising with the possibilities given
for higher end desktop games of course. Great times ahead for the Godot
community and the gamers that will play our games!
2017-01-01 22:03:33 +01:00
George Marques
5be9ff7b67 Update copyright to 2016 in headers 2016-01-01 11:50:53 -02:00
Juan Linietsky
fdaa2920eb Updated copyright year in all headers 2015-04-18 14:38:54 -03:00
Juan Linietsky
0b806ee0fc GODOT IS OPEN SOURCE 2014-02-09 22:10:30 -03:00