summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/audio_core.cpp10
-rw-r--r--src/audio_core/audio_core.h10
-rw-r--r--src/audio_core/audio_event.h4
-rw-r--r--src/audio_core/audio_in_manager.h5
-rw-r--r--src/audio_core/audio_manager.h2
-rw-r--r--src/audio_core/audio_render_manager.h6
-rw-r--r--src/audio_core/device/audio_buffers.h4
-rw-r--r--src/audio_core/device/device_session.h3
-rw-r--r--src/audio_core/in/audio_in_system.h2
-rw-r--r--src/audio_core/out/audio_out_system.h2
-rw-r--r--src/audio_core/renderer/adsp/adsp.h2
-rw-r--r--src/audio_core/renderer/adsp/audio_renderer.h6
-rw-r--r--src/audio_core/renderer/adsp/command_list_processor.h13
-rw-r--r--src/audio_core/renderer/command/command_buffer.h12
-rw-r--r--src/audio_core/renderer/command/command_generator.h46
-rw-r--r--src/audio_core/renderer/command/effect/compressor.cpp11
-rw-r--r--src/audio_core/renderer/command/mix/mix_ramp.cpp18
-rw-r--r--src/audio_core/renderer/command/mix/mix_ramp.h8
-rw-r--r--src/audio_core/renderer/command/mix/mix_ramp_grouped.h4
-rw-r--r--src/audio_core/renderer/effect/effect_context.h14
-rw-r--r--src/audio_core/renderer/effect/effect_info_base.h4
-rw-r--r--src/audio_core/renderer/memory/address_info.h5
-rw-r--r--src/audio_core/renderer/nodes/node_states.h4
-rw-r--r--src/audio_core/renderer/performance/performance_manager.h8
-rw-r--r--src/audio_core/renderer/system_manager.cpp11
-rw-r--r--src/audio_core/renderer/system_manager.h9
-rw-r--r--src/audio_core/renderer/upsampler/upsampler_manager.h2
-rw-r--r--src/audio_core/renderer/voice/voice_info.h26
-rw-r--r--src/audio_core/sink/cubeb_sink.cpp34
-rw-r--r--src/audio_core/sink/cubeb_sink.h15
-rw-r--r--src/audio_core/sink/null_sink.h2
-rw-r--r--src/audio_core/sink/sdl2_sink.cpp27
-rw-r--r--src/audio_core/sink/sdl2_sink.h15
-rw-r--r--src/audio_core/sink/sink.h13
-rw-r--r--src/audio_core/sink/sink_stream.cpp16
-rw-r--r--src/audio_core/sink/sink_stream.h4
-rw-r--r--src/common/CMakeLists.txt3
-rw-r--r--src/core/core.cpp4
-rw-r--r--src/core/core_timing.cpp14
-rw-r--r--src/core/core_timing.h6
-rw-r--r--src/yuzu/configuration/configure_tas.ui3
41 files changed, 144 insertions, 263 deletions
diff --git a/src/audio_core/audio_core.cpp b/src/audio_core/audio_core.cpp
index 9feec1829..c845330cd 100644
--- a/src/audio_core/audio_core.cpp
+++ b/src/audio_core/audio_core.cpp
@@ -47,16 +47,6 @@ AudioRenderer::ADSP::ADSP& AudioCore::GetADSP() {
47 return *adsp; 47 return *adsp;
48} 48}
49 49
50void AudioCore::PauseSinks(const bool pausing) const {
51 if (pausing) {
52 output_sink->PauseStreams();
53 input_sink->PauseStreams();
54 } else {
55 output_sink->UnpauseStreams();
56 input_sink->UnpauseStreams();
57 }
58}
59
60void AudioCore::SetNVDECActive(bool active) { 50void AudioCore::SetNVDECActive(bool active) {
61 nvdec_active = active; 51 nvdec_active = active;
62} 52}
diff --git a/src/audio_core/audio_core.h b/src/audio_core/audio_core.h
index ac9afefaa..e33e00a3e 100644
--- a/src/audio_core/audio_core.h
+++ b/src/audio_core/audio_core.h
@@ -17,7 +17,7 @@ namespace AudioCore {
17 17
18class AudioManager; 18class AudioManager;
19/** 19/**
20 * Main audio class, sotred inside the core, and holding the audio manager, all sinks, and the ADSP. 20 * Main audio class, stored inside the core, and holding the audio manager, all sinks, and the ADSP.
21 */ 21 */
22class AudioCore { 22class AudioCore {
23public: 23public:
@@ -58,14 +58,6 @@ public:
58 AudioRenderer::ADSP::ADSP& GetADSP(); 58 AudioRenderer::ADSP::ADSP& GetADSP();
59 59
60 /** 60 /**
61 * Pause the sink. Called from the core.
62 *
63 * @param pausing - Is this pause due to an actual pause, or shutdown?
64 * Unfortunately, shutdown also pauses streams, which can cause issues.
65 */
66 void PauseSinks(bool pausing) const;
67
68 /**
69 * Toggle NVDEC state, used to avoid stall in playback. 61 * Toggle NVDEC state, used to avoid stall in playback.
70 * 62 *
71 * @param active - Set true if nvdec is active, otherwise false. 63 * @param active - Set true if nvdec is active, otherwise false.
diff --git a/src/audio_core/audio_event.h b/src/audio_core/audio_event.h
index 82dd32dca..012d2ed70 100644
--- a/src/audio_core/audio_event.h
+++ b/src/audio_core/audio_event.h
@@ -14,7 +14,7 @@ namespace AudioCore {
14 * Responsible for the input/output events, set by the stream backend when buffers are consumed, and 14 * Responsible for the input/output events, set by the stream backend when buffers are consumed, and
15 * waited on by the audio manager. These callbacks signal the game's events to keep the audio buffer 15 * waited on by the audio manager. These callbacks signal the game's events to keep the audio buffer
16 * recycling going. 16 * recycling going.
17 * In a real Switch this is not a seprate class, and exists entirely within the audio manager. 17 * In a real Switch this is not a separate class, and exists entirely within the audio manager.
18 * On the Switch it's implemented more simply through a MultiWaitEventHolder, where it can 18 * On the Switch it's implemented more simply through a MultiWaitEventHolder, where it can
19 * wait on multiple events at once, and the events are not needed by the backend. 19 * wait on multiple events at once, and the events are not needed by the backend.
20 */ 20 */
@@ -81,7 +81,7 @@ public:
81 void ClearEvents(); 81 void ClearEvents();
82 82
83private: 83private:
84 /// Lock, used bythe audio manager 84 /// Lock, used by the audio manager
85 std::mutex event_lock; 85 std::mutex event_lock;
86 /// Array of events, one per system type (see Type), last event is used to terminate 86 /// Array of events, one per system type (see Type), last event is used to terminate
87 std::array<std::atomic<bool>, 4> events_signalled; 87 std::array<std::atomic<bool>, 4> events_signalled;
diff --git a/src/audio_core/audio_in_manager.h b/src/audio_core/audio_in_manager.h
index 75b73a0b6..8a519df99 100644
--- a/src/audio_core/audio_in_manager.h
+++ b/src/audio_core/audio_in_manager.h
@@ -59,9 +59,10 @@ public:
59 /** 59 /**
60 * Get a list of audio in device names. 60 * Get a list of audio in device names.
61 * 61 *
62 * @oaram names - Output container to write names to. 62 * @param names - Output container to write names to.
63 * @param max_count - Maximum numebr of deivce names to write. Unused 63 * @param max_count - Maximum number of device names to write. Unused
64 * @param filter - Should the list be filtered? Unused. 64 * @param filter - Should the list be filtered? Unused.
65 *
65 * @return Number of names written. 66 * @return Number of names written.
66 */ 67 */
67 u32 GetDeviceNames(std::vector<AudioRenderer::AudioDevice::AudioDeviceName>& names, 68 u32 GetDeviceNames(std::vector<AudioRenderer::AudioDevice::AudioDeviceName>& names,
diff --git a/src/audio_core/audio_manager.h b/src/audio_core/audio_manager.h
index 70316e9cb..8cbd95e22 100644
--- a/src/audio_core/audio_manager.h
+++ b/src/audio_core/audio_manager.h
@@ -76,7 +76,7 @@ public:
76 76
77private: 77private:
78 /** 78 /**
79 * Main thread, waiting on a manager signal and calling the registered fucntion. 79 * Main thread, waiting on a manager signal and calling the registered function.
80 */ 80 */
81 void ThreadFunc(); 81 void ThreadFunc();
82 82
diff --git a/src/audio_core/audio_render_manager.h b/src/audio_core/audio_render_manager.h
index 6a508ec56..7119e1b99 100644
--- a/src/audio_core/audio_render_manager.h
+++ b/src/audio_core/audio_render_manager.h
@@ -64,10 +64,10 @@ public:
64 64
65 /** 65 /**
66 * Add a renderer system to the manager. 66 * Add a renderer system to the manager.
67 * The system will be reguarly called to generate commands for the AudioRenderer. 67 * The system will be regularly called to generate commands for the AudioRenderer.
68 * 68 *
69 * @param system - The system to add. 69 * @param system - The system to add.
70 * @return True if the system was sucessfully added, otherwise false. 70 * @return True if the system was successfully added, otherwise false.
71 */ 71 */
72 bool AddSystem(System& system); 72 bool AddSystem(System& system);
73 73
@@ -75,7 +75,7 @@ public:
75 * Remove a renderer system from the manager. 75 * Remove a renderer system from the manager.
76 * 76 *
77 * @param system - The system to remove. 77 * @param system - The system to remove.
78 * @return True if the system was sucessfully removed, otherwise false. 78 * @return True if the system was successfully removed, otherwise false.
79 */ 79 */
80 bool RemoveSystem(System& system); 80 bool RemoveSystem(System& system);
81 81
diff --git a/src/audio_core/device/audio_buffers.h b/src/audio_core/device/audio_buffers.h
index 57c78d439..3ecbbb63f 100644
--- a/src/audio_core/device/audio_buffers.h
+++ b/src/audio_core/device/audio_buffers.h
@@ -88,7 +88,9 @@ public:
88 /** 88 /**
89 * Release all registered buffers. 89 * Release all registered buffers.
90 * 90 *
91 * @param timestamp - The released timestamp for this buffer. 91 * @param core_timing - The CoreTiming instance
92 * @param session - The device session
93 *
92 * @return Is the buffer was released. 94 * @return Is the buffer was released.
93 */ 95 */
94 bool ReleaseBuffers(Core::Timing::CoreTiming& core_timing, DeviceSession& session) { 96 bool ReleaseBuffers(Core::Timing::CoreTiming& core_timing, DeviceSession& session) {
diff --git a/src/audio_core/device/device_session.h b/src/audio_core/device/device_session.h
index 3414e2c06..53b649c61 100644
--- a/src/audio_core/device/device_session.h
+++ b/src/audio_core/device/device_session.h
@@ -74,7 +74,8 @@ public:
74 /** 74 /**
75 * Check if the buffer for the given tag has been consumed by the backend. 75 * Check if the buffer for the given tag has been consumed by the backend.
76 * 76 *
77 * @param tag - Unqiue tag of the buffer to check. 77 * @param buffer - the buffer to check.
78 *
78 * @return true if the buffer has been consumed, otherwise false. 79 * @return true if the buffer has been consumed, otherwise false.
79 */ 80 */
80 bool IsBufferConsumed(AudioBuffer& buffer) const; 81 bool IsBufferConsumed(AudioBuffer& buffer) const;
diff --git a/src/audio_core/in/audio_in_system.h b/src/audio_core/in/audio_in_system.h
index 165e35d83..9ddc8daae 100644
--- a/src/audio_core/in/audio_in_system.h
+++ b/src/audio_core/in/audio_in_system.h
@@ -208,7 +208,7 @@ public:
208 /** 208 /**
209 * Set this system's current volume. 209 * Set this system's current volume.
210 * 210 *
211 * @param The new volume. 211 * @param volume The new volume.
212 */ 212 */
213 void SetVolume(f32 volume); 213 void SetVolume(f32 volume);
214 214
diff --git a/src/audio_core/out/audio_out_system.h b/src/audio_core/out/audio_out_system.h
index 4ca2f3417..205ead861 100644
--- a/src/audio_core/out/audio_out_system.h
+++ b/src/audio_core/out/audio_out_system.h
@@ -199,7 +199,7 @@ public:
199 /** 199 /**
200 * Set this system's current volume. 200 * Set this system's current volume.
201 * 201 *
202 * @param The new volume. 202 * @param volume The new volume.
203 */ 203 */
204 void SetVolume(f32 volume); 204 void SetVolume(f32 volume);
205 205
diff --git a/src/audio_core/renderer/adsp/adsp.h b/src/audio_core/renderer/adsp/adsp.h
index 4dfcef4a5..523184dc2 100644
--- a/src/audio_core/renderer/adsp/adsp.h
+++ b/src/audio_core/renderer/adsp/adsp.h
@@ -63,8 +63,6 @@ public:
63 63
64 /** 64 /**
65 * Stop the ADSP. 65 * Stop the ADSP.
66 *
67 * @return True if started or already running, otherwise false.
68 */ 66 */
69 void Stop(); 67 void Stop();
70 68
diff --git a/src/audio_core/renderer/adsp/audio_renderer.h b/src/audio_core/renderer/adsp/audio_renderer.h
index b6ced9d2b..49f66f21c 100644
--- a/src/audio_core/renderer/adsp/audio_renderer.h
+++ b/src/audio_core/renderer/adsp/audio_renderer.h
@@ -52,7 +52,7 @@ public:
52 /** 52 /**
53 * Send a message from the host to the AudioRenderer. 53 * Send a message from the host to the AudioRenderer.
54 * 54 *
55 * @param message_ - The message to send to the AudioRenderer. 55 * @param message - The message to send to the AudioRenderer.
56 */ 56 */
57 void HostSendMessage(RenderMessage message); 57 void HostSendMessage(RenderMessage message);
58 58
@@ -66,7 +66,7 @@ public:
66 /** 66 /**
67 * Send a message from the AudioRenderer to the host. 67 * Send a message from the AudioRenderer to the host.
68 * 68 *
69 * @param message_ - The message to send to the host. 69 * @param message - The message to send to the host.
70 */ 70 */
71 void ADSPSendMessage(RenderMessage message); 71 void ADSPSendMessage(RenderMessage message);
72 72
@@ -163,7 +163,7 @@ public:
163 /** 163 /**
164 * Start the AudioRenderer. 164 * Start the AudioRenderer.
165 * 165 *
166 * @param The mailbox to use for this session. 166 * @param mailbox The mailbox to use for this session.
167 */ 167 */
168 void Start(AudioRenderer_Mailbox* mailbox); 168 void Start(AudioRenderer_Mailbox* mailbox);
169 169
diff --git a/src/audio_core/renderer/adsp/command_list_processor.h b/src/audio_core/renderer/adsp/command_list_processor.h
index 3f99173e3..d78269e1d 100644
--- a/src/audio_core/renderer/adsp/command_list_processor.h
+++ b/src/audio_core/renderer/adsp/command_list_processor.h
@@ -33,10 +33,10 @@ public:
33 /** 33 /**
34 * Initialize the processor. 34 * Initialize the processor.
35 * 35 *
36 * @param system_ - The core system. 36 * @param system - The core system.
37 * @param buffer - The command buffer to process. 37 * @param buffer - The command buffer to process.
38 * @param size - The size of the buffer. 38 * @param size - The size of the buffer.
39 * @param stream_ - The stream to be used for sending the samples. 39 * @param stream - The stream to be used for sending the samples.
40 */ 40 */
41 void Initialize(Core::System& system, CpuAddr buffer, u64 size, Sink::SinkStream* stream); 41 void Initialize(Core::System& system, CpuAddr buffer, u64 size, Sink::SinkStream* stream);
42 42
@@ -72,7 +72,8 @@ public:
72 /** 72 /**
73 * Process the command list. 73 * Process the command list.
74 * 74 *
75 * @param index - Index of the current command list. 75 * @param session_id - Session ID for the commands being processed.
76 *
76 * @return The time taken to process. 77 * @return The time taken to process.
77 */ 78 */
78 u64 Process(u32 session_id); 79 u64 Process(u32 session_id);
@@ -89,7 +90,7 @@ public:
89 u8* commands{}; 90 u8* commands{};
90 /// The command buffer size 91 /// The command buffer size
91 u64 commands_buffer_size{}; 92 u64 commands_buffer_size{};
92 /// The maximum processing time alloted 93 /// The maximum processing time allotted
93 u64 max_process_time{}; 94 u64 max_process_time{};
94 /// The number of commands in the buffer 95 /// The number of commands in the buffer
95 u32 command_count{}; 96 u32 command_count{};
diff --git a/src/audio_core/renderer/command/command_buffer.h b/src/audio_core/renderer/command/command_buffer.h
index 496b0e50a..162170846 100644
--- a/src/audio_core/renderer/command/command_buffer.h
+++ b/src/audio_core/renderer/command/command_buffer.h
@@ -191,6 +191,7 @@ public:
191 * @param volume - Current mix volume used for calculating the ramp. 191 * @param volume - Current mix volume used for calculating the ramp.
192 * @param prev_volume - Previous mix volume, used for calculating the ramp, 192 * @param prev_volume - Previous mix volume, used for calculating the ramp,
193 * also applied to the input. 193 * also applied to the input.
194 * @param prev_samples - Previous sample buffer. Used for depopping.
194 * @param precision - Number of decimal bits for fixed point operations. 195 * @param precision - Number of decimal bits for fixed point operations.
195 */ 196 */
196 void GenerateMixRampCommand(s32 node_id, s16 buffer_count, s16 input_index, s16 output_index, 197 void GenerateMixRampCommand(s32 node_id, s16 buffer_count, s16 input_index, s16 output_index,
@@ -208,6 +209,7 @@ public:
208 * @param volumes - Current mix volumes used for calculating the ramp. 209 * @param volumes - Current mix volumes used for calculating the ramp.
209 * @param prev_volumes - Previous mix volumes, used for calculating the ramp, 210 * @param prev_volumes - Previous mix volumes, used for calculating the ramp,
210 * also applied to the input. 211 * also applied to the input.
212 * @param prev_samples - Previous sample buffer. Used for depopping.
211 * @param precision - Number of decimal bits for fixed point operations. 213 * @param precision - Number of decimal bits for fixed point operations.
212 */ 214 */
213 void GenerateMixRampGroupedCommand(s32 node_id, s16 buffer_count, s16 input_index, 215 void GenerateMixRampGroupedCommand(s32 node_id, s16 buffer_count, s16 input_index,
@@ -297,11 +299,11 @@ public:
297 /** 299 /**
298 * Generate a device sink command, adding it to the command list. 300 * Generate a device sink command, adding it to the command list.
299 * 301 *
300 * @param node_id - Node id of the voice this command is generated for. 302 * @param node_id - Node id of the voice this command is generated for.
301 * @param buffer_offset - Base mix buffer offset to use. 303 * @param buffer_offset - Base mix buffer offset to use.
302 * @param sink_info - The sink_info to generate this command from. 304 * @param sink_info - The sink_info to generate this command from.
303 * @session_id - System session id this command is generated from. 305 * @param session_id - System session id this command is generated from.
304 * @samples_buffer - The buffer to be sent to the sink if upsampling is not used. 306 * @param samples_buffer - The buffer to be sent to the sink if upsampling is not used.
305 */ 307 */
306 void GenerateDeviceSinkCommand(s32 node_id, s16 buffer_offset, SinkInfoBase& sink_info, 308 void GenerateDeviceSinkCommand(s32 node_id, s16 buffer_offset, SinkInfoBase& sink_info,
307 u32 session_id, std::span<s32> samples_buffer); 309 u32 session_id, std::span<s32> samples_buffer);
diff --git a/src/audio_core/renderer/command/command_generator.h b/src/audio_core/renderer/command/command_generator.h
index d80d9b0d8..b3cd7b408 100644
--- a/src/audio_core/renderer/command/command_generator.h
+++ b/src/audio_core/renderer/command/command_generator.h
@@ -197,9 +197,9 @@ public:
197 /** 197 /**
198 * Generate an I3DL2 reverb effect command. 198 * Generate an I3DL2 reverb effect command.
199 * 199 *
200 * @param buffer_offset - Base mix buffer offset to use. 200 * @param buffer_offset - Base mix buffer offset to use.
201 * @param effect_info_base - I3DL2Reverb effect info. 201 * @param effect_info - I3DL2Reverb effect info.
202 * @param node_id - Node id of the mix this command is generated for. 202 * @param node_id - Node id of the mix this command is generated for.
203 */ 203 */
204 void GenerateI3dl2ReverbEffectCommand(s16 buffer_offset, EffectInfoBase& effect_info, 204 void GenerateI3dl2ReverbEffectCommand(s16 buffer_offset, EffectInfoBase& effect_info,
205 s32 node_id); 205 s32 node_id);
@@ -207,18 +207,18 @@ public:
207 /** 207 /**
208 * Generate an aux effect command. 208 * Generate an aux effect command.
209 * 209 *
210 * @param buffer_offset - Base mix buffer offset to use. 210 * @param buffer_offset - Base mix buffer offset to use.
211 * @param effect_info_base - Aux effect info. 211 * @param effect_info - Aux effect info.
212 * @param node_id - Node id of the mix this command is generated for. 212 * @param node_id - Node id of the mix this command is generated for.
213 */ 213 */
214 void GenerateAuxCommand(s16 buffer_offset, EffectInfoBase& effect_info, s32 node_id); 214 void GenerateAuxCommand(s16 buffer_offset, EffectInfoBase& effect_info, s32 node_id);
215 215
216 /** 216 /**
217 * Generate a biquad filter effect command. 217 * Generate a biquad filter effect command.
218 * 218 *
219 * @param buffer_offset - Base mix buffer offset to use. 219 * @param buffer_offset - Base mix buffer offset to use.
220 * @param effect_info_base - Aux effect info. 220 * @param effect_info - Aux effect info.
221 * @param node_id - Node id of the mix this command is generated for. 221 * @param node_id - Node id of the mix this command is generated for.
222 */ 222 */
223 void GenerateBiquadFilterEffectCommand(s16 buffer_offset, EffectInfoBase& effect_info, 223 void GenerateBiquadFilterEffectCommand(s16 buffer_offset, EffectInfoBase& effect_info,
224 s32 node_id); 224 s32 node_id);
@@ -226,10 +226,10 @@ public:
226 /** 226 /**
227 * Generate a light limiter effect command. 227 * Generate a light limiter effect command.
228 * 228 *
229 * @param buffer_offset - Base mix buffer offset to use. 229 * @param buffer_offset - Base mix buffer offset to use.
230 * @param effect_info_base - Limiter effect info. 230 * @param effect_info - Limiter effect info.
231 * @param node_id - Node id of the mix this command is generated for. 231 * @param node_id - Node id of the mix this command is generated for.
232 * @param effect_index - Index for the statistics state. 232 * @param effect_index - Index for the statistics state.
233 */ 233 */
234 void GenerateLightLimiterEffectCommand(s16 buffer_offset, EffectInfoBase& effect_info, 234 void GenerateLightLimiterEffectCommand(s16 buffer_offset, EffectInfoBase& effect_info,
235 s32 node_id, u32 effect_index); 235 s32 node_id, u32 effect_index);
@@ -238,21 +238,20 @@ public:
238 * Generate a capture effect command. 238 * Generate a capture effect command.
239 * Writes a mix buffer back to game memory. 239 * Writes a mix buffer back to game memory.
240 * 240 *
241 * @param buffer_offset - Base mix buffer offset to use. 241 * @param buffer_offset - Base mix buffer offset to use.
242 * @param effect_info_base - Capture effect info. 242 * @param effect_info - Capture effect info.
243 * @param node_id - Node id of the mix this command is generated for. 243 * @param node_id - Node id of the mix this command is generated for.
244 */ 244 */
245 void GenerateCaptureCommand(s16 buffer_offset, EffectInfoBase& effect_info, s32 node_id); 245 void GenerateCaptureCommand(s16 buffer_offset, EffectInfoBase& effect_info, s32 node_id);
246 246
247 /** 247 /**
248 * Generate a compressor effect command. 248 * Generate a compressor effect command.
249 * 249 *
250 * @param buffer_offset - Base mix buffer offset to use. 250 * @param buffer_offset - Base mix buffer offset to use.
251 * @param effect_info_base - Compressor effect info. 251 * @param effect_info - Compressor effect info.
252 * @param node_id - Node id of the mix this command is generated for. 252 * @param node_id - Node id of the mix this command is generated for.
253 */ 253 */
254 void GenerateCompressorCommand(const s16 buffer_offset, EffectInfoBase& effect_info, 254 void GenerateCompressorCommand(s16 buffer_offset, EffectInfoBase& effect_info, s32 node_id);
255 const s32 node_id);
256 255
257 /** 256 /**
258 * Generate all effect commands for a mix. 257 * Generate all effect commands for a mix.
@@ -318,8 +317,9 @@ public:
318 * Generate a performance command. 317 * Generate a performance command.
319 * Used to report performance metrics of the AudioRenderer back to the game. 318 * Used to report performance metrics of the AudioRenderer back to the game.
320 * 319 *
321 * @param buffer_offset - Base mix buffer offset to use. 320 * @param node_id - Node ID of the mix this command is generated for
322 * @param sink_info - Sink info to generate the commands from. 321 * @param state - Output state of the generated performance command
322 * @param entry_addresses - Addresses to be written
323 */ 323 */
324 void GeneratePerformanceCommand(s32 node_id, PerformanceState state, 324 void GeneratePerformanceCommand(s32 node_id, PerformanceState state,
325 const PerformanceEntryAddresses& entry_addresses); 325 const PerformanceEntryAddresses& entry_addresses);
diff --git a/src/audio_core/renderer/command/effect/compressor.cpp b/src/audio_core/renderer/command/effect/compressor.cpp
index 2ebc140f1..7229618e8 100644
--- a/src/audio_core/renderer/command/effect/compressor.cpp
+++ b/src/audio_core/renderer/command/effect/compressor.cpp
@@ -11,7 +11,7 @@
11 11
12namespace AudioCore::AudioRenderer { 12namespace AudioCore::AudioRenderer {
13 13
14static void SetCompressorEffectParameter(CompressorInfo::ParameterVersion2& params, 14static void SetCompressorEffectParameter(const CompressorInfo::ParameterVersion2& params,
15 CompressorInfo::State& state) { 15 CompressorInfo::State& state) {
16 const auto ratio{1.0f / params.compressor_ratio}; 16 const auto ratio{1.0f / params.compressor_ratio};
17 auto makeup_gain{0.0f}; 17 auto makeup_gain{0.0f};
@@ -31,9 +31,9 @@ static void SetCompressorEffectParameter(CompressorInfo::ParameterVersion2& para
31 state.unk_20 = c; 31 state.unk_20 = c;
32} 32}
33 33
34static void InitializeCompressorEffect(CompressorInfo::ParameterVersion2& params, 34static void InitializeCompressorEffect(const CompressorInfo::ParameterVersion2& params,
35 CompressorInfo::State& state) { 35 CompressorInfo::State& state) {
36 std::memset(&state, 0, sizeof(CompressorInfo::State)); 36 state = {};
37 37
38 state.unk_00 = 0; 38 state.unk_00 = 0;
39 state.unk_04 = 1.0f; 39 state.unk_04 = 1.0f;
@@ -42,7 +42,7 @@ static void InitializeCompressorEffect(CompressorInfo::ParameterVersion2& params
42 SetCompressorEffectParameter(params, state); 42 SetCompressorEffectParameter(params, state);
43} 43}
44 44
45static void ApplyCompressorEffect(CompressorInfo::ParameterVersion2& params, 45static void ApplyCompressorEffect(const CompressorInfo::ParameterVersion2& params,
46 CompressorInfo::State& state, bool enabled, 46 CompressorInfo::State& state, bool enabled,
47 std::vector<std::span<const s32>> input_buffers, 47 std::vector<std::span<const s32>> input_buffers,
48 std::vector<std::span<s32>> output_buffers, u32 sample_count) { 48 std::vector<std::span<s32>> output_buffers, u32 sample_count) {
@@ -103,8 +103,7 @@ static void ApplyCompressorEffect(CompressorInfo::ParameterVersion2& params,
103 } else { 103 } else {
104 for (s16 channel = 0; channel < params.channel_count; channel++) { 104 for (s16 channel = 0; channel < params.channel_count; channel++) {
105 if (params.inputs[channel] != params.outputs[channel]) { 105 if (params.inputs[channel] != params.outputs[channel]) {
106 std::memcpy((char*)output_buffers[channel].data(), 106 std::memcpy(output_buffers[channel].data(), input_buffers[channel].data(),
107 (char*)input_buffers[channel].data(),
108 output_buffers[channel].size_bytes()); 107 output_buffers[channel].size_bytes());
109 } 108 }
110 } 109 }
diff --git a/src/audio_core/renderer/command/mix/mix_ramp.cpp b/src/audio_core/renderer/command/mix/mix_ramp.cpp
index ffdafa1c8..d67123cd8 100644
--- a/src/audio_core/renderer/command/mix/mix_ramp.cpp
+++ b/src/audio_core/renderer/command/mix/mix_ramp.cpp
@@ -7,17 +7,7 @@
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8 8
9namespace AudioCore::AudioRenderer { 9namespace AudioCore::AudioRenderer {
10/** 10
11 * Mix input mix buffer into output mix buffer, with volume applied to the input.
12 *
13 * @tparam Q - Number of bits for fixed point operations.
14 * @param output - Output mix buffer.
15 * @param input - Input mix buffer.
16 * @param volume - Volume applied to the input.
17 * @param ramp - Ramp applied to volume every sample.
18 * @param sample_count - Number of samples to process.
19 * @return The final gained input sample, used for depopping.
20 */
21template <size_t Q> 11template <size_t Q>
22s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, const f32 volume_, 12s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, const f32 volume_,
23 const f32 ramp_, const u32 sample_count) { 13 const f32 ramp_, const u32 sample_count) {
@@ -40,10 +30,8 @@ s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, const f32 vo
40 return sample.to_int(); 30 return sample.to_int();
41} 31}
42 32
43template s32 ApplyMixRamp<15>(std::span<s32>, std::span<const s32>, const f32, const f32, 33template s32 ApplyMixRamp<15>(std::span<s32>, std::span<const s32>, f32, f32, u32);
44 const u32); 34template s32 ApplyMixRamp<23>(std::span<s32>, std::span<const s32>, f32, f32, u32);
45template s32 ApplyMixRamp<23>(std::span<s32>, std::span<const s32>, const f32, const f32,
46 const u32);
47 35
48void MixRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::string& string) { 36void MixRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::string& string) {
49 const auto ramp{(volume - prev_volume) / static_cast<f32>(processor.sample_count)}; 37 const auto ramp{(volume - prev_volume) / static_cast<f32>(processor.sample_count)};
diff --git a/src/audio_core/renderer/command/mix/mix_ramp.h b/src/audio_core/renderer/command/mix/mix_ramp.h
index 770f57e80..52f74a273 100644
--- a/src/audio_core/renderer/command/mix/mix_ramp.h
+++ b/src/audio_core/renderer/command/mix/mix_ramp.h
@@ -61,13 +61,13 @@ struct MixRampCommand : ICommand {
61 * @tparam Q - Number of bits for fixed point operations. 61 * @tparam Q - Number of bits for fixed point operations.
62 * @param output - Output mix buffer. 62 * @param output - Output mix buffer.
63 * @param input - Input mix buffer. 63 * @param input - Input mix buffer.
64 * @param volume - Volume applied to the input. 64 * @param volume_ - Volume applied to the input.
65 * @param ramp - Ramp applied to volume every sample. 65 * @param ramp_ - Ramp applied to volume every sample.
66 * @param sample_count - Number of samples to process. 66 * @param sample_count - Number of samples to process.
67 * @return The final gained input sample, used for depopping. 67 * @return The final gained input sample, used for depopping.
68 */ 68 */
69template <size_t Q> 69template <size_t Q>
70s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, const f32 volume_, 70s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, f32 volume_, f32 ramp_,
71 const f32 ramp_, const u32 sample_count); 71 u32 sample_count);
72 72
73} // namespace AudioCore::AudioRenderer 73} // namespace AudioCore::AudioRenderer
diff --git a/src/audio_core/renderer/command/mix/mix_ramp_grouped.h b/src/audio_core/renderer/command/mix/mix_ramp_grouped.h
index 027276e5a..3b0ce67ef 100644
--- a/src/audio_core/renderer/command/mix/mix_ramp_grouped.h
+++ b/src/audio_core/renderer/command/mix/mix_ramp_grouped.h
@@ -50,9 +50,9 @@ struct MixRampGroupedCommand : ICommand {
50 std::array<s16, MaxMixBuffers> inputs; 50 std::array<s16, MaxMixBuffers> inputs;
51 /// Output mix buffer indexes for each mix buffer 51 /// Output mix buffer indexes for each mix buffer
52 std::array<s16, MaxMixBuffers> outputs; 52 std::array<s16, MaxMixBuffers> outputs;
53 /// Previous mix vloumes for each mix buffer 53 /// Previous mix volumes for each mix buffer
54 std::array<f32, MaxMixBuffers> prev_volumes; 54 std::array<f32, MaxMixBuffers> prev_volumes;
55 /// Current mix vloumes for each mix buffer 55 /// Current mix volumes for each mix buffer
56 std::array<f32, MaxMixBuffers> volumes; 56 std::array<f32, MaxMixBuffers> volumes;
57 /// Pointer to the previous sample buffer, used for depop 57 /// Pointer to the previous sample buffer, used for depop
58 CpuAddr previous_samples; 58 CpuAddr previous_samples;
diff --git a/src/audio_core/renderer/effect/effect_context.h b/src/audio_core/renderer/effect/effect_context.h
index 85955bd9c..8f6d6e7d8 100644
--- a/src/audio_core/renderer/effect/effect_context.h
+++ b/src/audio_core/renderer/effect/effect_context.h
@@ -15,15 +15,15 @@ class EffectContext {
15public: 15public:
16 /** 16 /**
17 * Initialize the effect context 17 * Initialize the effect context
18 * @param effect_infos List of effect infos for this context 18 * @param effect_infos_ - List of effect infos for this context
19 * @param effect_count The number of effects in the list 19 * @param effect_count_ - The number of effects in the list
20 * @param result_states_cpu The workbuffer of result states for the CPU for this context 20 * @param result_states_cpu_ - The workbuffer of result states for the CPU for this context
21 * @param result_states_dsp The workbuffer of result states for the DSP for this context 21 * @param result_states_dsp_ - The workbuffer of result states for the DSP for this context
22 * @param state_count The number of result states 22 * @param dsp_state_count - The number of result states
23 */ 23 */
24 void Initialize(std::span<EffectInfoBase> effect_infos_, const u32 effect_count_, 24 void Initialize(std::span<EffectInfoBase> effect_infos_, u32 effect_count_,
25 std::span<EffectResultState> result_states_cpu_, 25 std::span<EffectResultState> result_states_cpu_,
26 std::span<EffectResultState> result_states_dsp_, const size_t dsp_state_count); 26 std::span<EffectResultState> result_states_dsp_, size_t dsp_state_count);
27 27
28 /** 28 /**
29 * Get the EffectInfo for a given index 29 * Get the EffectInfo for a given index
diff --git a/src/audio_core/renderer/effect/effect_info_base.h b/src/audio_core/renderer/effect/effect_info_base.h
index 8c9583878..8525fde05 100644
--- a/src/audio_core/renderer/effect/effect_info_base.h
+++ b/src/audio_core/renderer/effect/effect_info_base.h
@@ -291,7 +291,7 @@ public:
291 * Update the info with new parameters, version 1. 291 * Update the info with new parameters, version 1.
292 * 292 *
293 * @param error_info - Used to write call result code. 293 * @param error_info - Used to write call result code.
294 * @param in_params - New parameters to update the info with. 294 * @param params - New parameters to update the info with.
295 * @param pool_mapper - Pool for mapping buffers. 295 * @param pool_mapper - Pool for mapping buffers.
296 */ 296 */
297 virtual void Update(BehaviorInfo::ErrorInfo& error_info, 297 virtual void Update(BehaviorInfo::ErrorInfo& error_info,
@@ -305,7 +305,7 @@ public:
305 * Update the info with new parameters, version 2. 305 * Update the info with new parameters, version 2.
306 * 306 *
307 * @param error_info - Used to write call result code. 307 * @param error_info - Used to write call result code.
308 * @param in_params - New parameters to update the info with. 308 * @param params - New parameters to update the info with.
309 * @param pool_mapper - Pool for mapping buffers. 309 * @param pool_mapper - Pool for mapping buffers.
310 */ 310 */
311 virtual void Update(BehaviorInfo::ErrorInfo& error_info, 311 virtual void Update(BehaviorInfo::ErrorInfo& error_info,
diff --git a/src/audio_core/renderer/memory/address_info.h b/src/audio_core/renderer/memory/address_info.h
index 4cfefea8e..bb5c930e1 100644
--- a/src/audio_core/renderer/memory/address_info.h
+++ b/src/audio_core/renderer/memory/address_info.h
@@ -19,8 +19,8 @@ public:
19 /** 19 /**
20 * Setup a new AddressInfo. 20 * Setup a new AddressInfo.
21 * 21 *
22 * @param cpu_address - The CPU address of this region. 22 * @param cpu_address_ - The CPU address of this region.
23 * @param size - The size of this region. 23 * @param size_ - The size of this region.
24 */ 24 */
25 void Setup(CpuAddr cpu_address_, u64 size_) { 25 void Setup(CpuAddr cpu_address_, u64 size_) {
26 cpu_address = cpu_address_; 26 cpu_address = cpu_address_;
@@ -42,7 +42,6 @@ public:
42 * Assign this region to a memory pool. 42 * Assign this region to a memory pool.
43 * 43 *
44 * @param memory_pool_ - Memory pool to assign. 44 * @param memory_pool_ - Memory pool to assign.
45 * @return The CpuAddr address of this region.
46 */ 45 */
47 void SetPool(MemoryPoolInfo* memory_pool_) { 46 void SetPool(MemoryPoolInfo* memory_pool_) {
48 memory_pool = memory_pool_; 47 memory_pool = memory_pool_;
diff --git a/src/audio_core/renderer/nodes/node_states.h b/src/audio_core/renderer/nodes/node_states.h
index a1e0958a2..c0fced56f 100644
--- a/src/audio_core/renderer/nodes/node_states.h
+++ b/src/audio_core/renderer/nodes/node_states.h
@@ -112,11 +112,11 @@ public:
112 /** 112 /**
113 * Initialize the node states. 113 * Initialize the node states.
114 * 114 *
115 * @param buffer - The workbuffer to use. Unused. 115 * @param buffer_ - The workbuffer to use. Unused.
116 * @param node_buffer_size - The size of the workbuffer. Unused. 116 * @param node_buffer_size - The size of the workbuffer. Unused.
117 * @param count - The number of nodes in the graph. 117 * @param count - The number of nodes in the graph.
118 */ 118 */
119 void Initialize(std::span<u8> nodes, u64 node_buffer_size, u32 count); 119 void Initialize(std::span<u8> buffer_, u64 node_buffer_size, u32 count);
120 120
121 /** 121 /**
122 * Sort the graph. Only calls DepthFirstSearch. 122 * Sort the graph. Only calls DepthFirstSearch.
diff --git a/src/audio_core/renderer/performance/performance_manager.h b/src/audio_core/renderer/performance/performance_manager.h
index b82176bef..b65caa9b6 100644
--- a/src/audio_core/renderer/performance/performance_manager.h
+++ b/src/audio_core/renderer/performance/performance_manager.h
@@ -73,7 +73,8 @@ public:
73 * Calculate the required size for the performance workbuffer. 73 * Calculate the required size for the performance workbuffer.
74 * 74 *
75 * @param behavior - Check which version is supported. 75 * @param behavior - Check which version is supported.
76 * @param params - Input parameters. 76 * @param params - Input parameters.
77 *
77 * @return Required workbuffer size. 78 * @return Required workbuffer size.
78 */ 79 */
79 static u64 GetRequiredBufferSizeForPerformanceMetricsPerFrame( 80 static u64 GetRequiredBufferSizeForPerformanceMetricsPerFrame(
@@ -104,7 +105,7 @@ public:
104 * @param workbuffer - Workbuffer to use for performance frames. 105 * @param workbuffer - Workbuffer to use for performance frames.
105 * @param workbuffer_size - Size of the workbuffer. 106 * @param workbuffer_size - Size of the workbuffer.
106 * @param params - Input parameters. 107 * @param params - Input parameters.
107 * @param behavior - Behaviour to check version and data format. 108 * @param behavior - Behaviour to check version and data format.
108 * @param memory_pool - Used to translate the workbuffer address for the DSP. 109 * @param memory_pool - Used to translate the workbuffer address for the DSP.
109 */ 110 */
110 virtual void Initialize(std::span<u8> workbuffer, u64 workbuffer_size, 111 virtual void Initialize(std::span<u8> workbuffer, u64 workbuffer_size,
@@ -160,7 +161,8 @@ public:
160 * workbuffer, to be written by the AudioRenderer. 161 * workbuffer, to be written by the AudioRenderer.
161 * 162 *
162 * @param addresses - Filled with pointers to the new detail, which should be passed 163 * @param addresses - Filled with pointers to the new detail, which should be passed
163 * to the AudioRenderer with Performance commands to be written. 164 * to the AudioRenderer with Performance commands to be written.
165 * @param detail_type - Performance detail type.
164 * @param entry_type - The type of this detail. See PerformanceEntryType 166 * @param entry_type - The type of this detail. See PerformanceEntryType
165 * @param node_id - Node id for this detail. 167 * @param node_id - Node id for this detail.
166 * @return True if a new detail was created and the offsets are valid, otherwise false. 168 * @return True if a new detail was created and the offsets are valid, otherwise false.
diff --git a/src/audio_core/renderer/system_manager.cpp b/src/audio_core/renderer/system_manager.cpp
index bc2dd9e6e..9c1331e19 100644
--- a/src/audio_core/renderer/system_manager.cpp
+++ b/src/audio_core/renderer/system_manager.cpp
@@ -22,9 +22,7 @@ SystemManager::SystemManager(Core::System& core_)
22 thread_event{Core::Timing::CreateEvent( 22 thread_event{Core::Timing::CreateEvent(
23 "AudioRendererSystemManager", [this](std::uintptr_t, s64 time, std::chrono::nanoseconds) { 23 "AudioRendererSystemManager", [this](std::uintptr_t, s64 time, std::chrono::nanoseconds) {
24 return ThreadFunc2(time); 24 return ThreadFunc2(time);
25 })} { 25 })} {}
26 core.CoreTiming().RegisterPauseCallback([this](bool paused) { PauseCallback(paused); });
27}
28 26
29SystemManager::~SystemManager() { 27SystemManager::~SystemManager() {
30 Stop(); 28 Stop();
@@ -125,11 +123,4 @@ std::optional<std::chrono::nanoseconds> SystemManager::ThreadFunc2(s64 time) {
125 return std::nullopt; 123 return std::nullopt;
126} 124}
127 125
128void SystemManager::PauseCallback(bool paused) {
129 if (paused && core.IsPoweredOn() && core.IsShuttingDown()) {
130 update.store(true);
131 update.notify_all();
132 }
133}
134
135} // namespace AudioCore::AudioRenderer 126} // namespace AudioCore::AudioRenderer
diff --git a/src/audio_core/renderer/system_manager.h b/src/audio_core/renderer/system_manager.h
index 1291e9e0e..81457a3a1 100644
--- a/src/audio_core/renderer/system_manager.h
+++ b/src/audio_core/renderer/system_manager.h
@@ -73,13 +73,6 @@ private:
73 */ 73 */
74 std::optional<std::chrono::nanoseconds> ThreadFunc2(s64 time); 74 std::optional<std::chrono::nanoseconds> ThreadFunc2(s64 time);
75 75
76 /**
77 * Callback from core timing when pausing, used to detect shutdowns and stop ThreadFunc.
78 *
79 * @param paused - Are we pausing or resuming?
80 */
81 void PauseCallback(bool paused);
82
83 enum class StreamState { 76 enum class StreamState {
84 Filling, 77 Filling,
85 Steady, 78 Steady,
@@ -106,8 +99,6 @@ private:
106 std::shared_ptr<Core::Timing::EventType> thread_event; 99 std::shared_ptr<Core::Timing::EventType> thread_event;
107 /// Atomic for main thread to wait on 100 /// Atomic for main thread to wait on
108 std::atomic<bool> update{}; 101 std::atomic<bool> update{};
109 /// Current state of the streams
110 StreamState state{StreamState::Filling};
111}; 102};
112 103
113} // namespace AudioCore::AudioRenderer 104} // namespace AudioCore::AudioRenderer
diff --git a/src/audio_core/renderer/upsampler/upsampler_manager.h b/src/audio_core/renderer/upsampler/upsampler_manager.h
index 70cd42b08..83c697c0c 100644
--- a/src/audio_core/renderer/upsampler/upsampler_manager.h
+++ b/src/audio_core/renderer/upsampler/upsampler_manager.h
@@ -27,7 +27,7 @@ public:
27 /** 27 /**
28 * Free the given upsampler. 28 * Free the given upsampler.
29 * 29 *
30 * @param The upsampler to be freed. 30 * @param info The upsampler to be freed.
31 */ 31 */
32 void Free(UpsamplerInfo* info); 32 void Free(UpsamplerInfo* info);
33 33
diff --git a/src/audio_core/renderer/voice/voice_info.h b/src/audio_core/renderer/voice/voice_info.h
index 896723e0c..930180895 100644
--- a/src/audio_core/renderer/voice/voice_info.h
+++ b/src/audio_core/renderer/voice/voice_info.h
@@ -185,7 +185,8 @@ public:
185 /** 185 /**
186 * Does this voice ned an update? 186 * Does this voice ned an update?
187 * 187 *
188 * @param params - Input parametetrs to check matching. 188 * @param params - Input parameters to check matching.
189 *
189 * @return True if this voice needs an update, otherwise false. 190 * @return True if this voice needs an update, otherwise false.
190 */ 191 */
191 bool ShouldUpdateParameters(const InParameter& params) const; 192 bool ShouldUpdateParameters(const InParameter& params) const;
@@ -194,9 +195,9 @@ public:
194 * Update the parameters of this voice. 195 * Update the parameters of this voice.
195 * 196 *
196 * @param error_info - Output error code. 197 * @param error_info - Output error code.
197 * @param params - Input parametters to udpate from. 198 * @param params - Input parameters to update from.
198 * @param pool_mapper - Used to map buffers. 199 * @param pool_mapper - Used to map buffers.
199 * @param behavior - behavior to check supported features. 200 * @param behavior - behavior to check supported features.
200 */ 201 */
201 void UpdateParameters(BehaviorInfo::ErrorInfo& error_info, const InParameter& params, 202 void UpdateParameters(BehaviorInfo::ErrorInfo& error_info, const InParameter& params,
202 const PoolMapper& pool_mapper, const BehaviorInfo& behavior); 203 const PoolMapper& pool_mapper, const BehaviorInfo& behavior);
@@ -218,12 +219,12 @@ public:
218 /** 219 /**
219 * Update all wavebuffers. 220 * Update all wavebuffers.
220 * 221 *
221 * @param error_infos - Output 2D array of errors, 2 per wavebuffer. 222 * @param error_infos - Output 2D array of errors, 2 per wavebuffer.
222 * @param error_count - Number of errors provided. Unused. 223 * @param error_count - Number of errors provided. Unused.
223 * @param params - Input parametters to be used for the update. 224 * @param params - Input parameters to be used for the update.
224 * @param voice_states - The voice states for each channel in this voice to be updated. 225 * @param voice_states - The voice states for each channel in this voice to be updated.
225 * @param pool_mapper - Used to map the wavebuffers. 226 * @param pool_mapper - Used to map the wavebuffers.
226 * @param behavior - Used to check for supported features. 227 * @param behavior - Used to check for supported features.
227 */ 228 */
228 void UpdateWaveBuffers(std::span<std::array<BehaviorInfo::ErrorInfo, 2>> error_infos, 229 void UpdateWaveBuffers(std::span<std::array<BehaviorInfo::ErrorInfo, 2>> error_infos,
229 u32 error_count, const InParameter& params, 230 u32 error_count, const InParameter& params,
@@ -233,13 +234,13 @@ public:
233 /** 234 /**
234 * Update a wavebuffer. 235 * Update a wavebuffer.
235 * 236 *
236 * @param error_infos - Output array of errors. 237 * @param error_info - Output array of errors.
237 * @param wave_buffer - The wavebuffer to be updated. 238 * @param wave_buffer - The wavebuffer to be updated.
238 * @param wave_buffer_internal - Input parametters to be used for the update. 239 * @param wave_buffer_internal - Input parametters to be used for the update.
239 * @param sample_format - Sample format of the wavebuffer. 240 * @param sample_format - Sample format of the wavebuffer.
240 * @param valid - Is this wavebuffer valid? 241 * @param valid - Is this wavebuffer valid?
241 * @param pool_mapper - Used to map the wavebuffers. 242 * @param pool_mapper - Used to map the wavebuffers.
242 * @param behavior - Used to check for supported features. 243 * @param behavior - Used to check for supported features.
243 */ 244 */
244 void UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info, WaveBuffer& wave_buffer, 245 void UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info, WaveBuffer& wave_buffer,
245 const WaveBufferInternal& wave_buffer_internal, 246 const WaveBufferInternal& wave_buffer_internal,
@@ -276,7 +277,7 @@ public:
276 /** 277 /**
277 * Check if this voice has any mixing connections. 278 * Check if this voice has any mixing connections.
278 * 279 *
279 * @return True if this voice participes in mixing, otherwise false. 280 * @return True if this voice participates in mixing, otherwise false.
280 */ 281 */
281 bool HasAnyConnection() const; 282 bool HasAnyConnection() const;
282 283
@@ -301,7 +302,8 @@ public:
301 /** 302 /**
302 * Update this voice on command generation. 303 * Update this voice on command generation.
303 * 304 *
304 * @param voice_states - Voice states for these wavebuffers. 305 * @param voice_context - Voice context for these wavebuffers.
306 *
305 * @return True if this voice should be generated, otherwise false. 307 * @return True if this voice should be generated, otherwise false.
306 */ 308 */
307 bool UpdateForCommandGeneration(VoiceContext& voice_context); 309 bool UpdateForCommandGeneration(VoiceContext& voice_context);
diff --git a/src/audio_core/sink/cubeb_sink.cpp b/src/audio_core/sink/cubeb_sink.cpp
index 9ae043611..36b115ad6 100644
--- a/src/audio_core/sink/cubeb_sink.cpp
+++ b/src/audio_core/sink/cubeb_sink.cpp
@@ -129,20 +129,13 @@ public:
129 * Default false. 129 * Default false.
130 */ 130 */
131 void Start(bool resume = false) override { 131 void Start(bool resume = false) override {
132 if (!ctx) { 132 if (!ctx || !paused) {
133 return; 133 return;
134 } 134 }
135 135
136 if (resume && was_playing) { 136 paused = false;
137 if (cubeb_stream_start(stream_backend) != CUBEB_OK) { 137 if (cubeb_stream_start(stream_backend) != CUBEB_OK) {
138 LOG_CRITICAL(Audio_Sink, "Error starting cubeb stream"); 138 LOG_CRITICAL(Audio_Sink, "Error starting cubeb stream");
139 }
140 paused = false;
141 } else if (!resume) {
142 if (cubeb_stream_start(stream_backend) != CUBEB_OK) {
143 LOG_CRITICAL(Audio_Sink, "Error starting cubeb stream");
144 }
145 paused = false;
146 } 139 }
147 } 140 }
148 141
@@ -151,16 +144,15 @@ public:
151 */ 144 */
152 void Stop() override { 145 void Stop() override {
153 Unstall(); 146 Unstall();
154 if (!ctx) { 147
148 if (!ctx || paused) {
155 return; 149 return;
156 } 150 }
157 151
152 paused = true;
158 if (cubeb_stream_stop(stream_backend) != CUBEB_OK) { 153 if (cubeb_stream_stop(stream_backend) != CUBEB_OK) {
159 LOG_CRITICAL(Audio_Sink, "Error stopping cubeb stream"); 154 LOG_CRITICAL(Audio_Sink, "Error stopping cubeb stream");
160 } 155 }
161
162 was_playing.store(!paused);
163 paused = true;
164 } 156 }
165 157
166private: 158private:
@@ -286,18 +278,6 @@ void CubebSink::CloseStreams() {
286 sink_streams.clear(); 278 sink_streams.clear();
287} 279}
288 280
289void CubebSink::PauseStreams() {
290 for (auto& stream : sink_streams) {
291 stream->Stop();
292 }
293}
294
295void CubebSink::UnpauseStreams() {
296 for (auto& stream : sink_streams) {
297 stream->Start(true);
298 }
299}
300
301f32 CubebSink::GetDeviceVolume() const { 281f32 CubebSink::GetDeviceVolume() const {
302 if (sink_streams.empty()) { 282 if (sink_streams.empty()) {
303 return 1.0f; 283 return 1.0f;
diff --git a/src/audio_core/sink/cubeb_sink.h b/src/audio_core/sink/cubeb_sink.h
index 91a6480fa..4b0cb160d 100644
--- a/src/audio_core/sink/cubeb_sink.h
+++ b/src/audio_core/sink/cubeb_sink.h
@@ -34,8 +34,7 @@ public:
34 * May differ from the device's channel count. 34 * May differ from the device's channel count.
35 * @param name - Name of this stream. 35 * @param name - Name of this stream.
36 * @param type - Type of this stream, render/in/out. 36 * @param type - Type of this stream, render/in/out.
37 * @param event - Audio render only, a signal used to prevent the renderer running too 37 *
38 * fast.
39 * @return A pointer to the created SinkStream 38 * @return A pointer to the created SinkStream
40 */ 39 */
41 SinkStream* AcquireSinkStream(Core::System& system, u32 system_channels, 40 SinkStream* AcquireSinkStream(Core::System& system, u32 system_channels,
@@ -54,16 +53,6 @@ public:
54 void CloseStreams() override; 53 void CloseStreams() override;
55 54
56 /** 55 /**
57 * Pause all streams.
58 */
59 void PauseStreams() override;
60
61 /**
62 * Unpause all streams.
63 */
64 void UnpauseStreams() override;
65
66 /**
67 * Get the device volume. Set from calls to the IAudioDevice service. 56 * Get the device volume. Set from calls to the IAudioDevice service.
68 * 57 *
69 * @return Volume of the device. 58 * @return Volume of the device.
@@ -101,7 +90,7 @@ private:
101}; 90};
102 91
103/** 92/**
104 * Get a list of conencted devices from Cubeb. 93 * Get a list of connected devices from Cubeb.
105 * 94 *
106 * @param capture - Return input (capture) devices if true, otherwise output devices. 95 * @param capture - Return input (capture) devices if true, otherwise output devices.
107 */ 96 */
diff --git a/src/audio_core/sink/null_sink.h b/src/audio_core/sink/null_sink.h
index eab9c3a0c..1215d3cd2 100644
--- a/src/audio_core/sink/null_sink.h
+++ b/src/audio_core/sink/null_sink.h
@@ -44,8 +44,6 @@ public:
44 44
45 void CloseStream(SinkStream*) override {} 45 void CloseStream(SinkStream*) override {}
46 void CloseStreams() override {} 46 void CloseStreams() override {}
47 void PauseStreams() override {}
48 void UnpauseStreams() override {}
49 f32 GetDeviceVolume() const override { 47 f32 GetDeviceVolume() const override {
50 return 1.0f; 48 return 1.0f;
51 } 49 }
diff --git a/src/audio_core/sink/sdl2_sink.cpp b/src/audio_core/sink/sdl2_sink.cpp
index 7ee1dd7cd..1bd001b94 100644
--- a/src/audio_core/sink/sdl2_sink.cpp
+++ b/src/audio_core/sink/sdl2_sink.cpp
@@ -108,17 +108,12 @@ public:
108 * Default false. 108 * Default false.
109 */ 109 */
110 void Start(bool resume = false) override { 110 void Start(bool resume = false) override {
111 if (device == 0) { 111 if (device == 0 || !paused) {
112 return; 112 return;
113 } 113 }
114 114
115 if (resume && was_playing) { 115 paused = false;
116 SDL_PauseAudioDevice(device, 0); 116 SDL_PauseAudioDevice(device, 0);
117 paused = false;
118 } else if (!resume) {
119 SDL_PauseAudioDevice(device, 0);
120 paused = false;
121 }
122 } 117 }
123 118
124 /** 119 /**
@@ -126,11 +121,11 @@ public:
126 */ 121 */
127 void Stop() override { 122 void Stop() override {
128 Unstall(); 123 Unstall();
129 if (device == 0) { 124 if (device == 0 || paused) {
130 return; 125 return;
131 } 126 }
132 SDL_PauseAudioDevice(device, 1);
133 paused = true; 127 paused = true;
128 SDL_PauseAudioDevice(device, 1);
134 } 129 }
135 130
136private: 131private:
@@ -207,18 +202,6 @@ void SDLSink::CloseStreams() {
207 sink_streams.clear(); 202 sink_streams.clear();
208} 203}
209 204
210void SDLSink::PauseStreams() {
211 for (auto& stream : sink_streams) {
212 stream->Stop();
213 }
214}
215
216void SDLSink::UnpauseStreams() {
217 for (auto& stream : sink_streams) {
218 stream->Start();
219 }
220}
221
222f32 SDLSink::GetDeviceVolume() const { 205f32 SDLSink::GetDeviceVolume() const {
223 if (sink_streams.empty()) { 206 if (sink_streams.empty()) {
224 return 1.0f; 207 return 1.0f;
diff --git a/src/audio_core/sink/sdl2_sink.h b/src/audio_core/sink/sdl2_sink.h
index 57de9b6c2..f01eddc1b 100644
--- a/src/audio_core/sink/sdl2_sink.h
+++ b/src/audio_core/sink/sdl2_sink.h
@@ -32,8 +32,7 @@ public:
32 * May differ from the device's channel count. 32 * May differ from the device's channel count.
33 * @param name - Name of this stream. 33 * @param name - Name of this stream.
34 * @param type - Type of this stream, render/in/out. 34 * @param type - Type of this stream, render/in/out.
35 * @param event - Audio render only, a signal used to prevent the renderer running too 35 *
36 * fast.
37 * @return A pointer to the created SinkStream 36 * @return A pointer to the created SinkStream
38 */ 37 */
39 SinkStream* AcquireSinkStream(Core::System& system, u32 system_channels, 38 SinkStream* AcquireSinkStream(Core::System& system, u32 system_channels,
@@ -52,16 +51,6 @@ public:
52 void CloseStreams() override; 51 void CloseStreams() override;
53 52
54 /** 53 /**
55 * Pause all streams.
56 */
57 void PauseStreams() override;
58
59 /**
60 * Unpause all streams.
61 */
62 void UnpauseStreams() override;
63
64 /**
65 * Get the device volume. Set from calls to the IAudioDevice service. 54 * Get the device volume. Set from calls to the IAudioDevice service.
66 * 55 *
67 * @return Volume of the device. 56 * @return Volume of the device.
@@ -92,7 +81,7 @@ private:
92}; 81};
93 82
94/** 83/**
95 * Get a list of conencted devices from Cubeb. 84 * Get a list of connected devices from SDL.
96 * 85 *
97 * @param capture - Return input (capture) devices if true, otherwise output devices. 86 * @param capture - Return input (capture) devices if true, otherwise output devices.
98 */ 87 */
diff --git a/src/audio_core/sink/sink.h b/src/audio_core/sink/sink.h
index 43d99b62e..f28c6d126 100644
--- a/src/audio_core/sink/sink.h
+++ b/src/audio_core/sink/sink.h
@@ -40,16 +40,6 @@ public:
40 virtual void CloseStreams() = 0; 40 virtual void CloseStreams() = 0;
41 41
42 /** 42 /**
43 * Pause all streams.
44 */
45 virtual void PauseStreams() = 0;
46
47 /**
48 * Unpause all streams.
49 */
50 virtual void UnpauseStreams() = 0;
51
52 /**
53 * Create a new sink stream, kept within this sink, with a pointer returned for use. 43 * Create a new sink stream, kept within this sink, with a pointer returned for use.
54 * Do not free the returned pointer. When done with the stream, call CloseStream on the sink. 44 * Do not free the returned pointer. When done with the stream, call CloseStream on the sink.
55 * 45 *
@@ -58,8 +48,7 @@ public:
58 * May differ from the device's channel count. 48 * May differ from the device's channel count.
59 * @param name - Name of this stream. 49 * @param name - Name of this stream.
60 * @param type - Type of this stream, render/in/out. 50 * @param type - Type of this stream, render/in/out.
61 * @param event - Audio render only, a signal used to prevent the renderer running too 51 *
62 * fast.
63 * @return A pointer to the created SinkStream 52 * @return A pointer to the created SinkStream
64 */ 53 */
65 virtual SinkStream* AcquireSinkStream(Core::System& system, u32 system_channels, 54 virtual SinkStream* AcquireSinkStream(Core::System& system, u32 system_channels,
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp
index 68987eba6..37fe725e4 100644
--- a/src/audio_core/sink/sink_stream.cpp
+++ b/src/audio_core/sink/sink_stream.cpp
@@ -143,6 +143,12 @@ void SinkStream::ProcessAudioIn(std::span<const s16> input_buffer, std::size_t n
143 const std::size_t frame_size_bytes = frame_size * sizeof(s16); 143 const std::size_t frame_size_bytes = frame_size * sizeof(s16);
144 size_t frames_written{0}; 144 size_t frames_written{0};
145 145
146 // If we're paused or going to shut down, we don't want to consume buffers as coretiming is
147 // paused and we'll desync, so just return.
148 if (system.IsPaused() || system.IsShuttingDown()) {
149 return;
150 }
151
146 if (queued_buffers > max_queue_size) { 152 if (queued_buffers > max_queue_size) {
147 Stall(); 153 Stall();
148 } 154 }
@@ -193,6 +199,16 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
193 const std::size_t frame_size_bytes = frame_size * sizeof(s16); 199 const std::size_t frame_size_bytes = frame_size * sizeof(s16);
194 size_t frames_written{0}; 200 size_t frames_written{0};
195 201
202 // If we're paused or going to shut down, we don't want to consume buffers as coretiming is
203 // paused and we'll desync, so just play silence.
204 if (system.IsPaused() || system.IsShuttingDown()) {
205 constexpr std::array<s16, 6> silence{};
206 for (size_t i = frames_written; i < num_frames; i++) {
207 std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes);
208 }
209 return;
210 }
211
196 // Due to many frames being queued up with nvdec (5 frames or so?), a lot of buffers also get 212 // Due to many frames being queued up with nvdec (5 frames or so?), a lot of buffers also get
197 // queued up (30+) but not all at once, which causes constant stalling here, so just let the 213 // queued up (30+) but not all at once, which causes constant stalling here, so just let the
198 // video play out without attempting to stall. 214 // video play out without attempting to stall.
diff --git a/src/audio_core/sink/sink_stream.h b/src/audio_core/sink/sink_stream.h
index db7cff45e..9366ebbd3 100644
--- a/src/audio_core/sink/sink_stream.h
+++ b/src/audio_core/sink/sink_stream.h
@@ -214,14 +214,12 @@ protected:
214 Core::System& system; 214 Core::System& system;
215 /// Type of this stream 215 /// Type of this stream
216 StreamType type; 216 StreamType type;
217 /// Set by the audio render/in/out systen which uses this stream 217 /// Set by the audio render/in/out system which uses this stream
218 u32 system_channels{2}; 218 u32 system_channels{2};
219 /// Channels supported by hardware 219 /// Channels supported by hardware
220 u32 device_channels{2}; 220 u32 device_channels{2};
221 /// Is this stream currently paused? 221 /// Is this stream currently paused?
222 std::atomic<bool> paused{true}; 222 std::atomic<bool> paused{true};
223 /// Was this stream previously playing?
224 std::atomic<bool> was_playing{false};
225 /// Name of this stream 223 /// Name of this stream
226 std::string name{}; 224 std::string name{};
227 225
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 635fb85c8..b1e0ba6cc 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -166,6 +166,7 @@ if(ARCHITECTURE_x86_64)
166 x64/xbyak_abi.h 166 x64/xbyak_abi.h
167 x64/xbyak_util.h 167 x64/xbyak_util.h
168 ) 168 )
169 target_link_libraries(common PRIVATE xbyak)
169endif() 170endif()
170 171
171if (MSVC) 172if (MSVC)
@@ -189,7 +190,7 @@ endif()
189create_target_directory_groups(common) 190create_target_directory_groups(common)
190 191
191target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads) 192target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads)
192target_link_libraries(common PRIVATE lz4::lz4 xbyak) 193target_link_libraries(common PRIVATE lz4::lz4)
193if (TARGET zstd::zstd) 194if (TARGET zstd::zstd)
194 target_link_libraries(common PRIVATE zstd::zstd) 195 target_link_libraries(common PRIVATE zstd::zstd)
195else() 196else()
diff --git a/src/core/core.cpp b/src/core/core.cpp
index e651ce100..121092868 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -141,8 +141,6 @@ struct System::Impl {
141 core_timing.SyncPause(false); 141 core_timing.SyncPause(false);
142 is_paused = false; 142 is_paused = false;
143 143
144 audio_core->PauseSinks(false);
145
146 return status; 144 return status;
147 } 145 }
148 146
@@ -150,8 +148,6 @@ struct System::Impl {
150 std::unique_lock<std::mutex> lk(suspend_guard); 148 std::unique_lock<std::mutex> lk(suspend_guard);
151 status = SystemResultStatus::Success; 149 status = SystemResultStatus::Success;
152 150
153 audio_core->PauseSinks(true);
154
155 core_timing.SyncPause(true); 151 core_timing.SyncPause(true);
156 kernel.Suspend(true); 152 kernel.Suspend(true);
157 is_paused = true; 153 is_paused = true;
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 2dbb99c8b..5375a5d59 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -73,7 +73,6 @@ void CoreTiming::Shutdown() {
73 if (timer_thread) { 73 if (timer_thread) {
74 timer_thread->join(); 74 timer_thread->join();
75 } 75 }
76 pause_callbacks.clear();
77 ClearPendingEvents(); 76 ClearPendingEvents();
78 timer_thread.reset(); 77 timer_thread.reset();
79 has_started = false; 78 has_started = false;
@@ -86,10 +85,6 @@ void CoreTiming::Pause(bool is_paused) {
86 if (!is_paused) { 85 if (!is_paused) {
87 pause_end_time = GetGlobalTimeNs().count(); 86 pause_end_time = GetGlobalTimeNs().count();
88 } 87 }
89
90 for (auto& cb : pause_callbacks) {
91 cb(is_paused);
92 }
93} 88}
94 89
95void CoreTiming::SyncPause(bool is_paused) { 90void CoreTiming::SyncPause(bool is_paused) {
@@ -110,10 +105,6 @@ void CoreTiming::SyncPause(bool is_paused) {
110 if (!is_paused) { 105 if (!is_paused) {
111 pause_end_time = GetGlobalTimeNs().count(); 106 pause_end_time = GetGlobalTimeNs().count();
112 } 107 }
113
114 for (auto& cb : pause_callbacks) {
115 cb(is_paused);
116 }
117} 108}
118 109
119bool CoreTiming::IsRunning() const { 110bool CoreTiming::IsRunning() const {
@@ -219,11 +210,6 @@ void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) {
219 } 210 }
220} 211}
221 212
222void CoreTiming::RegisterPauseCallback(PauseCallback&& callback) {
223 std::scoped_lock lock{basic_lock};
224 pause_callbacks.emplace_back(std::move(callback));
225}
226
227std::optional<s64> CoreTiming::Advance() { 213std::optional<s64> CoreTiming::Advance() {
228 std::scoped_lock lock{advance_lock, basic_lock}; 214 std::scoped_lock lock{advance_lock, basic_lock};
229 global_timer = GetGlobalTimeNs().count(); 215 global_timer = GetGlobalTimeNs().count();
diff --git a/src/core/core_timing.h b/src/core/core_timing.h
index 6aa3ae923..3259397b2 100644
--- a/src/core/core_timing.h
+++ b/src/core/core_timing.h
@@ -22,7 +22,6 @@ namespace Core::Timing {
22/// A callback that may be scheduled for a particular core timing event. 22/// A callback that may be scheduled for a particular core timing event.
23using TimedCallback = std::function<std::optional<std::chrono::nanoseconds>( 23using TimedCallback = std::function<std::optional<std::chrono::nanoseconds>(
24 std::uintptr_t user_data, s64 time, std::chrono::nanoseconds ns_late)>; 24 std::uintptr_t user_data, s64 time, std::chrono::nanoseconds ns_late)>;
25using PauseCallback = std::function<void(bool paused)>;
26 25
27/// Contains the characteristics of a particular event. 26/// Contains the characteristics of a particular event.
28struct EventType { 27struct EventType {
@@ -134,9 +133,6 @@ public:
134 /// Checks for events manually and returns time in nanoseconds for next event, threadsafe. 133 /// Checks for events manually and returns time in nanoseconds for next event, threadsafe.
135 std::optional<s64> Advance(); 134 std::optional<s64> Advance();
136 135
137 /// Register a callback function to be called when coretiming pauses.
138 void RegisterPauseCallback(PauseCallback&& callback);
139
140private: 136private:
141 struct Event; 137 struct Event;
142 138
@@ -176,8 +172,6 @@ private:
176 /// Cycle timing 172 /// Cycle timing
177 u64 ticks{}; 173 u64 ticks{};
178 s64 downcount{}; 174 s64 downcount{};
179
180 std::vector<PauseCallback> pause_callbacks{};
181}; 175};
182 176
183/// Creates a core timing event with the given name and callback. 177/// Creates a core timing event with the given name and callback.
diff --git a/src/yuzu/configuration/configure_tas.ui b/src/yuzu/configuration/configure_tas.ui
index cf88a5bf0..625af0c89 100644
--- a/src/yuzu/configuration/configure_tas.ui
+++ b/src/yuzu/configuration/configure_tas.ui
@@ -16,6 +16,9 @@
16 <property name="text"> 16 <property name="text">
17 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Reads controller input from scripts in the same format as TAS-nx scripts.&lt;br/&gt;For a more detailed explanation, please consult the &lt;a href=&quot;https://yuzu-emu.org/help/feature/tas/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;help page&lt;/span&gt;&lt;/a&gt; on the yuzu website.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> 17 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Reads controller input from scripts in the same format as TAS-nx scripts.&lt;br/&gt;For a more detailed explanation, please consult the &lt;a href=&quot;https://yuzu-emu.org/help/feature/tas/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;help page&lt;/span&gt;&lt;/a&gt; on the yuzu website.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
18 </property> 18 </property>
19 <property name="openExternalLinks">
20 <bool>true</bool>
21 </property>
19 </widget> 22 </widget>
20 </item> 23 </item>
21 <item row="1" column="0" colspan="4"> 24 <item row="1" column="0" colspan="4">