Commit Graph

51 Commits (36df305b13afc3d91bb7f9694dedab9a84a94130)

Author SHA1 Message Date
Kelebek1 7636fefb71 audio_core: Preserve front channel volume after 6 to 2 downmix
Many games report 6 channel output while only providing data for 2. We only output 2-channel audio regardless, and in the downmixing, front left/right only provide 36% of their volume. This is done assuming all of the other channels also contain valid data, but in many games they don't. This PR alters the downmixing to preserve front left/right, so volume is not lost.

This improves volume in Link's Awakening, New Super Mario Bros U, Disgaea 6, Super Kirby Clash.
2021-07-08 17:07:23 +07:00
Kelebek1 b455043e45 Fix XC2/VOEZ crashing, add audio looping and a few misc fixes 2021-07-01 06:01:01 +07: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 +07:00
Morph 12c1766997 general: Replace RESULT_SUCCESS with ResultSuccess
Transition to PascalCase for result names.
2021-06-02 00:39:27 +07: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
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 +07: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 +07: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 +07: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 +07:00
Chloe Marcec 908d3c5679 Addressed changes 2020-11-17 15:40:19 +07: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 +07: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 +07: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 +07:00
David Marcec 80ac1331b5 Preliminary effects 2020-08-17 01:23:55 +07:00
David Marcec f4eb7dceaf Fix stream channel count when outputting to stereo 2020-07-25 13:31:43 +07:00
David Marcec 8a497adf85 Queue extra mix buffer 2020-07-25 12:39:36 +07:00
David Marcec 380658c21d audio_core: Apollo Part 1, AudioRenderer refactor 2020-07-25 12:39:34 +07:00
David Marcec 42250427c5 audren: Implement RendererInfo
Fixes ZLA softlock
2020-06-13 14:04:28 +07:00
David Marcec 16c0373adc fix logic error & scale sample volume based on voice volume 2020-05-11 12:56:15 +07:00
David Marcec c4e7ec7a99 pass by const ref instead 2020-05-11 12:56:15 +07:00
David Marcec 9de860a419 audio_renderer: Better voice mixing and 6 channel downmixing
Supersedes #3738 and #3321
2020-05-11 12:56:15 +07:00
David 11c63ca969
audio_renderer: Preliminary BehaviorInfo (#3736)
* audio_renderer: Preliminary BehaviorInfo

* clang format

* Fixed IsRevisionSupported

* fixed IsValidRevision

* Fixed logic error & spelling errors & crash

* Addressed issues
2020-04-20 22:57:30 +07:00
bunnei 4caff51710 core: memory: Move to Core::Memory namespace.
- helpful to disambiguate Kernel::Memory namespace.
2020-04-17 00:59:28 +07:00
Lioncash b05bfc6036 core/memory: Migrate over Read{8, 16, 32, 64, Block} to the Memory class
With all of the trivial parts of the memory interface moved over, we can
get right into moving over the bits that are used.

Note that this does require the use of GetInstance from the global
system instance to be used within hle_ipc.cpp and the gdbstub. This is
fine for the time being, as they both already rely on the global system
instance in other functions. These will be removed in a change directed
at both of these respectively.

For now, it's sufficient, as it still accomplishes the goal of
de-globalizing the memory code.
2019-11-26 21:55:39 +07:00
Lioncash 536fc7f0ea core: Prepare various classes for memory read/write migration
Amends a few interfaces to be able to handle the migration over to the
new Memory class by passing the class by reference as a function
parameter where necessary.

Notably, within the filesystem services, this eliminates two ReadBlock()
calls by using the helper functions of HLERequestContext to do that for
us.
2019-11-26 21:55:37 +07:00
bunnei 9046d4a548
kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154)
* kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects.

