Commit Graph

165 Commits

Author SHA1 Message Date
1e0b41ab27 Remove display_server.h transitive include from node.h. 2025-10-14 00:43:02 +02:00
3d1c9fd5de Move server files into their subfolders 2025-09-30 19:39:39 -07:00
8ba4656ea3 Compile out editor-only logic within validate_property in games 2025-06-12 12:54:19 +08:00
b106dfd4f9 Base accessibility API. 2025-04-08 20:14:28 +03:00
324512e11c Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
2f5b97c7f9 Add volume_linear property and methods for audio-related classes
Remove default value from `volume_linear` property documentation

Remove `volume_linear` internal property from `AudioBusLayout`

Update doc/classes/AudioEffectAmplify.xml [no ci]

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>

Make documentation more concise [no ci]
2024-12-18 12:41:57 -08:00
37305e40bc Merge pull request #95711 from TokageItLab/warn-oneshot-prop
Add hint for oneshot property & warning when it will be updated continuously by Force Continuous in `AnimationMixer`
2024-11-22 14:54:30 -06:00
761a20f7a7 Add hint for oneshot & warning when it will be updated continuously 2024-11-11 01:12:45 +09:00
16524a8a01 Add "Game" editor for better runtime debugging 2024-10-30 11:42:17 -03:00
9f9ee0c813 SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
7fd261c8c1 Expose AudioStreamPlayer{2D,3D}::set_playing and remove AudioStreamPlayer::{2D,3D}::_is_active
- The `_is_active` method seems to be unused, so it was removed.
- The `_set_playing` method is now exposed, as the setter of the `playing` property.
    - The `play` method can't be used as a setter because it takes a `float` parameter instead of a `bool` parameter.
2024-08-30 17:16:46 +02:00
aaafd163b2 Honor pitch_scale value before playing audio sample 2024-08-20 10:29:32 -04:00
8c7dd3cb61 Add stop_callable to AudioStreamPlayerInternal 2024-08-11 20:27:15 +08:00
2f5f84b470 Fix audio samples not being able to be "finished" 2024-07-17 10:45:38 -04:00
a38f30fbd5 Fix Web samples finished missing signal 2024-07-07 14:47:54 -04:00
e8212f1849 Remove superfluous non-working sample playing check 2024-06-21 07:17:28 -04:00
52fa4f05f3 Add samples playback support 2024-06-18 11:06:31 -04:00
413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +02:00
a262d2d881 Add shorthand for using singleton string names 2024-05-11 18:53:08 +02:00
58931c073d Check for NaN in set_volume_db functions
Added check in AudioStreamPlayer, AudioStreamPlayer2D, and AudioStreamPlayer3D set_volume_db functions to prevent setting volume to NaN, and give an error.  Using NaN for volume and playing the AudioStreamPlayer could prevent all audio from playing, even from other AudioStreamPlayers.

Fixes #88133
2024-04-18 11:28:57 -04:00
56134e99da Merge pull request #87830 from KoBeWi/internalization_aka_i15n
Fix wrong process method in AudioStreamPlayer
2024-02-19 17:06:32 +01:00
35c99bbcc1 Change AudioStreamPlayer autoplay and GLTFBufferView getters to be const 2024-02-08 13:01:50 -06:00
56bf379fd9 Fix wrong process method in AudioStreamPlayer 2024-02-01 20:30:06 +01:00
0c7db3cdad Add AudioStreamPlayerInternal to unify stream players 2024-01-17 13:12:02 +01:00
a40fe16866 Implement audio stream playback parameters.
Implements a way for audio stream playback to be configured via parameters
directly in the edited AudioStreamPlayer[2D/3D].

Currently, configuring the playback stream is not possible (or is sometimes hacky
as the user has to obtain the currently played stream, which is not always immediately available).

This PR only implements this new feature to control looping in stream playback instances (a commonly requested feature, which was lost in the transition from Godot 2 to Godot 3).
But the idea is that it can do a lot more:

