summaryrefslogtreecommitdiff
path: root/servers/audio_server.cpp
AgeCommit message (Collapse)Author
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: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
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-04-02Replace NULL with nullptrlupoDharkael
2020-03-27Remove the audio memory allocator, use regular one instead.Juan Linietsky
2020-03-08Refactor ScriptDebugger.Fabio Alessandrelli
EngineDebugger is the new interface to access the debugger. It tries to be as agnostic as possible on the data that various subsystems can expose. It allows 2 types of interactions: - Profilers: A subsystem can register a profiler, assigning it a unique name. That name can be used to activate the profiler or add data to it. The registered profiler can be composed of up to 3 functions: - Toggle: called when the profiler is activated/deactivated. - Add: called whenever data is added to the debugger (via `EngineDebugger::profiler_add_frame_data`) - Tick: called every frame (during idle), receives frame times. - Captures: (Only relevant in remote debugger for now) A subsystem can register a capture, assigning it a unique name. When receiving a message, the remote debugger will check if it starts with `[prefix]:` and call the associated capture with name `prefix`. Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new profiler system. Port SceneDebugger and RemoteDebugger to the new capture system. The LocalDebugger also uses the new profiler system for scripts profiling.
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-25Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky
- Renames PackedIntArray to PackedInt32Array. - Renames PackedFloatArray to PackedFloat32Array. - Adds PackedInt64Array and PackedFloat64Array. - Renames Variant::REAL to Variant::FLOAT for consistency. Packed arrays are for storing large amount of data and creating stuff like meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of memory. That said, many users requested the ability to have 64 bits packed arrays for their games, so this is just an optional added type. For Variant, the float datatype is always 64 bits, and exposed as `float`. We still have `real_t` which is the datatype that can change from 32 to 64 bits depending on a compile flag (not entirely working right now, but that's the idea). It affects math related datatypes and code only. Neither Variant nor PackedArray make use of real_t, which is only intended for math precision, so the term is removed from there to keep only float.
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-02-05Remove duplicate WARN_PRINT macro.Marcel Admiraal
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-16Expose audio callbacks as signals.Saracen
2019-07-15Exposes capture methods to AudioServer, variable renames for consistency,Saracen
added documentation.
2019-06-19Add 'global_rate_scale' to the AudioServerMichael Alexsander Silva Dias
Closes #28953.
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-04-05Allow default audio bus layout modificationlupoDharkael
2019-03-05Fix #25639 by not shifting a negative value.marxin
2019-03-02Fix possible crash on AudioDriver::input_buffer_writeMarcelo Fernandez
2019-02-27Fix -Wsign-compare warnings.marxin
I decided to modify code in a defensive way. Ideally functions like size() or length() should return an unsigned type.
2019-02-13Fix typos with codespellRémi Verschelde
Using codespell 1.14.0. Method: ``` $ cat > ../godot-word-whitelist.txt << EOF ang doubleclick lod nd numer que te unselect EOF $ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po" $ git diff // undo unwanted changes ```
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-12-14Merge pull request #24324 from volzhs/access-micRémi Verschelde
Request mic access only when is needed
2018-12-14Request mic access only when is neededvolzhs
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-11-12Use `ResourceLoader::exists` to check for default audio bus layoutmerumelu
2018-10-25Merge pull request #22779 from Superwaitsum/LimitSettingsRémi Verschelde
Limit several project settings
2018-10-24Add some limits on the Editor SettingsSuperwaitsum
2018-10-20Fix possible audio input buffer issuesMarcelo Fernandez
2018-10-08Add missing BIND_ENUM for SPEAKER_SURROUND_31Marcelo Fernandez
2018-09-27Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], ↵Rémi Verschelde
[-Wreturn-local-addr] and more Fixes the following GCC 5 warnings: ``` core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress] servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress] drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith] modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr] servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr] editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed ```
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-08-27log to console if falling back to dummy audio driverthfrwn
2018-08-21Fix arg name in docs, some copy-paste errorsPoommetee Ketson
2018-08-13Add Dummy AudioDriver into the AudioDriverManager listMarcelo Fernandez
2018-07-27Renamed AudioDriver audio_input_* vars to input_*Marcelo Fernandez
2018-07-27Implemented capture device selection for CoreAudioMarcelo Fernandez
2018-07-27Modified Microphone implementation to handle only one device at a time (WIP)Marcelo Fernandez
2018-07-27Experimental microphone support.Saracen
2018-07-26Merge pull request #15967 from Gamblify/AudioRecordingModuleRémi Verschelde
Audio Recording from godot
2018-07-26Audio Recording moduleGustav Lund
Implements an Audio bus effect that outputs the audio from the bus into a wav file Now channels audio recording into an AudioStreamSample instead of saving to wav
2018-07-26Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam
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.