Commit Graph

68 Commits

Author SHA1 Message Date
Thaddeus Crews
73830b3c12
Merge pull request #88628 from bruvzg/i_have_no_idea_what_im_doing
[macOS/iOS] Use hardware sampling rates for audio I/O.
2024-10-29 19:25:47 -05:00
Adam Scott
0d350e7108
Set clang-format RemoveSemicolon rule to true
- Set clang-format `Standard` rule to `c++20`
2024-10-25 13:49:43 -04:00
bruvzg
c8609f4c0f
[macOS/iOS] Use hardware sampling rates for audio I/O. 2024-10-25 19:26:24 +03:00
Cadence
b4fd9d1f38 Fix iOS audio driver attempting to start output too early 2024-10-18 13:05:30 -04:00
Thaddeus Crews
9f9ee0c813
SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
Stuart Carnie
41875d8aef
macOS/iOS: Fix various warnings when targeting newer SDKs 2024-08-20 11:55:21 +02:00
A Thousand Ships
3565d1bf7e [Drivers,Platform] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-12 20:13:32 +02:00
Hugo Locurcio
6f1152bdbe
Add a --audio-output-latency command-line argument
This allows optimizing the audio output latency on higher-end CPUs,
especially in projects that do not expose a way to override this setting.
2023-08-17 14:45:17 +02:00
Rémi Verschelde
9e4315bb50
Style: Harmonize header includes in platform ports
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module should be included with relative
paths (relative to the root folder of the modular component, e.g.
`platform/linuxbsd/`), in their own section before Godot's "core" includes.

The `api` and `export` subfolders also need to be handled as self-contained
(and thus use relative paths for their "local" includes) as they are all
compiled for each editor platform, without necessarily having the api/export
matching platform folder in the include path.
E.g. the Linux editor build will compile `platform/android/{api,export}/*.cpp`
and those need to use relative includes for it to work.
2023-06-08 15:19:19 +02:00
Eoin O'Neill
5a08091168 Fix crash caused by invalid mix_rate assignment due to bogus
project settings.

We'll default to a sensible value in the case that a user has
somehow managed to modify the configuration file incorrectly.

Closes 69819
2023-04-25 23:52:50 -07:00
Emmanouil Papadeas
c36460060e
Further refactoring to AudioDriver implementations after #69120.
- Rename all instances of `capture_start()` and `capture_end()` to their new
  names. Fixes #72892.
- More internal renames to match what was started in #69120.
- Use `override` consistently so that such refactoring bugs can be caught.
- Harmonize the order of definition of the overridden virtual methods in each
  audio driver.
- Harmonize prototype for `set_output_device` and `set_input_device`.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-02-09 11:02:00 +01:00
souplamp
5300daaff2
Audio rename (device, capture_device) -> (output_device, input_device)
Change instances of audio properties 'device' to 'output_device',
and instances of audio properties 'capture_device' to 'input_device',
as well as their subsequent getter & setter functions.

Update the docs to reflect these changes, as well as the
3-to-4 converter for GDScript and CSharp to make proper
conversions (only exception is 'device' since that name
is too vague and might replace non-AudioServer related
instances, such as user comments and variables).

This does not change internal references to references like
'Render Client' and 'Capture Client' in WASAPI; such is outside the
scope of this commit. This also does not change ALSA's references,
considering that it uses 'device' to mean input and output
interchangeably.

Other references are changed, however where applicable,
to be consistent with the new AudioServer methods and property
names.
2023-01-31 18:25:11 +01:00
Rémi Verschelde
f0e3c3f4c3
Merge pull request #72168 from RandomShaper/sensible_lock_return
Booleanize various sync primitives' wait & locking methods
2023-01-27 15:40:43 +01:00
Pedro J. Estébanez
f630940591 Booleanize various sync primitives' wait & locking methods 2023-01-27 11:15:30 +01:00
Rémi Verschelde
5b1df48c6c
Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Rémi Verschelde
fa80064779
Merge pull request #64607 from RandomShaper/safe_audio_threading 2022-08-25 10:12:25 +02:00
kobewi
8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00
Pedro J. Estébanez
9d546bf05a Make audio thread control flags safe 2022-08-19 13:28:10 +02:00
Rémi Verschelde
90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
bruvzg
8823eae328
Rename OSX to macOS and iPhoneOS to iOS. 2022-07-21 09:37:52 +03:00
bruvzg
ffe61e0895
[macOS / iOS] Fix text-to-speech build with older macOS / iOS SDK.
Add __has_include check for AVFAudio include.
Add some explicit casts to avoid conflicts.
Change all `include`s to `import`s for consistency.
2022-05-10 21:11:34 +03:00
bruvzg
f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
Rémi Verschelde
b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
bruvzg
c69e0d16bc
Fix multiple missing UTF-8 decoding. 2022-01-06 14:35:22 +02:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Rémi Verschelde
8247667a3e
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
2021-04-27 16:26:27 +02:00
Ev1lbl0w
838e7d0a8d
Replace malloc's with Godot's memalloc macro 2021-03-13 11:51:45 +00:00
reduz
64140eaf42 Reorganize Project Settings
-Advanced Settings toggle also hides advanced properties when disabled
-Simplified Advanced Bar (errors were just plain redundant)
-Reorganized rendering quality settings.
-Reorganized miscelaneous settings for clean up.
2021-02-18 11:23:34 -03:00
Rémi Verschelde
b5334d14f7
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 🎆
2021-01-01 20:19:21 +01:00
reduz
127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Fabio Alessandrelli
90c7102b51 Move mix_rate, ouput_latency to AudioDriverManager
Each driver used to define the (same) project settings values
`audio/mix_rate` and `audio/output_latency`, but the setting names are
not driver specific.
Overriding is still possible via platform tags.
2020-05-18 13:02:06 +02:00
Rémi Verschelde
0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00
lupoDharkael
95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Rémi Verschelde
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
Pedro J. Estébanez
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
Marcel Admiraal
5af3b4ca27 Remove duplicate ERR_PRINT macro. 2020-02-05 11:13:24 +01:00
Rémi Verschelde
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
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
bruvzg
7b64340eb0
Fix compilation warnings in macOS build, enable warnings=extra werror=yes for macOS CI. 2019-10-24 20:37:56 +03:00
Saracen
c81ec6f26d Exposes capture methods to AudioServer, variable renames for consistency,
added documentation.
2019-07-15 15:12:29 +01: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
volzhs
7d387dc63f Request mic access only when is needed 2018-12-14 06:40:13 +09:00
Wilson E. Alvarez
08f22f1cf0
Moved member variables to initializer list 2018-12-11 18:33:01 -05:00
Marcelo Fernandez
fa26a5511d Fix possible audio input buffer issues 2018-10-20 12:13:40 -03:00
Marcelo Fernandez
5e26829118 Fixed issues with audio input on some Macs 2018-10-12 19:20:28 -03:00
Marcelo Fernandez
cb99a15064 Fix CoreMidi warnings 2018-10-04 16:23:59 -03:00
Rémi Verschelde
3a2ca68af3 SCons: Build thirdparty code in own env, disable warnings
Also remove unnecessary `Export('env')` in other SCsubs,
Export should only be used when exporting *new* objects.
2018-09-28 14:07:39 +02: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