Commit Graph

90 Commits

Author SHA1 Message Date
Zephyron
f1dce2578e audio_core: Add Audio Renderer REV12 and REV13 support
Implements support for Audio Renderer revisions 12 and 13, adding:
- REV12: Splitter biquad filter support with fixed-point coefficients
- REV13: Explicit splitter previous volume reset and compressor statistics

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2026-01-03 15:14:44 +10:00
Zephyron
5fbfc6693b audio_core: Fix reverb effect causing extreme noise on Windows
Fixed multiple bugs in reverb processing:
- Early gains for stereo channels not being assigned (missing *=)
- Incorrect TapOut pointer arithmetic (extra +1 offset)
- Uninitialized input pointer causing crashes
- Missing state initialization check
- SetDelay not called during parameter updates

Co-authored-by: MaranBr <maranbr@outlook.com>
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-17 16:41:59 +10:00
Zephyron
b5a82bcfdc fix(audio): biquad filter effect parameter version 2 handling
Fix ParameterVersion2 structure layout to match actual format:
- Add padding and use f32 for coefficients (was incorrectly using s16)
- Update state field offset from 0x17 to 0x25

Update command generation to:
- Read from correct structure based on version
- Convert float coefficients to fixed-point Q2.14 when using version 2

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-12-06 15:31:24 +10:00
Zephyron
c8b3f0c98c Fix: Explicit float casts for Android NDK compilation
Add static_cast<f32>() to integer-to-float conversions in audio_core
to satisfy Android NDK's -Werror=implicit-int-float-conversion flag.

Fixes compilation errors in fft.cpp, loudness_calculator.cpp, and
limiter.cpp on Android builds.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-10-11 18:51:08 +10:00
Zephyron
56dba09e0c feat: REV15 audio renderer + HID fix (v0.8.0)
Complete SDK15 audio implementation with native float biquads.
Fixes TotK 1.4.2 and BotW 1.8.2 boot loops.

- Add REV15 float biquad filter support
- Implement VoiceInParameterV2 (0x188 bytes)
- Add SplitterDestinationV2b with biquad filters
- Fix HID sampling number (double state value)
- Add AudioSnoopManager and AudioSystemManager
- Implement FinalOutputRecorder system
- Add FFT and loudness calculator (ITU-R BS.1770)
- Add full Limiter effect

Resolves boot loops and controller detection in SDK20 games.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-10-11 14:10:08 +10:00
Zephyron
2fa3501ff4 feat(audio): Add REV13 audio renderer support
- Implement compressor statistics collection and tracking
- Add explicit splitter volume reset functionality
- Implement REV13 audio device notification commands
- Update feature support system to revision 13
- Maintain backward compatibility with older revisions

Resolves REV13 audio renderer feature requirements with proper
Nintendo Switch development practices and SwitchBrew compatibility.

REF: a2c0035013
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-09-27 10:13:32 +10:00
Zephyron
5871f4b418 revert: af223e445f && 5ed7df1e68
- Needs To Be A Branch

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-09-26 16:55:32 +10:00
Zephyron
7acd55a005 Merge branch 'collecting-main-patch-05267' into 'main'
Audio Stability Fixes

See merge request citron/emulator!51
2025-09-26 15:51:13 +10:00
Zephyron
704c886d3d Merge branch 'collecting-main-patch-77704' into 'main'
Audio Stability Issues

See merge request citron/emulator!50
2025-09-26 15:51:10 +10:00
collecting
97cd9112a1 Audio Stability Fixes 2025-09-26 04:40:01 +00:00
collecting
38a189c0af Audio Stability Issues 2025-09-26 04:30:47 +00:00
collecting
1c48d8fb7d Audio Stability Fixes 2025-09-26 04:27:01 +00:00
Zephyron
5ed7df1e68 audio_core: Implement further Audio REV 15 support for SDK 19.0.0+ compatibility
This commit adds further Audio REV 15 support to enable compatibility with games
compiled against Nintendo Switch SDK 19.0.0 and later versions.

Fixes: Audio compatibility issues with SDK 19.0.0+ games
Resolves: Missing Audio REV 15 feature support
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-09-25 16:52:04 +10:00
Zephyron
af223e445f feat: Enhance audio renderer with new features and simplify Android UI indicators
Audio Core:
- Add support for splitter previous volume reset (REV 13+)
- Implement new audio processing time limits (REV 14-15)
- Add voice channel resource limits and effect processing v3
- Support float biquad filters for improved audio quality
- Enhance error handling to prevent audio system crashes

Android UI:
- Simplify FPS, RAM, and thermal indicator views
- Remove complex backgrounds and icons for cleaner display
- Reduce view sizes and improve text-based rendering
- Maintain color-coded status indicators for performance metrics

Core System:
- Improve file system save data space handling
- Enhance kernel synchronization error handling
- Add new error modules and result codes
- Fix potential infinite loops in handle operations

These changes improve audio processing capabilities while providing a cleaner,
more performant Android UI experience.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-09-23 21:26:59 +10:00
Zephyron
9e49ff3897 Revert "audio_core: Improve audio renderer compatibility and error handling"
This reverts commit c8aeab799d.
2025-06-23 19:15:09 +10:00
Zephyron
39ed0afa1f Revert "Implement IApplicationFunctions function 210 (RequestToAcquireUserUsedMemory)"
This reverts commit 1471d150d0.
2025-06-23 19:14:23 +10:00
Zephyron
1471d150d0 Implement IApplicationFunctions function 210 (RequestToAcquireUserUsedMemory) 2025-06-20 15:52:14 +10:00
Zephyron
c8aeab799d audio_core: Improve audio renderer compatibility and error handling
- Change mix size mismatch from error to warning with recovery
- Adjust input pointer when consumed size doesn't match header size
  to prevent desync and allow processing to continue
