summaryrefslogtreecommitdiff
path: root/servers/audio_server.h
AgeCommit message (Collapse)Author
2023-04-26Fix crash caused by invalid mix_rate assignment due to bogusEoin O'Neill
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 (cherry picked from commit 5a08091168782a924cd3a23baf31c5cd4cd63906)
2023-02-09Further refactoring to AudioDriver implementations after #69120.Emmanouil Papadeas
- 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-01-31Audio rename (device, capture_device) -> (output_device, input_device)souplamp
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-05One Copyright Update to rule them allRémi Verschelde
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".
2022-08-22Replace Array return types with TypedArraykobewi
2022-07-28Rename AudioStreamSample to a more discoverable nameDeeJayLSP
2022-07-23Implement BPM supportreduz
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-05-16Replace most uses of Map by HashMapreduz
* 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-02Style: Partially apply clang-tidy's `cppcoreguidelines-pro-type-member-init`Rémi Verschelde
Didn't commit all the changes where it wants to initialize a struct with `{}`. Should be reviewed in a separate PR. Option `IgnoreArrays` enabled for now to be conservative, can be disabled to see if it proposes more useful changes. Also fixed manually a handful of other missing initializations / moved some from constructors.
2022-04-04Zero initialize all pointer class and struct membersRémi Verschelde
This prevents the pitfall of UB when checking if they have been assigned something valid by comparing to nullptr.
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-10-10Allow AudioStreamPlayer(2D) to provide `pitch_scale` on playbackDouglas Leão
2021-09-07Add polyphony to Audio Stream Player nodesEllen Poe
2021-08-27Do all audio mixing in the AudioServerEllen Poe
2021-08-07Invert how `global_rate_scale` value works, and rename it to ↵Michael Alexsander
`playback_speed_scale`
2021-02-02Make audio bus channels' peak volume consistentPedro J. Estébanez
Channels that are inactive -or when playback has not started yet- will report -200 dB as their peak value (which is also the lowest value possible during playback).
2021-01-16Fixes #45025 - Protects _last_mix_time and _last_frame_time with the ↵Sean LaPlante
AudioDriver lock() and unlock() methods
2021-01-01Update copyright statements to 2021Rémi Verschelde
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 🎆
2020-11-16Remove empty lines around braces with the formatting scriptAaron Franke
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-10-18Refactor MethodBind to use variadic templatesreduz
Removed make_binders and the old style generated binders.
2020-05-18Move mix_rate, ouput_latency to AudioDriverManagerFabio Alessandrelli
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-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
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-10Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde
Part of #33027.
2020-03-27Remove the audio memory allocator, use regular one instead.Juan Linietsky
2020-03-17Style: Set clang-format Standard to Cpp11Rémi Verschelde
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-02-26Reimplement Mutex with C++'s <mutex>Pedro J. Estébanez
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-18PoolVector is gone, replaced by VectorJuan Linietsky
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
2020-02-07Workaround WebM playback bug after AudioServer latency fixesRémi Verschelde
af9bb0ea15dfd3dfe8950fcfcce364485dadd92a fixed AudioServer's `get_output_delay()` (which used to always return 0) while renaming it to `get_output_latency()`. It now returns the latency from the AudioDriver, which can be non-0. While this was a clear bugfix, it broke playback for WebM files without audio track. It seems like the playback code, even though it queried the output delay to calculate a time compensation, was designed to work even though the delay value was actually bogus. Now that it's correct, it's not working. As a workaround we comment out uses of the output latency, restoring the behavior of Godot 3.1. This code should still be reviewed by someone more versed in video playback and fixed to properly account for the non-0 driver latency. Fixes #35760.
2020-01-21Remove unused #if 0'ed codeRémi Verschelde
2020-01-20Revert "Exposes capture methods to AudioServer + documentation" #30468Rémi Verschelde
Reverts the following commits: - c81ec6f26d40b70283958a4ef3e216fb32cbaf14: "Exposes capture methods to AudioServer, variable renames for consistency, added documentation." - 47c558b98abf842910c780294314326662410cdf: "Expose audio callbacks as signals." - dabaa11b3c451e9b8f2cca7e563bd9ec51edb169: "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-01Update copyright statements to 2020Rémi Verschelde
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.
2019-10-11Fix to make sure the capture buffers are deallocated at shutdown. Silences ↵Saracen
warnings.
2019-07-15Exposes capture methods to AudioServer, variable renames for consistency,Saracen
added documentation.
2019-07-01Merge pull request #29413 from YeldhamDev/global_rate_scaleRémi Verschelde
Add 'global_rate_scale' to the AudioServer
2019-06-19Add 'global_rate_scale' to the AudioServerMichael Alexsander Silva Dias
Closes #28953.
2019-06-19Made use of semicolons more consitent, fixed formattingJohnJLight
2019-05-30audio_server.h : fix typo in comment (minor)Arthur Brainville
Line 152 : `//re-expose this her,` should be `//re-expose this here`
2019-04-27Added functions to further improve music timingJuan Linietsky
2019-04-27Clean up latency related functionsJuan Linietsky
2019-04-10Added generator audio stream, and spectrum analyzer audio effectJuan Linietsky
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-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-12-13Merge pull request #22910 from marcelofg55/nothreads_recRémi Verschelde
Fix AudioEffectRecord not working without thread support
2018-12-12Fix AudioEffectRecord not working without thread supportMarcelo Fernandez
2018-12-11Fix EditorAudioBuses not updating when changing to a device with different ↵Marcelo Fernandez
channels
2018-11-13Ability to remove buses while they are being used on 2D and 3D stream ↵Juan Linietsky
players. Fixes #15115
2018-10-20Fix possible audio input buffer issuesMarcelo Fernandez
2018-09-12Make core/ includes absolute, remove subfolders from include pathRémi Verschelde
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-07-27Renamed AudioDriver audio_input_* vars to input_*Marcelo Fernandez
2018-07-27Fixed audio clipping on WASAPI by fixing argument order on AudioClientSaracen
Initialize method ensuring a larger capture buffer and adding bounds to the capture and stream.