Commit Graph

116 Commits

Author SHA1 Message Date
Raul Santos
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
Kusok
8c7dd3cb61 Add stop_callable to AudioStreamPlayerInternal 2024-08-11 20:27:15 +08:00
Adam Scott
52fa4f05f3
Add samples playback support 2024-06-18 11:06:31 -04:00
Rémi Verschelde
61b970ea44
Merge pull request #91929 from matheusmdx/fix-error-91914
Fix error in AudioStreamPlayer2D
2024-05-14 12:07:20 +02:00
matheusmdx
305967c021 Fix error in AudioStreamPlayer2D 2024-05-14 02:07:12 -03:00
kobewi
413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +02:00
kobewi
a262d2d881 Add shorthand for using singleton string names 2024-05-11 18:53:08 +02:00
aaronp64
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
smix8
35dafc9fa8 Split monolithic physics class files
Splits monolithic physics class files.
2024-02-27 11:18:16 +01:00
Aaron Franke
35c99bbcc1
Change AudioStreamPlayer autoplay and GLTFBufferView getters to be const 2024-02-08 13:01:50 -06:00
kobewi
0c7db3cdad Add AudioStreamPlayerInternal to unify stream players 2024-01-17 13:12:02 +01:00
Juan Linietsky
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
A Thousand Ships
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
Rémi Verschelde
04d2aa61a3
Merge pull request #81641 from MewPurPur/bus-go-brrrr-2
Add a `bus_renamed` AudioServer signal
2023-09-17 14:47:29 +02:00
MewPurPur
f29b6e73c2 Add a bus_renamed AudioServer signal 2023-09-15 13:02:03 +03:00
A Thousand Ships
a29416e332 [Scene,Main] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-12 12:53:06 +02:00
Hugo Locurcio
49b6067aba Use StringName consistently to refer to the Master audio bus name 2023-08-07 18:06:17 +02:00
Rémi Verschelde
5025d95d41
Merge pull request #69027 from Uxeron/AudioListener2DRotationFix
Fix AudioListener2D ignoring rotation for positional audio
2023-06-21 10:17:37 +02:00
Uxeron
20ceba9e82 Fix AudioListener2D ignoring rotation 2023-06-21 08:10:01 +03:00
kobewi
8a41eefb97 Fix 2D audio in multiple viewports 2023-05-03 23:09:40 +02:00
smix8
a5351086b0 Fix AudioStreamPlayer2D crash when PhysicsServer2D runs on thread
Fixes AudioStreamPlayer2D crash when PhysicsServer2D runs on thread due to empty PhysicsSpace
2023-04-06 03:29:09 +02:00
Rémi Verschelde
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
Rémi Verschelde
2e0d9efb72
Merge pull request #72115 from AThousandShips/clip_children_fix
Hide `clip_children` for some non-drawn CanvasItems
2023-01-30 10:02:54 +01:00
Ninni Pipping
bbf203bc32 Hide clip_children for non-drawn CanvasItems 2023-01-30 08:22:06 +01:00
Silc Renew
75330887d7 Implement blending audio feature to AnimationTree 2023-01-28 20:08:29 +09:00
Juan Linietsky
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
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
stmSi
2041616934 Fix Editor hanging if audiostream's pitch_scale is NaN 2022-12-24 12:39:48 +06:30
Micky
b6db09968d Fix AudioStreamPlayer2D and 3D's playing not updating right away 2022-11-22 15:46:28 +01:00
kobewi
e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
Micky
a7ce7b1d3f Fix AudioStreamPlayer not resuming after returning to SceneTree 2022-09-05 16:52:46 +02:00
Micky
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
Yuri Sizov
1a24c9e14b Make _validate_property a multilevel method 2022-08-22 18:35:11 +03:00
reduz
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
Ellen Poe
d384d84f45 Audio: Expose 2D/3D panning strength parameters 2022-06-17 13:08:48 +02:00
reduz
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
Aaron Franke
5dc3bfb80e
Use suffixes for units in nodes and resources 2022-05-19 14:34:27 -05:00
reduz
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
Rémi Verschelde
0f5455230c
Use switch consistently in _notification (scene folder) 2022-02-15 18:44:55 +01:00
Hendrik Brucker
b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01: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
Lightning_A
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
PouleyKetchoupp
acbd24ea84 Use parameter classes instead of arguments for all physics queries
Same as what is already done for shape queries, applied to point and ray
queries. Easier to document and more flexible to add more parameters.

Also expose intersect_point method to script in 3D.
Remove intersect_point_on_canvas in 2D, replaced with a parameter.
2021-11-04 11:44:39 -07:00
Lyuma
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
Douglas Leão
39a90751dc Allow AudioStreamPlayer(2D) to provide pitch_scale on playback 2021-10-10 18:52:29 -03:00
Wilson E. Alvarez
f3a564f9a5
Rename Listener2D/Listener3D to AudioListener2D/AudioListener3D 2021-09-16 17:51:51 -04:00
Juan Linietsky
d0a7eeaaff
Merge pull request #44844 from KoBeWi/hey_listen!_but_2d
Add Listener2D
2021-09-09 19:19:10 -03:00
Ellen Poe
0e3cab41eb Add polyphony to Audio Stream Player nodes 2021-09-07 09:44:39 -07:00
kobewi
f2cb0a8d4b Add Listener2D 2021-08-31 16:53:14 +02:00
Ellen Poe
3598d300cb Do all audio mixing in the AudioServer 2021-08-27 10:41:57 -07:00