- Expand VoiceInfo::InParameter struct by 24 bytes (0x170 -> 0x188)
  to support newer audio renderer versions
- Update static_assert to reflect new structure size

This improves compatibility with games that use newer audio renderer versions or have slight structural differences.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-06-16 17:24:58 +10:00
Liam
2e4a6b7f92 audio: format 2024-02-20 22:51:39 -05:00
Liam
c575a85233 audio: rewrite IAudioDevice 2024-02-20 22:15:38 -05:00
Liam
6012c9fe3a audio: rewrite IAudioRendererManager 2024-02-20 22:15:37 -05:00
Kelebek1
19a2f12692 Use the input process handle to get the correct application's memory 2024-01-28 18:51:43 +00:00
Fernando Sahmkow
590d9b7e1d Core: Clang format and other small issues. 2024-01-18 21:12:30 -05:00
Fernando Sahmkow
0a2536a0df SMMU: Initial adaptation to video_core. 2024-01-18 21:12:30 -05:00
Viktor Szépe
2044ae6b3a Fix more typos 2024-01-15 23:26:53 +00:00
Liam
0448eb6f0f ci: fix new codespell errors 2023-10-02 18:03:05 -04:00
Kelebek1
5d7571114e Do not consider voice commands in time estimation, fix adpcm estimate 2023-09-18 10:38:14 +01:00
liamwhite
3df56dc790 Merge pull request #11465 from Kelebek1/skip_remaining_reset
[Audio] Do not reset the remaining command count each time
2023-09-10 13:40:32 -04:00
Kelebek1
800d6f7d0d Fix data source version 1 command looping 2023-09-08 15:03:21 +01:00
Kelebek1
4baaaf6a99 Do not reset the command buffer command count each time 2023-09-07 20:53:48 +01:00
Kelebek1
ebd19dec99 Rework ADSP into a wrapper for apps 2023-09-04 17:12:16 +01:00
Kelebek1
1d201c71dc Fix node id index in DropVoices 2023-08-28 10:35:30 +01:00
Kelebek1
6f7cb69c94 Use spans over guest memory where possible instead of copying data. 2023-07-02 23:09:48 +01:00
Kelebek1
5da70f7197 Remove memory allocations in some hot paths 2023-06-22 08:05:10 +01:00
Morph
8e56a84566 core_timing: Use CNTPCT as the guest CPU tick
Previously, we were mixing the raw CPU frequency and CNTFRQ.
The raw CPU frequency (1020 MHz) should've never been used as CNTPCT (whose frequency is CNTFRQ) is the only counter available.
2023-06-07 21:44:42 -04:00
Liam
e96a3a1713 audio_renderer: resolve adsp thread deadlock shutdown 2023-06-04 13:00:10 -04:00
Kelebek1
d75bcdd077 Smooth out the DSP callback by adding a 5ms wait time limit 2023-05-18 13:03:32 +01:00
Kelebek1
2feb40f14d Wait for the terminate event before destroying a system instance 2023-05-01 00:27:12 +01:00
bunnei
6775a6ee02 Merge pull request #9969 from bylaws/master
Audio synchronisation improvements
2023-04-01 14:34:59 -07:00
Billy Laws
237934b736 Run clang-format 2023-03-27 22:01:41 +01:00
Billy Laws
ea5dd02db9 audio: Wait for samples on the emulated DSP side to avoid desyncs
Waiting on the host side is inaccurate and leads to desyncs in the event of the sink missing a deadline that require stalls to fix. By waiting for the sink to have space before even starting rendering such desyncs can be avoided.
2023-03-27 21:34:28 +01:00
Billy Laws
d8fc3f403b audio: Interpolate system manager sample count using host sink sample info
This avoids the need to stall if the host sink sporadically misses the deadline, in such a case the previous implementation would report them samples as being played on-time, causing the guest to send more samples and leading to a gradual buildup.
2023-03-26 22:48:57 +01:00
Liam
41d99aa89d memory: rename global memory references to application memory 2023-03-23 20:28:47 -04:00
Liam
600f325d87 general: fix spelling mistakes 2023-03-12 11:33:01 -04:00
liamwhite
021af4fd00 Merge pull request #9917 from Morph1984/the-real-time
native_clock: Re-adjust the RDTSC frequency to its real frequency
2023-03-10 13:55:11 -05:00
Morph
3053a62375 core: Promote CPU/GPU threads to time critical
And also demote Audren and CoreTiming to High thread priority.
2023-03-07 21:17:46 -05:00
Liam
1d0fe75e7c hle: rename legacy errors to Results 2023-03-06 20:58:42 -05:00
Kelebek1
104cb6aa0a Fix a bug with the Reverb command in reading from the pre_delay line. 2023-03-02 06:00:55 +00:00
bunnei
744434de38 Merge pull request #9769 from Kelebek1/audio_oob
[audio_core] Fix depop prepare
2023-02-16 12:26:23 -08:00
liamwhite
6d77de96da Merge pull request #9796 from liamwhite/current
general: rename CurrentProcess to ApplicationProcess
2023-02-15 17:42:45 -05:00