* If effects are bundled to the stream, control per playback instance parameters such as cutoff or resoance, or any other exposed effect parameter per playback instance.
* For the upcoming interactive music PR (#64488), this exposes an easy way to change the active clip, which was not possible before.
* For the upcoming parametrizable audio support (https://github.com/godotengine/godot-proposals/issues/3394) this allows editing and animating audio graph parameters.

In any case, this PR is required to complete #64488.

Update modules/vorbis/audio_stream_ogg_vorbis.h

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>

Update modules/minimp3/audio_stream_mp3.h

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>

Update modules/minimp3/audio_stream_mp3.h

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>

Update modules/vorbis/audio_stream_ogg_vorbis.h

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>

Update doc/classes/AudioStream.xml

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-01-16 10:31:52 +01:00
72fccd82c5 [Audio] Fix pausing stream on entering tree
The paused notifications are only sent when pause status is changed,
this ensures that streams that are non-processing do not play when added
to the tree. Also ensures that the `process_mode` property applies
generally.
2023-10-22 22:35:32 +02:00
f29b6e73c2 Add a bus_renamed AudioServer signal 2023-09-15 13:02:03 +03:00
178aad9a4e remove some dead declarations in audio_stream_player.h 2023-09-09 14:12:27 +02:00
49b6067aba Use StringName consistently to refer to the Master audio bus name 2023-08-07 18:06:17 +02:00
9583c20171 Merge pull request #70515 from stmSi/fix-hanging-audio-pitch-scale
Fix hanging if audiostream's pitch_scale is NaN
2023-02-17 14:06:55 +01:00
75330887d7 Implement blending audio feature to AnimationTree 2023-01-28 20:08:29 +09:00
4383b5ab1e Simplify AudioStreamPolyphonic
* Make AudioStreamPolyphonic not requre a polling thread (simpler, faster)
* Improve error reporting in AudioStreamPlayer*::get_stream_playback() error reporting to improve usability.
2023-01-23 10:47:01 +01:00
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
2041616934 Fix Editor hanging if audiostream's pitch_scale is NaN 2022-12-24 12:39:48 +06:30
a7ce7b1d3f Fix AudioStreamPlayer not resuming after returning to SceneTree 2022-09-05 16:52:46 +02:00
59e11934d8 Rename str2var to str_to_var and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
1a24c9e14b Make _validate_property a multilevel method 2022-08-22 18:35:11 +03:00
d1ddee2258 Implement BPM support
Based on #62896, only implements the BPM support part.

* Implements BPM support in the AudioStreamOGG/MP3 importers.
* Can select BPM/Bar Size and total beats in a song file, as well as edit looping points.
* Looping is now BPM aware
* Added a special importer UI for configuring this.
* Added a special preview showing the audio waveform as well as the playback position in the resource picker.
* Renamed `AudioStream::instance` to `instantiate` for correctness.
2022-07-23 07:31:17 +02:00
5dc3bfb80e Use suffixes for units in nodes and resources 2022-05-19 14:34:27 -05:00
0f5455230c Use switch consistently in _notification (scene folder) 2022-02-15 18:44:55 +01:00
fe52458154 Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
c088a2dd89 Fix crash due to reentrancy in AudioStreamPlayer* finished signal.
This crash occurred when an audio stream finished playing in NOTIFICATION_INTERNAL_PROCESS,
during which it would iterate through a loop of playbacks,
leading to a "finished" signal, which removed the audio player from the tree
which led to a NOTIFICATION_EXIT_TREE,
which would mutate the array of playbacks while within the above loop.

This moves the signal callback outside of the loop which avoids the crash.
Note: previously, the signal was called multiple times if the same player finishes multiple times in one frame. Now it is at most once per frame.

Affects AudioStreamPlayer, AudioStreamPlayer2D and AudioStreamPlayer3D
2021-10-28 19:45:29 -07:00
d03b7fbe09 Refactored Node3D rotation modes
* Made the Basis euler orders indexed via enum.
* Node3D has a new rotation_order property to choose Euler rotation order.
* Node3D has also a rotation_mode property to choose between Euler, Quaternion and Basis

Exposing these modes as well as the order makes Godot a lot friendlier for animators, which can choose the best way to interpolate rotations.
The new *Basis* mode makes the (exposed) transform property obsolete, so it was removed (can still be accessed by code of course).
2021-10-25 14:34:00 -03:00
39a90751dc Allow AudioStreamPlayer(2D) to provide pitch_scale on playback 2021-10-10 18:52:29 -03:00
0e3cab41eb Add polyphony to Audio Stream Player nodes 2021-09-07 09:44:39 -07:00
3598d300cb Do all audio mixing in the AudioServer 2021-08-27 10:41:57 -07:00
44d62a9f4b Implement NativeExtension pointer arguments
* Allows calling into native extensions directly with a pointer
* Makes it easier to implement some APIs more efficiently
* Appears with a "*" in the documentation for the argument.
* Implementing the pointer handling is entirely up to the implementation, although the extension API provides some hint.
* AudioStream has been implemented as an example, allowing to create NativeExtension based AudioStreams.
2021-08-23 19:58:40 -03:00
6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30