Commit graph

224 commits

Author SHA1 Message Date
Kelebek1 b455043e45 Fix XC2/VOEZ crashing, add audio looping and a few misc fixes 2021-07-01 06:01:01 +01:00
Kelebek1 0857d6a3db Decouple audio processing and run at variable rate
Currently, processing of audio samples is called from AudioRenderer's Update method, using a fixed 4 buffers to process the given samples. Games call Update at variable rates, depending on framerate and/or sample count, which causes inconsistency in audio processing. From what I've seen, 60 FPS games update every ~0.004s, but 30 FPS/160 sample games update somewhere between 0.02 and 0.04, 5-10x slower. Not enough samples get fed to the backend, leading to a lot of audio skipping.

This PR seeks to address this by de-coupling the audio consumption and the audio update. Update remains the same without calling for buffer queuing, and the consume now schedules itself to run based on the sample rate and count.
2021-06-27 15:58:07 +01:00
bunnei 50d0cc2716 audio_core: common: Bump audio revision to 9.
- This is used in fw 12.x.x games.
2021-06-24 18:22:10 -07:00
Chloe f216a9432b
Add missing includes (#6521)
* Add missing includes

* Add array
2021-06-24 03:24:17 -04:00
Kelebek1 ba3af04da1 Implement audout GetAudioOutPlayedSampleCount
Used in Ninja Gaiden games.
2021-06-22 04:39:17 +01:00
Clément Gallet f611506dca Various suggestions by v1993 and lioncash 2021-06-07 12:51:59 +02:00
Clément Gallet c7c99905f4 Add SDL2 audio backend 2021-06-06 11:28:38 +02:00
Morph 12c1766997 general: Replace RESULT_SUCCESS with ResultSuccess
Transition to PascalCase for result names.
2021-06-02 00:39:27 -04:00
bunnei a4c6712a4b common: Move settings to common from core.
- Removes a dependency on core and input_common from common.
2021-04-14 16:24:03 -07:00
Chloe Marcec 7ad63ea542 revert to std::sin and std::cos 2021-02-12 18:48:10 -08:00
Chloe Marcec d28b942458 address issues 2021-02-12 18:48:10 -08:00
Chloe Marcec 4a7fd91857 audren: Implement I3dl2Reverb
Most notable fix is the voices in Fire Emblem Three Houses
2021-02-12 18:48:10 -08:00
bunnei 7666c0994c
Merge pull request #5868 from german77/HandheldFix
Prevent over scheduling audio events and add motion update unschedule event
2021-02-08 11:33:53 -08:00
german 7784b1da6d Prevent over scheduling audio events and terminate properly the motion update event 2021-02-02 10:17:10 -06:00
Chloe Marcec 9fc7f60b94 audren: Disable reverb for the time being
As this is causing issues in a few games, it's best to have it disabled until it's completely implemented
2021-02-01 14:41:58 +11:00
Chloe Marcec b2b95e96c1 audout: FlushAudioOutBuffers
Fixes Devil May Cry
2021-01-24 19:13:34 +11:00
ReinUsesLisp f8650a9580 core: Silence Wclass-memaccess warnings
This requires making several types trivial and properly initialize
them whenever they are called.
2021-01-15 16:31:19 -03:00
ReinUsesLisp 3ff978aa4f common/common_funcs: Rename INSERT_UNION_PADDING_{BYTES,WORDS} to _NOINIT
INSERT_PADDING_BYTES_NOINIT is more descriptive of the underlying behavior.
2021-01-15 16:27:28 -03:00
bunnei 60121d8f28
Merge pull request #5264 from 16-Bit-Dog/patch-1
Make the coding conventions more consistant
2020-12-31 01:46:53 -08:00
16-Bit-Dog fa5a1a4bfd
Make the coding conventions more consistant
lut_index had 0 added when nothing was supposed to be added

despite this, index was not added to 0 when nothing was supposed to be added...
2020-12-30 19:03:26 -05:00
bunnei 7d77a3f88f hle: service: Acquire and release a lock on requests.
- This makes it such that we can safely access service members from CoreTiming thread.
2020-12-28 21:33:34 -08:00
bunnei c7a06908ae audio_core: stream: Ensure buffer is valid before release. 2020-12-28 21:33:34 -08:00
Vitor Kiguchi a1e7360273 Update cubeb and request a persistent stream session 2020-12-05 22:26:41 +01:00
bunnei 88089c8754
Merge pull request #5000 from lioncash/audio-error
audio_core: Make shadowing and unused parameters errors
2020-12-02 23:08:43 -08:00
Lioncash 1ea6bdef05 audio_core: Make shadowing and unused parameters errors
Moves the audio code closer to enabling warnings as errors in general.
2020-12-03 00:54:31 -05:00
Chloe Marcec d7019d8307 audio_core: Remove temp_mix_buffer
It's unused and doesn't need to be initialized
2020-11-28 23:25:28 +11:00
Chloe Marcec 908d3c5679 Addressed changes 2020-11-17 15:40:19 +11:00
Chloe Marcec 9a4beac95a audren: Make use of nodiscard, rework downmixing, release all buffers
Preliminary work for upmixing & general cleanup. Fixes basic issues in games such as Shovel Knight and slightly improves the LEGO games. Upmixing stitll needs to be implemented.

Audio levels in a few games will be fixed as we now use the downmix coefficients when possible instead of supplying our own
2020-11-17 14:14:29 +11:00
Lioncash e408bd3b7c core: Fix clang build pt.2
Resolves the clang build issue in a more unintrusive way.
2020-10-20 22:16:03 -04:00
bunnei 3d592972dc
Revert "core: Fix clang build" 2020-10-20 19:07:39 -07:00
Lioncash be1954e04c core: Fix clang build
Recent changes to the build system that made more warnings be flagged as
errors caused building via clang to break.

Fixes #4795
2020-10-17 19:50:39 -04:00
Lioncash 9f9b64d280 audio_core/CMakeLists: Make warnings consistent with core
Normalizes the warnings shared between audio_core and core.
2020-10-13 16:36:58 -04:00
bunnei 09609dd50e
Merge pull request #4721 from lioncash/genfn
codec: Make lookup table static constexpr
2020-09-29 15:16:24 -07:00
bunnei 2a82f1b08b
Merge pull request #4722 from lioncash/casting
cubeb_sink: Use static_cast instead of reinterpret_cast in DataCallback()
2020-09-29 15:09:12 -07:00
bunnei a8be822e8e
Merge pull request #4719 from lioncash/audio-warn
audio_core: Resolve sign conversion warnings
2020-09-27 01:52:59 -07:00
bunnei 891090799c
Merge pull request #4720 from lioncash/header
audio_core: Remove unnecessary inclusions
2020-09-25 22:04:26 -07:00
Lioncash 90c6141164 command_generator: Make lookup table static constexpr
Allows compilers to elide needing to push these values on the stack
every time the function is called.
2020-09-25 18:33:04 -04:00
Lioncash dc83ca8914 behavior_info: Fix typo Renerer -> Renderer 2020-09-25 17:14:02 -04:00
Lioncash 4073931305 cubeb_sink: Use static_cast instead of reinterpret_cast in DataCallback()
Conversions from void* to the proper data type are well-defined and
supported by static_cast. We don't need to use reinterpret_cast here.
2020-09-25 17:10:02 -04:00
Lioncash 7c0908f301 codec: Make lookup table static constexpr
Allows compilers to elide needing to push these values on the stack
every time the function is called.
2020-09-25 14:24:25 -04:00
Lioncash 966966dc02 audio_core: Remove unnecessary inclusions
Same behavior, but removes header dependencies where they don't need to
be.
2020-09-25 13:19:42 -04:00
Lioncash 8b4ecf22d4 audio_core: Resolve sign conversion warnings
While were at it, we can also enable sign conversion warnings and other
common warnings as errors to prevent these from creeping back into the
codebase.
2020-09-25 01:22:47 -04:00
Lioncash 111852a983 effect_context: Make use of explicit where applicable
While we're at it we can make the destructor of the base class virtual
to ensure that any polymorphism issues never occur.
2020-09-25 00:27:11 -04:00
Lioncash 362e2940be audio_core/command_generator: Use const references where applicable
In a lot of cases, we can make use of const references rather than
non-const references.

While we're in the area we can silence some truncation and sign
conversion warnings.
2020-09-17 13:52:55 -04:00
Lioncash 9539e4d8fd audio_core/command_generator: Avoid an unnecessary copy in GenerateFinalMixCommand() 2020-09-17 13:45:24 -04:00
bunnei 324029d4f9
Merge pull request #4310 from ogniK5377/apollo-1-prod
audio_core: Apollo Part 1, AudioRenderer refactor
2020-09-11 10:57:27 -04:00
David Marcec 80ac1331b5 Preliminary effects 2020-08-17 01:23:55 +10:00
David Marcec 1f1c3bddc0 Disable biquad filter 2020-08-14 23:20:20 +10:00
David Marcec 1b3d86c02f Reworked ADPCM decoder to allow better streaming 2020-08-14 21:04:28 +10:00
Lioncash b724a4d90c General: Tidy up clang-format warnings part 2 2020-08-13 14:19:08 -04:00