summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/audio_render_manager.cpp6
-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.cpp16
-rw-r--r--src/audio_core/device/device_session.h6
-rw-r--r--src/audio_core/in/audio_in.cpp8
-rw-r--r--src/audio_core/in/audio_in.h8
-rw-r--r--src/audio_core/in/audio_in_system.cpp24
-rw-r--r--src/audio_core/in/audio_in_system.h10
-rw-r--r--src/audio_core/out/audio_out.cpp8
-rw-r--r--src/audio_core/out/audio_out.h8
-rw-r--r--src/audio_core/out/audio_out_system.cpp23
-rw-r--r--src/audio_core/out/audio_out_system.h8
-rw-r--r--src/audio_core/renderer/adsp/adsp.cpp2
-rw-r--r--src/audio_core/renderer/adsp/adsp.h2
-rw-r--r--src/audio_core/renderer/adsp/audio_renderer.cpp2
-rw-r--r--src/audio_core/renderer/adsp/audio_renderer.h2
-rw-r--r--src/audio_core/renderer/behavior/behavior_info.cpp4
-rw-r--r--src/audio_core/renderer/behavior/behavior_info.h4
-rw-r--r--src/audio_core/renderer/behavior/info_updater.cpp2
-rw-r--r--src/audio_core/renderer/behavior/info_updater.h2
-rw-r--r--src/audio_core/renderer/effect/i3dl2.h4
-rw-r--r--src/audio_core/renderer/effect/reverb.h4
-rw-r--r--src/audio_core/renderer/nodes/node_states.h4
-rw-r--r--src/audio_core/sink/sink_stream.h2
25 files changed, 87 insertions, 82 deletions
diff --git a/src/audio_core/audio_render_manager.cpp b/src/audio_core/audio_render_manager.cpp
index 7a846835b..7aba2b423 100644
--- a/src/audio_core/audio_render_manager.cpp
+++ b/src/audio_core/audio_render_manager.cpp
@@ -25,8 +25,8 @@ SystemManager& Manager::GetSystemManager() {
25 return *system_manager; 25 return *system_manager;
26} 26}
27 27
28auto Manager::GetWorkBufferSize(const AudioRendererParameterInternal& params, u64& out_count) 28Result Manager::GetWorkBufferSize(const AudioRendererParameterInternal& params,
29 -> Result { 29 u64& out_count) const {
30 if (!CheckValidRevision(params.revision)) { 30 if (!CheckValidRevision(params.revision)) {
31 return Service::Audio::ERR_INVALID_REVISION; 31 return Service::Audio::ERR_INVALID_REVISION;
32 } 32 }
@@ -54,7 +54,7 @@ void Manager::ReleaseSessionId(const s32 session_id) {
54 session_ids[--session_count] = session_id; 54 session_ids[--session_count] = session_id;
55} 55}
56 56
57u32 Manager::GetSessionCount() { 57u32 Manager::GetSessionCount() const {
58 std::scoped_lock l{session_lock}; 58 std::scoped_lock l{session_lock};
59 return session_count; 59 return session_count;
60} 60}
diff --git a/src/audio_core/audio_render_manager.h b/src/audio_core/audio_render_manager.h
index 7119e1b99..bf4837190 100644
--- a/src/audio_core/audio_render_manager.h
+++ b/src/audio_core/audio_render_manager.h
@@ -46,7 +46,7 @@ public:
46 * @param out_count - Output size of the required workbuffer. 46 * @param out_count - Output size of the required workbuffer.
47 * @return Result code. 47 * @return Result code.
48 */ 48 */
49 Result GetWorkBufferSize(const AudioRendererParameterInternal& params, u64& out_count); 49 Result GetWorkBufferSize(const AudioRendererParameterInternal& params, u64& out_count) const;
50 50
51 /** 51 /**
52 * Get a new session id. 52 * Get a new session id.
@@ -60,7 +60,7 @@ public:
60 * 60 *
61 * @return The number of active sessions. 61 * @return The number of active sessions.
62 */ 62 */
63 u32 GetSessionCount(); 63 u32 GetSessionCount() const;
64 64
65 /** 65 /**
66 * Add a renderer system to the manager. 66 * Add a renderer system to the manager.
@@ -94,7 +94,7 @@ private:
94 /// Number of active renderers 94 /// Number of active renderers
95 u32 session_count{}; 95 u32 session_count{};
96 /// Lock for interacting with the sessions 96 /// Lock for interacting with the sessions
97 std::mutex session_lock{}; 97 mutable std::mutex session_lock{};
98 /// Regularly generates commands from the registered systems for the AudioRenderer 98 /// Regularly generates commands from the registered systems for the AudioRenderer
99 std::unique_ptr<SystemManager> system_manager{}; 99 std::unique_ptr<SystemManager> system_manager{};
100}; 100};
diff --git a/src/audio_core/device/audio_buffers.h b/src/audio_core/device/audio_buffers.h
index 3ecbbb63f..3dae1a3b7 100644
--- a/src/audio_core/device/audio_buffers.h
+++ b/src/audio_core/device/audio_buffers.h
@@ -36,7 +36,7 @@ public:
36 * 36 *
37 * @param buffer - The new buffer. 37 * @param buffer - The new buffer.
38 */ 38 */
39 void AppendBuffer(AudioBuffer& buffer) { 39 void AppendBuffer(const AudioBuffer& buffer) {
40 std::scoped_lock l{lock}; 40 std::scoped_lock l{lock};
41 buffers[appended_index] = buffer; 41 buffers[appended_index] = buffer;
42 appended_count++; 42 appended_count++;
@@ -93,7 +93,7 @@ public:
93 * 93 *
94 * @return Is the buffer was released. 94 * @return Is the buffer was released.
95 */ 95 */
96 bool ReleaseBuffers(Core::Timing::CoreTiming& core_timing, DeviceSession& session) { 96 bool ReleaseBuffers(const Core::Timing::CoreTiming& core_timing, const DeviceSession& session) {
97 std::scoped_lock l{lock}; 97 std::scoped_lock l{lock};
98 bool buffer_released{false}; 98 bool buffer_released{false};
99 while (registered_count > 0) { 99 while (registered_count > 0) {
diff --git a/src/audio_core/device/device_session.cpp b/src/audio_core/device/device_session.cpp
index c71c3a376..995060414 100644
--- a/src/audio_core/device/device_session.cpp
+++ b/src/audio_core/device/device_session.cpp
@@ -73,12 +73,12 @@ void DeviceSession::Stop() {
73 } 73 }
74} 74}
75 75
76void DeviceSession::AppendBuffers(std::span<AudioBuffer> buffers) const { 76void DeviceSession::AppendBuffers(std::span<const AudioBuffer> buffers) const {
77 for (size_t i = 0; i < buffers.size(); i++) { 77 for (const auto& buffer : buffers) {
78 Sink::SinkBuffer new_buffer{ 78 Sink::SinkBuffer new_buffer{
79 .frames = buffers[i].size / (channel_count * sizeof(s16)), 79 .frames = buffer.size / (channel_count * sizeof(s16)),
80 .frames_played = 0, 80 .frames_played = 0,
81 .tag = buffers[i].tag, 81 .tag = buffer.tag,
82 .consumed = false, 82 .consumed = false,
83 }; 83 };
84 84
@@ -86,21 +86,21 @@ void DeviceSession::AppendBuffers(std::span<AudioBuffer> buffers) const {
86 std::vector<s16> samples{}; 86 std::vector<s16> samples{};
87 stream->AppendBuffer(new_buffer, samples); 87 stream->AppendBuffer(new_buffer, samples);
88 } else { 88 } else {
89 std::vector<s16> samples(buffers[i].size / sizeof(s16)); 89 std::vector<s16> samples(buffer.size / sizeof(s16));
90 system.Memory().ReadBlockUnsafe(buffers[i].samples, samples.data(), buffers[i].size); 90 system.Memory().ReadBlockUnsafe(buffer.samples, samples.data(), buffer.size);
91 stream->AppendBuffer(new_buffer, samples); 91 stream->AppendBuffer(new_buffer, samples);
92 } 92 }
93 } 93 }
94} 94}
95 95
96void DeviceSession::ReleaseBuffer(AudioBuffer& buffer) const { 96void DeviceSession::ReleaseBuffer(const AudioBuffer& buffer) const {
97 if (type == Sink::StreamType::In) { 97 if (type == Sink::StreamType::In) {
98 auto samples{stream->ReleaseBuffer(buffer.size / sizeof(s16))}; 98 auto samples{stream->ReleaseBuffer(buffer.size / sizeof(s16))};
99 system.Memory().WriteBlockUnsafe(buffer.samples, samples.data(), buffer.size); 99 system.Memory().WriteBlockUnsafe(buffer.samples, samples.data(), buffer.size);
100 } 100 }
101} 101}
102 102
103bool DeviceSession::IsBufferConsumed(AudioBuffer& buffer) const { 103bool DeviceSession::IsBufferConsumed(const AudioBuffer& buffer) const {
104 return played_sample_count >= buffer.end_timestamp; 104 return played_sample_count >= buffer.end_timestamp;
105} 105}
106 106
diff --git a/src/audio_core/device/device_session.h b/src/audio_core/device/device_session.h
index 53b649c61..74f4dc085 100644
--- a/src/audio_core/device/device_session.h
+++ b/src/audio_core/device/device_session.h
@@ -62,14 +62,14 @@ public:
62 * 62 *
63 * @param buffers - The buffers to play. 63 * @param buffers - The buffers to play.
64 */ 64 */
65 void AppendBuffers(std::span<AudioBuffer> buffers) const; 65 void AppendBuffers(std::span<const AudioBuffer> buffers) const;
66 66
67 /** 67 /**
68 * (Audio In only) Pop samples from the backend, and write them back to this buffer's address. 68 * (Audio In only) Pop samples from the backend, and write them back to this buffer's address.
69 * 69 *
70 * @param buffer - The buffer to write to. 70 * @param buffer - The buffer to write to.
71 */ 71 */
72 void ReleaseBuffer(AudioBuffer& buffer) const; 72 void ReleaseBuffer(const AudioBuffer& buffer) const;
73 73
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.
@@ -78,7 +78,7 @@ public:
78 * 78 *
79 * @return true if the buffer has been consumed, otherwise false. 79 * @return true if the buffer has been consumed, otherwise false.
80 */ 80 */
81 bool IsBufferConsumed(AudioBuffer& buffer) const; 81 bool IsBufferConsumed(const AudioBuffer& buffer) const;
82 82
83 /** 83 /**
84 * Start this device session, starting the backend stream. 84 * Start this device session, starting the backend stream.
diff --git a/src/audio_core/in/audio_in.cpp b/src/audio_core/in/audio_in.cpp
index c946895d6..91ccd5ad7 100644
--- a/src/audio_core/in/audio_in.cpp
+++ b/src/audio_core/in/audio_in.cpp
@@ -72,7 +72,7 @@ Kernel::KReadableEvent& In::GetBufferEvent() {
72 return event->GetReadableEvent(); 72 return event->GetReadableEvent();
73} 73}
74 74
75f32 In::GetVolume() { 75f32 In::GetVolume() const {
76 std::scoped_lock l{parent_mutex}; 76 std::scoped_lock l{parent_mutex};
77 return system.GetVolume(); 77 return system.GetVolume();
78} 78}
@@ -82,17 +82,17 @@ void In::SetVolume(f32 volume) {
82 system.SetVolume(volume); 82 system.SetVolume(volume);
83} 83}
84 84
85bool In::ContainsAudioBuffer(u64 tag) { 85bool In::ContainsAudioBuffer(u64 tag) const {
86 std::scoped_lock l{parent_mutex}; 86 std::scoped_lock l{parent_mutex};
87 return system.ContainsAudioBuffer(tag); 87 return system.ContainsAudioBuffer(tag);
88} 88}
89 89
90u32 In::GetBufferCount() { 90u32 In::GetBufferCount() const {
91 std::scoped_lock l{parent_mutex}; 91 std::scoped_lock l{parent_mutex};
92 return system.GetBufferCount(); 92 return system.GetBufferCount();
93} 93}
94 94
95u64 In::GetPlayedSampleCount() { 95u64 In::GetPlayedSampleCount() const {
96 std::scoped_lock l{parent_mutex}; 96 std::scoped_lock l{parent_mutex};
97 return system.GetPlayedSampleCount(); 97 return system.GetPlayedSampleCount();
98} 98}
diff --git a/src/audio_core/in/audio_in.h b/src/audio_core/in/audio_in.h
index 6253891d5..092ab7236 100644
--- a/src/audio_core/in/audio_in.h
+++ b/src/audio_core/in/audio_in.h
@@ -102,7 +102,7 @@ public:
102 * 102 *
103 * @return The current volume. 103 * @return The current volume.
104 */ 104 */
105 f32 GetVolume(); 105 f32 GetVolume() const;
106 106
107 /** 107 /**
108 * Set the system volume. 108 * Set the system volume.
@@ -117,21 +117,21 @@ public:
117 * @param tag - The tag to search for. 117 * @param tag - The tag to search for.
118 * @return True if the buffer is in the system, otherwise false. 118 * @return True if the buffer is in the system, otherwise false.
119 */ 119 */
120 bool ContainsAudioBuffer(u64 tag); 120 bool ContainsAudioBuffer(u64 tag) const;
121 121
122 /** 122 /**
123 * Get the maximum number of buffers. 123 * Get the maximum number of buffers.
124 * 124 *
125 * @return The maximum number of buffers. 125 * @return The maximum number of buffers.
126 */ 126 */
127 u32 GetBufferCount(); 127 u32 GetBufferCount() const;
128 128
129 /** 129 /**
130 * Get the total played sample count for this audio in. 130 * Get the total played sample count for this audio in.
131 * 131 *
132 * @return The played sample count. 132 * @return The played sample count.
133 */ 133 */
134 u64 GetPlayedSampleCount(); 134 u64 GetPlayedSampleCount() const;
135 135
136private: 136private:
137 /// The AudioIn::Manager this audio in is registered with 137 /// The AudioIn::Manager this audio in is registered with
diff --git a/src/audio_core/in/audio_in_system.cpp b/src/audio_core/in/audio_in_system.cpp
index 7e80ba03c..e7f918a47 100644
--- a/src/audio_core/in/audio_in_system.cpp
+++ b/src/audio_core/in/audio_in_system.cpp
@@ -34,16 +34,16 @@ size_t System::GetSessionId() const {
34 return session_id; 34 return session_id;
35} 35}
36 36
37std::string_view System::GetDefaultDeviceName() { 37std::string_view System::GetDefaultDeviceName() const {
38 return "BuiltInHeadset"; 38 return "BuiltInHeadset";
39} 39}
40 40
41std::string_view System::GetDefaultUacDeviceName() { 41std::string_view System::GetDefaultUacDeviceName() const {
42 return "Uac"; 42 return "Uac";
43} 43}
44 44
45Result System::IsConfigValid(const std::string_view device_name, 45Result System::IsConfigValid(const std::string_view device_name,
46 const AudioInParameter& in_params) { 46 const AudioInParameter& in_params) const {
47 if ((device_name.size() > 0) && 47 if ((device_name.size() > 0) &&
48 (device_name != GetDefaultDeviceName() && device_name != GetDefaultUacDeviceName())) { 48 (device_name != GetDefaultDeviceName() && device_name != GetDefaultUacDeviceName())) {
49 return Service::Audio::ERR_INVALID_DEVICE_NAME; 49 return Service::Audio::ERR_INVALID_DEVICE_NAME;
@@ -114,12 +114,14 @@ bool System::AppendBuffer(const AudioInBuffer& buffer, const u64 tag) {
114 } 114 }
115 115
116 const auto timestamp{buffers.GetNextTimestamp()}; 116 const auto timestamp{buffers.GetNextTimestamp()};
117 AudioBuffer new_buffer{.start_timestamp = timestamp, 117 const AudioBuffer new_buffer{
118 .end_timestamp = timestamp + buffer.size / (channel_count * sizeof(s16)), 118 .start_timestamp = timestamp,
119 .played_timestamp = 0, 119 .end_timestamp = timestamp + buffer.size / (channel_count * sizeof(s16)),
120 .samples = buffer.samples, 120 .played_timestamp = 0,
121 .tag = tag, 121 .samples = buffer.samples,
122 .size = buffer.size}; 122 .tag = tag,
123 .size = buffer.size,
124 };
123 125
124 buffers.AppendBuffer(new_buffer); 126 buffers.AppendBuffer(new_buffer);
125 RegisterBuffers(); 127 RegisterBuffers();
@@ -200,11 +202,11 @@ void System::SetVolume(const f32 volume_) {
200 session->SetVolume(volume_); 202 session->SetVolume(volume_);
201} 203}
202 204
203bool System::ContainsAudioBuffer(const u64 tag) { 205bool System::ContainsAudioBuffer(const u64 tag) const {
204 return buffers.ContainsBuffer(tag); 206 return buffers.ContainsBuffer(tag);
205} 207}
206 208
207u32 System::GetBufferCount() { 209u32 System::GetBufferCount() const {
208 return buffers.GetAppendedRegisteredCount(); 210 return buffers.GetAppendedRegisteredCount();
209} 211}
210 212
diff --git a/src/audio_core/in/audio_in_system.h b/src/audio_core/in/audio_in_system.h
index 9ddc8daae..b9dc0e60f 100644
--- a/src/audio_core/in/audio_in_system.h
+++ b/src/audio_core/in/audio_in_system.h
@@ -68,7 +68,7 @@ public:
68 * 68 *
69 * @return The default audio input device name. 69 * @return The default audio input device name.
70 */ 70 */
71 std::string_view GetDefaultDeviceName(); 71 std::string_view GetDefaultDeviceName() const;
72 72
73 /** 73 /**
74 * Get the default USB audio input device name. 74 * Get the default USB audio input device name.
@@ -77,7 +77,7 @@ public:
77 * 77 *
78 * @return The default USB audio input device name. 78 * @return The default USB audio input device name.
79 */ 79 */
80 std::string_view GetDefaultUacDeviceName(); 80 std::string_view GetDefaultUacDeviceName() const;
81 81
82 /** 82 /**
83 * Is the given initialize config valid? 83 * Is the given initialize config valid?
@@ -86,7 +86,7 @@ public:
86 * @param in_params - Input parameters, see AudioInParameter. 86 * @param in_params - Input parameters, see AudioInParameter.
87 * @return Result code. 87 * @return Result code.
88 */ 88 */
89 Result IsConfigValid(std::string_view device_name, const AudioInParameter& in_params); 89 Result IsConfigValid(std::string_view device_name, const AudioInParameter& in_params) const;
90 90
91 /** 91 /**
92 * Initialize this system. 92 * Initialize this system.
@@ -218,14 +218,14 @@ public:
218 * @param tag - Unique tag to search for. 218 * @param tag - Unique tag to search for.
219 * @return True if the buffer is in the system, otherwise false. 219 * @return True if the buffer is in the system, otherwise false.
220 */ 220 */
221 bool ContainsAudioBuffer(u64 tag); 221 bool ContainsAudioBuffer(u64 tag) const;
222 222
223 /** 223 /**
224 * Get the maximum number of usable buffers (default 32). 224 * Get the maximum number of usable buffers (default 32).
225 * 225 *
226 * @return The number of buffers. 226 * @return The number of buffers.
227 */ 227 */
228 u32 GetBufferCount(); 228 u32 GetBufferCount() const;
229 229
230 /** 230 /**
231 * Get the total number of samples played by this system. 231 * Get the total number of samples played by this system.
diff --git a/src/audio_core/out/audio_out.cpp b/src/audio_core/out/audio_out.cpp
index 9a8d8a742..d3ee4f0eb 100644
--- a/src/audio_core/out/audio_out.cpp
+++ b/src/audio_core/out/audio_out.cpp
@@ -72,7 +72,7 @@ Kernel::KReadableEvent& Out::GetBufferEvent() {
72 return event->GetReadableEvent(); 72 return event->GetReadableEvent();
73} 73}
74 74
75f32 Out::GetVolume() { 75f32 Out::GetVolume() const {
76 std::scoped_lock l{parent_mutex}; 76 std::scoped_lock l{parent_mutex};
77 return system.GetVolume(); 77 return system.GetVolume();
78} 78}
@@ -82,17 +82,17 @@ void Out::SetVolume(const f32 volume) {
82 system.SetVolume(volume); 82 system.SetVolume(volume);
83} 83}
84 84
85bool Out::ContainsAudioBuffer(const u64 tag) { 85bool Out::ContainsAudioBuffer(const u64 tag) const {
86 std::scoped_lock l{parent_mutex}; 86 std::scoped_lock l{parent_mutex};
87 return system.ContainsAudioBuffer(tag); 87 return system.ContainsAudioBuffer(tag);
88} 88}
89 89
90u32 Out::GetBufferCount() { 90u32 Out::GetBufferCount() const {
91 std::scoped_lock l{parent_mutex}; 91 std::scoped_lock l{parent_mutex};
92 return system.GetBufferCount(); 92 return system.GetBufferCount();
93} 93}
94 94
95u64 Out::GetPlayedSampleCount() { 95u64 Out::GetPlayedSampleCount() const {
96 std::scoped_lock l{parent_mutex}; 96 std::scoped_lock l{parent_mutex};
97 return system.GetPlayedSampleCount(); 97 return system.GetPlayedSampleCount();
98} 98}
diff --git a/src/audio_core/out/audio_out.h b/src/audio_core/out/audio_out.h
index f6b921645..946f345c6 100644
--- a/src/audio_core/out/audio_out.h
+++ b/src/audio_core/out/audio_out.h
@@ -102,7 +102,7 @@ public:
102 * 102 *
103 * @return The current volume. 103 * @return The current volume.
104 */ 104 */
105 f32 GetVolume(); 105 f32 GetVolume() const;
106 106
107 /** 107 /**
108 * Set the system volume. 108 * Set the system volume.
@@ -117,21 +117,21 @@ public:
117 * @param tag - The tag to search for. 117 * @param tag - The tag to search for.
118 * @return True if the buffer is in the system, otherwise false. 118 * @return True if the buffer is in the system, otherwise false.
119 */ 119 */
120 bool ContainsAudioBuffer(u64 tag); 120 bool ContainsAudioBuffer(u64 tag) const;
121 121
122 /** 122 /**
123 * Get the maximum number of buffers. 123 * Get the maximum number of buffers.
124 * 124 *
125 * @return The maximum number of buffers. 125 * @return The maximum number of buffers.
126 */ 126 */
127 u32 GetBufferCount(); 127 u32 GetBufferCount() const;
128 128
129 /** 129 /**
130 * Get the total played sample count for this audio out. 130 * Get the total played sample count for this audio out.
131 * 131 *
132 * @return The played sample count. 132 * @return The played sample count.
133 */ 133 */
134 u64 GetPlayedSampleCount(); 134 u64 GetPlayedSampleCount() const;
135 135
136private: 136private:
137 /// The AudioOut::Manager this audio out is registered with 137 /// The AudioOut::Manager this audio out is registered with
diff --git a/src/audio_core/out/audio_out_system.cpp b/src/audio_core/out/audio_out_system.cpp
index 8941b09a0..8b907590a 100644
--- a/src/audio_core/out/audio_out_system.cpp
+++ b/src/audio_core/out/audio_out_system.cpp
@@ -27,11 +27,12 @@ void System::Finalize() {
27 buffer_event->GetWritableEvent().Signal(); 27 buffer_event->GetWritableEvent().Signal();
28} 28}
29 29
30std::string_view System::GetDefaultOutputDeviceName() { 30std::string_view System::GetDefaultOutputDeviceName() const {
31 return "DeviceOut"; 31 return "DeviceOut";
32} 32}
33 33
34Result System::IsConfigValid(std::string_view device_name, const AudioOutParameter& in_params) { 34Result System::IsConfigValid(std::string_view device_name,
35 const AudioOutParameter& in_params) const {
35 if ((device_name.size() > 0) && (device_name != GetDefaultOutputDeviceName())) { 36 if ((device_name.size() > 0) && (device_name != GetDefaultOutputDeviceName())) {
36 return Service::Audio::ERR_INVALID_DEVICE_NAME; 37 return Service::Audio::ERR_INVALID_DEVICE_NAME;
37 } 38 }
@@ -113,12 +114,14 @@ bool System::AppendBuffer(const AudioOutBuffer& buffer, u64 tag) {
113 } 114 }
114 115
115 const auto timestamp{buffers.GetNextTimestamp()}; 116 const auto timestamp{buffers.GetNextTimestamp()};
116 AudioBuffer new_buffer{.start_timestamp = timestamp, 117 const AudioBuffer new_buffer{
117 .end_timestamp = timestamp + buffer.size / (channel_count * sizeof(s16)), 118 .start_timestamp = timestamp,
118 .played_timestamp = 0, 119 .end_timestamp = timestamp + buffer.size / (channel_count * sizeof(s16)),
119 .samples = buffer.samples, 120 .played_timestamp = 0,
120 .tag = tag, 121 .samples = buffer.samples,
121 .size = buffer.size}; 122 .tag = tag,
123 .size = buffer.size,
124 };
122 125
123 buffers.AppendBuffer(new_buffer); 126 buffers.AppendBuffer(new_buffer);
124 RegisterBuffers(); 127 RegisterBuffers();
@@ -198,11 +201,11 @@ void System::SetVolume(const f32 volume_) {
198 session->SetVolume(volume_); 201 session->SetVolume(volume_);
199} 202}
200 203
201bool System::ContainsAudioBuffer(const u64 tag) { 204bool System::ContainsAudioBuffer(const u64 tag) const {
202 return buffers.ContainsBuffer(tag); 205 return buffers.ContainsBuffer(tag);
203} 206}
204 207
205u32 System::GetBufferCount() { 208u32 System::GetBufferCount() const {
206 return buffers.GetAppendedRegisteredCount(); 209 return buffers.GetAppendedRegisteredCount();
207} 210}
208 211
diff --git a/src/audio_core/out/audio_out_system.h b/src/audio_core/out/audio_out_system.h
index 205ead861..0817b2f37 100644
--- a/src/audio_core/out/audio_out_system.h
+++ b/src/audio_core/out/audio_out_system.h
@@ -68,7 +68,7 @@ public:
68 * 68 *
69 * @return The default audio output device name. 69 * @return The default audio output device name.
70 */ 70 */
71 std::string_view GetDefaultOutputDeviceName(); 71 std::string_view GetDefaultOutputDeviceName() const;
72 72
73 /** 73 /**
74 * Is the given initialize config valid? 74 * Is the given initialize config valid?
@@ -77,7 +77,7 @@ public:
77 * @param in_params - Input parameters, see AudioOutParameter. 77 * @param in_params - Input parameters, see AudioOutParameter.
78 * @return Result code. 78 * @return Result code.
79 */ 79 */
80 Result IsConfigValid(std::string_view device_name, const AudioOutParameter& in_params); 80 Result IsConfigValid(std::string_view device_name, const AudioOutParameter& in_params) const;
81 81
82 /** 82 /**
83 * Initialize this system. 83 * Initialize this system.
@@ -209,14 +209,14 @@ public:
209 * @param tag - Unique tag to search for. 209 * @param tag - Unique tag to search for.
210 * @return True if the buffer is in the system, otherwise false. 210 * @return True if the buffer is in the system, otherwise false.
211 */ 211 */
212 bool ContainsAudioBuffer(u64 tag); 212 bool ContainsAudioBuffer(u64 tag) const;
213 213
214 /** 214 /**
215 * Get the maximum number of usable buffers (default 32). 215 * Get the maximum number of usable buffers (default 32).
216 * 216 *
217 * @return The number of buffers. 217 * @return The number of buffers.
218 */ 218 */
219 u32 GetBufferCount(); 219 u32 GetBufferCount() const;
220 220
221 /** 221 /**
222 * Get the total number of samples played by this system. 222 * Get the total number of samples played by this system.
diff --git a/src/audio_core/renderer/adsp/adsp.cpp b/src/audio_core/renderer/adsp/adsp.cpp
index e05a22d86..a28395663 100644
--- a/src/audio_core/renderer/adsp/adsp.cpp
+++ b/src/audio_core/renderer/adsp/adsp.cpp
@@ -50,7 +50,7 @@ u32 ADSP::GetRemainCommandCount(const u32 session_id) const {
50 return render_mailbox.GetRemainCommandCount(session_id); 50 return render_mailbox.GetRemainCommandCount(session_id);
51} 51}
52 52
53void ADSP::SendCommandBuffer(const u32 session_id, CommandBuffer& command_buffer) { 53void ADSP::SendCommandBuffer(const u32 session_id, const CommandBuffer& command_buffer) {
54 render_mailbox.SetCommandBuffer(session_id, command_buffer); 54 render_mailbox.SetCommandBuffer(session_id, command_buffer);
55} 55}
56 56
diff --git a/src/audio_core/renderer/adsp/adsp.h b/src/audio_core/renderer/adsp/adsp.h
index 523184dc2..f7a2f25e4 100644
--- a/src/audio_core/renderer/adsp/adsp.h
+++ b/src/audio_core/renderer/adsp/adsp.h
@@ -131,7 +131,7 @@ public:
131 * @param session_id - The session id to check (0 or 1). 131 * @param session_id - The session id to check (0 or 1).
132 * @param command_buffer - The command buffer to process. 132 * @param command_buffer - The command buffer to process.
133 */ 133 */
134 void SendCommandBuffer(u32 session_id, CommandBuffer& command_buffer); 134 void SendCommandBuffer(u32 session_id, const CommandBuffer& command_buffer);
135 135
136 /** 136 /**
137 * Clear the command buffers (does not clear the time taken or the remaining command count) 137 * Clear the command buffers (does not clear the time taken or the remaining command count)
diff --git a/src/audio_core/renderer/adsp/audio_renderer.cpp b/src/audio_core/renderer/adsp/audio_renderer.cpp
index bcd889ecb..bafe4822a 100644
--- a/src/audio_core/renderer/adsp/audio_renderer.cpp
+++ b/src/audio_core/renderer/adsp/audio_renderer.cpp
@@ -51,7 +51,7 @@ CommandBuffer& AudioRenderer_Mailbox::GetCommandBuffer(const s32 session_id) {
51 return command_buffers[session_id]; 51 return command_buffers[session_id];
52} 52}
53 53
54void AudioRenderer_Mailbox::SetCommandBuffer(const u32 session_id, CommandBuffer& buffer) { 54void AudioRenderer_Mailbox::SetCommandBuffer(const u32 session_id, const CommandBuffer& buffer) {
55 command_buffers[session_id] = buffer; 55 command_buffers[session_id] = buffer;
56} 56}
57 57
diff --git a/src/audio_core/renderer/adsp/audio_renderer.h b/src/audio_core/renderer/adsp/audio_renderer.h
index 49f66f21c..02e923c84 100644
--- a/src/audio_core/renderer/adsp/audio_renderer.h
+++ b/src/audio_core/renderer/adsp/audio_renderer.h
@@ -91,7 +91,7 @@ public:
91 * @param session_id - The session id to get (0 or 1). 91 * @param session_id - The session id to get (0 or 1).
92 * @param buffer - The command buffer to set. 92 * @param buffer - The command buffer to set.
93 */ 93 */
94 void SetCommandBuffer(u32 session_id, CommandBuffer& buffer); 94 void SetCommandBuffer(u32 session_id, const CommandBuffer& buffer);
95 95
96 /** 96 /**
97 * Get the total render time taken for the last command lists sent. 97 * Get the total render time taken for the last command lists sent.
diff --git a/src/audio_core/renderer/behavior/behavior_info.cpp b/src/audio_core/renderer/behavior/behavior_info.cpp
index 92140aaea..3d2a91312 100644
--- a/src/audio_core/renderer/behavior/behavior_info.cpp
+++ b/src/audio_core/renderer/behavior/behavior_info.cpp
@@ -34,7 +34,7 @@ void BehaviorInfo::ClearError() {
34 error_count = 0; 34 error_count = 0;
35} 35}
36 36
37void BehaviorInfo::AppendError(ErrorInfo& error) { 37void BehaviorInfo::AppendError(const ErrorInfo& error) {
38 LOG_ERROR(Service_Audio, "Error during RequestUpdate, reporting code {:04X} address {:08X}", 38 LOG_ERROR(Service_Audio, "Error during RequestUpdate, reporting code {:04X} address {:08X}",
39 error.error_code.raw, error.address); 39 error.error_code.raw, error.address);
40 if (error_count < MaxErrors) { 40 if (error_count < MaxErrors) {
@@ -42,7 +42,7 @@ void BehaviorInfo::AppendError(ErrorInfo& error) {
42 } 42 }
43} 43}
44 44
45void BehaviorInfo::CopyErrorInfo(std::span<ErrorInfo> out_errors, u32& out_count) { 45void BehaviorInfo::CopyErrorInfo(std::span<ErrorInfo> out_errors, u32& out_count) const {
46 out_count = std::min(error_count, MaxErrors); 46 out_count = std::min(error_count, MaxErrors);
47 47
48 for (size_t i = 0; i < MaxErrors; i++) { 48 for (size_t i = 0; i < MaxErrors; i++) {
diff --git a/src/audio_core/renderer/behavior/behavior_info.h b/src/audio_core/renderer/behavior/behavior_info.h
index 7333c297f..15c948344 100644
--- a/src/audio_core/renderer/behavior/behavior_info.h
+++ b/src/audio_core/renderer/behavior/behavior_info.h
@@ -94,7 +94,7 @@ public:
94 * 94 *
95 * @param error - The new error. 95 * @param error - The new error.
96 */ 96 */
97 void AppendError(ErrorInfo& error); 97 void AppendError(const ErrorInfo& error);
98 98
99 /** 99 /**
100 * Copy errors to the given output container. 100 * Copy errors to the given output container.
@@ -102,7 +102,7 @@ public:
102 * @param out_errors - Output container to receive the errors. 102 * @param out_errors - Output container to receive the errors.
103 * @param out_count - The number of errors written. 103 * @param out_count - The number of errors written.
104 */ 104 */
105 void CopyErrorInfo(std::span<ErrorInfo> out_errors, u32& out_count); 105 void CopyErrorInfo(std::span<ErrorInfo> out_errors, u32& out_count) const;
106 106
107 /** 107 /**
108 * Update the behaviour flags. 108 * Update the behaviour flags.
diff --git a/src/audio_core/renderer/behavior/info_updater.cpp b/src/audio_core/renderer/behavior/info_updater.cpp
index 06a37e1a6..c0a307b89 100644
--- a/src/audio_core/renderer/behavior/info_updater.cpp
+++ b/src/audio_core/renderer/behavior/info_updater.cpp
@@ -485,7 +485,7 @@ Result InfoUpdater::UpdateBehaviorInfo(BehaviorInfo& behaviour_) {
485 return ResultSuccess; 485 return ResultSuccess;
486} 486}
487 487
488Result InfoUpdater::UpdateErrorInfo(BehaviorInfo& behaviour_) { 488Result InfoUpdater::UpdateErrorInfo(const BehaviorInfo& behaviour_) {
489 auto out_params{reinterpret_cast<BehaviorInfo::OutStatus*>(output)}; 489 auto out_params{reinterpret_cast<BehaviorInfo::OutStatus*>(output)};
490 behaviour_.CopyErrorInfo(out_params->errors, out_params->error_count); 490 behaviour_.CopyErrorInfo(out_params->errors, out_params->error_count);
491 491
diff --git a/src/audio_core/renderer/behavior/info_updater.h b/src/audio_core/renderer/behavior/info_updater.h
index f0b445d9c..c817d8d8d 100644
--- a/src/audio_core/renderer/behavior/info_updater.h
+++ b/src/audio_core/renderer/behavior/info_updater.h
@@ -130,7 +130,7 @@ public:
130 * @param behaviour - Behaviour to update. 130 * @param behaviour - Behaviour to update.
131 * @return Result code. 131 * @return Result code.
132 */ 132 */
133 Result UpdateErrorInfo(BehaviorInfo& behaviour); 133 Result UpdateErrorInfo(const BehaviorInfo& behaviour);
134 134
135 /** 135 /**
136 * Update splitter. 136 * Update splitter.
diff --git a/src/audio_core/renderer/effect/i3dl2.h b/src/audio_core/renderer/effect/i3dl2.h
index 7a088a627..1ebbc5c4c 100644
--- a/src/audio_core/renderer/effect/i3dl2.h
+++ b/src/audio_core/renderer/effect/i3dl2.h
@@ -99,7 +99,7 @@ public:
99 return out_sample; 99 return out_sample;
100 } 100 }
101 101
102 Common::FixedPoint<50, 14> Read() { 102 Common::FixedPoint<50, 14> Read() const {
103 return *output; 103 return *output;
104 } 104 }
105 105
@@ -110,7 +110,7 @@ public:
110 } 110 }
111 } 111 }
112 112
113 Common::FixedPoint<50, 14> TapOut(const s32 index) { 113 Common::FixedPoint<50, 14> TapOut(const s32 index) const {
114 auto out{input - (index + 1)}; 114 auto out{input - (index + 1)};
115 if (out < buffer.data()) { 115 if (out < buffer.data()) {
116 out += max_delay + 1; 116 out += max_delay + 1;
diff --git a/src/audio_core/renderer/effect/reverb.h b/src/audio_core/renderer/effect/reverb.h
index b4df9f6ef..a72475c3c 100644
--- a/src/audio_core/renderer/effect/reverb.h
+++ b/src/audio_core/renderer/effect/reverb.h
@@ -95,7 +95,7 @@ public:
95 return out_sample; 95 return out_sample;
96 } 96 }
97 97
98 Common::FixedPoint<50, 14> Read() { 98 Common::FixedPoint<50, 14> Read() const {
99 return *output; 99 return *output;
100 } 100 }
101 101
@@ -106,7 +106,7 @@ public:
106 } 106 }
107 } 107 }
108 108
109 Common::FixedPoint<50, 14> TapOut(const s32 index) { 109 Common::FixedPoint<50, 14> TapOut(const s32 index) const {
110 auto out{input - (index + 1)}; 110 auto out{input - (index + 1)};
111 if (out < buffer.data()) { 111 if (out < buffer.data()) {
112 out += sample_count; 112 out += sample_count;
diff --git a/src/audio_core/renderer/nodes/node_states.h b/src/audio_core/renderer/nodes/node_states.h
index c0fced56f..94b1d1254 100644
--- a/src/audio_core/renderer/nodes/node_states.h
+++ b/src/audio_core/renderer/nodes/node_states.h
@@ -56,7 +56,7 @@ class NodeStates {
56 * 56 *
57 * @return The current stack position. 57 * @return The current stack position.
58 */ 58 */
59 u32 Count() { 59 u32 Count() const {
60 return pos; 60 return pos;
61 } 61 }
62 62
@@ -83,7 +83,7 @@ class NodeStates {
83 * 83 *
84 * @return The node on the top of the stack. 84 * @return The node on the top of the stack.
85 */ 85 */
86 u32 top() { 86 u32 top() const {
87 return stack[pos - 1]; 87 return stack[pos - 1];
88 } 88 }
89 89
diff --git a/src/audio_core/sink/sink_stream.h b/src/audio_core/sink/sink_stream.h
index 9366ebbd3..38a4b2f51 100644
--- a/src/audio_core/sink/sink_stream.h
+++ b/src/audio_core/sink/sink_stream.h
@@ -151,7 +151,7 @@ public:
151 * 151 *
152 * @return The number of queued buffers. 152 * @return The number of queued buffers.
153 */ 153 */
154 u32 GetQueueSize() { 154 u32 GetQueueSize() const {
155 return queued_buffers.load(); 155 return queued_buffers.load();
156 } 156 }
157 157