- See https://github.com/citra-emu/citra/pull/4710 for details.
2019-11-24 20:15:51 +07:00
David Marcec e9d19add7d Used revision 5 instead of 7, marked constexpr as static 2019-09-21 16:24:56 +07:00
David Marcec b54cdeb284 Added frame_count for REV7 audio renderer
Added framecount
2019-09-20 10:42:09 +07:00
David Marcec ea5602b959 Clang format 2019-07-13 01:49:32 +07:00
David Marcec 31fe859fe5 Addressed issues 2019-07-13 01:35:40 +07:00
David Marcec 73b37886c1 "AudioRenderer" thread should have a unique name
Creating multiple "AudioRenderer" threads cause the previous thread to be overwritten. The thread will name be renamed to AudioRenderer-InstanceX, where X is the current instance number.
2019-07-13 01:22:08 +07:00
David Marcec e3d000a7e6 addressed issue 2019-07-08 14:49:16 +07:00
David Marcec b82b5e46e7 audren: Only manage wave buffers with a size
We shouldn't be incrementing if wave buffers are empty. They are considered invalid/unused wave buffers.

This fixes the issue of certain sounds looping when they shouldn't
2019-07-01 21:20:23 +07:00
Lioncash bd983414f6 core_timing: Convert core timing into a class
Gets rid of the largest set of mutable global state within the core.
This also paves a way for eliminating usages of GetInstance() on the
System class as a follow-up.

Note that no behavioral changes have been made, and this simply extracts
the functionality into a class. This also has the benefit of making
dependencies on the core timing functionality explicit within the
relevant interfaces.
2019-02-15 21:50:25 +07:00
Lioncash a73c7c73eb audio_core: Convert LOG_CRITICAL + UNREACHABLE over to UNIMPLEMENTED/UNIMPLEMENTED_MSG
These two macros being used in tandem were used prior to the
introduction of UNIMPLEMENTED and UNIMPLEMENTED_MSG. This provides
equivalent behavior, just with less typing/reading involved.
2018-12-28 14:13:58 +07:00
heapo 117b1f3ec1 Avoid (expensive) audio interpolation when sample rates already match 2018-12-06 09:46:08 +07:00
Zach Hilman ff610103b5 core: Port all current usages of Event to Readable/WritableEvent 2018-11-29 08:45:41 +07:00
David Marcec ceef334c1c Fixups for softlock 2018-10-07 14:25:39 +07:00
David Marcec 2534af040e Fixed missing return
Softlock explanation:
after effects are initialized in smo, nothing actually changes the state. It expects the state to always be initialized. With the previous testing, updating the states much like how we handle the memory pools continue to have the softlock(which is why I said it probably wasn't effects) after further examination it seems like effects need to be initialized but the state remains unchanged until further notice. For now, assertions are added for the aux buffers to see if they update, unable to check as I haven't gotten smo to actually update them yet.
2018-10-07 14:19:55 +07:00
David Marcec 2de52e3af6 Fixed smo softlock 2018-10-07 14:14:09 +07:00
Lioncash 2f6a611311 stream: Preserve enum class type in GetState()
Preserves the meaning/type-safetiness of the stream state instead of
making it an opaque u32. This makes it usable for other things outside
of the service HLE context.
2018-09-23 20:03:38 +07:00
David Marcec c461188f51 Added audren:u#GetAudioRendererState 2018-09-23 22:32:01 +07:00
Lioncash 1adbcd54fe audio_renderer: Replace includes with forward declarations where applicable
Avoids including unnecessary headers within the audio_renderer.h header,
lessening the likelihood of needing to rebuild source files including
this header if they ever change.

Given std::vector allows forward declaring contained types, we can move
VoiceState to the cpp file and hide the implementation entirely.
2018-09-17 15:08:30 +07:00
fearlessTobi 63c2e32e20 Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +07:00
MerryMage a76f0d5d06 audio_renderer: Rename AudioOut instance to audio_out 2018-09-08 16:50:12 +07:00
MerryMage 01d199965a audio_renderer: samples_remaining counts frames, not samples 2018-08-13 11:26:50 +07:00
MerryMage 4b44b8b4fb audio_core: Interpolate 2018-08-13 11:26:50 +07:00
David Marcec 094f6003e0 Pushed the requested sample rate instead of our fixed sample rate 2018-08-12 14:58:36 +07:00
David Marcec e5ee0afe6f Added GetAudioRendererSampleRate, GetAudioRendererSampleCount & GetAudioRendererMixBufferCount
GetAudioRendererSampleRate is set as a "STUB" as a game could check if the sample rate it sent and the sample rate it wants don't match. Just a thought of something which could happen so keeping it as stub for the mean time
2018-08-12 14:46:12 +07:00