Merge pull request #8914 from lioncash/audio-const

audio_core: Mark several member functions as const
This commit is contained in:
bunnei 2022-09-16 23:51:31 -07:00 committed by GitHub
commit 4a7a771340
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 87 additions and 82 deletions

View file

@ -50,7 +50,7 @@ u32 ADSP::GetRemainCommandCount(const u32 session_id) const {
return render_mailbox.GetRemainCommandCount(session_id);
}
void ADSP::SendCommandBuffer(const u32 session_id, CommandBuffer& command_buffer) {
void ADSP::SendCommandBuffer(const u32 session_id, const CommandBuffer& command_buffer) {
render_mailbox.SetCommandBuffer(session_id, command_buffer);
}

View file

@ -131,7 +131,7 @@ public:
* @param session_id - The session id to check (0 or 1).
* @param command_buffer - The command buffer to process.
*/
void SendCommandBuffer(u32 session_id, CommandBuffer& command_buffer);
void SendCommandBuffer(u32 session_id, const CommandBuffer& command_buffer);
/**
* Clear the command buffers (does not clear the time taken or the remaining command count)

View file

@ -51,7 +51,7 @@ CommandBuffer& AudioRenderer_Mailbox::GetCommandBuffer(const s32 session_id) {
return command_buffers[session_id];
}
void AudioRenderer_Mailbox::SetCommandBuffer(const u32 session_id, CommandBuffer& buffer) {
void AudioRenderer_Mailbox::SetCommandBuffer(const u32 session_id, const CommandBuffer& buffer) {
command_buffers[session_id] = buffer;
}

View file

@ -91,7 +91,7 @@ public:
* @param session_id - The session id to get (0 or 1).
* @param buffer - The command buffer to set.
*/
void SetCommandBuffer(u32 session_id, CommandBuffer& buffer);
void SetCommandBuffer(u32 session_id, const CommandBuffer& buffer);
/**
* Get the total render time taken for the last command lists sent.

View file

@ -34,7 +34,7 @@ void BehaviorInfo::ClearError() {
error_count = 0;
}
void BehaviorInfo::AppendError(ErrorInfo& error) {
void BehaviorInfo::AppendError(const ErrorInfo& error) {
LOG_ERROR(Service_Audio, "Error during RequestUpdate, reporting code {:04X} address {:08X}",
error.error_code.raw, error.address);
if (error_count < MaxErrors) {
@ -42,7 +42,7 @@ void BehaviorInfo::AppendError(ErrorInfo& error) {
}
}
void BehaviorInfo::CopyErrorInfo(std::span<ErrorInfo> out_errors, u32& out_count) {
void BehaviorInfo::CopyErrorInfo(std::span<ErrorInfo> out_errors, u32& out_count) const {
out_count = std::min(error_count, MaxErrors);
for (size_t i = 0; i < MaxErrors; i++) {

View file

@ -94,7 +94,7 @@ public:
*
* @param error - The new error.
*/
void AppendError(ErrorInfo& error);
void AppendError(const ErrorInfo& error);
/**
* Copy errors to the given output container.
@ -102,7 +102,7 @@ public:
* @param out_errors - Output container to receive the errors.
* @param out_count - The number of errors written.
*/
void CopyErrorInfo(std::span<ErrorInfo> out_errors, u32& out_count);
void CopyErrorInfo(std::span<ErrorInfo> out_errors, u32& out_count) const;
/**
* Update the behaviour flags.

View file

@ -485,7 +485,7 @@ Result InfoUpdater::UpdateBehaviorInfo(BehaviorInfo& behaviour_) {
return ResultSuccess;
}
Result InfoUpdater::UpdateErrorInfo(BehaviorInfo& behaviour_) {
Result InfoUpdater::UpdateErrorInfo(const BehaviorInfo& behaviour_) {
auto out_params{reinterpret_cast<BehaviorInfo::OutStatus*>(output)};
behaviour_.CopyErrorInfo(out_params->errors, out_params->error_count);

View file

@ -130,7 +130,7 @@ public:
* @param behaviour - Behaviour to update.
* @return Result code.
*/
Result UpdateErrorInfo(BehaviorInfo& behaviour);
Result UpdateErrorInfo(const BehaviorInfo& behaviour);
/**
* Update splitter.

View file

@ -99,7 +99,7 @@ public:
return out_sample;
}
Common::FixedPoint<50, 14> Read() {
Common::FixedPoint<50, 14> Read() const {
return *output;
}
@ -110,7 +110,7 @@ public:
}
}
Common::FixedPoint<50, 14> TapOut(const s32 index) {
Common::FixedPoint<50, 14> TapOut(const s32 index) const {
auto out{input - (index + 1)};
if (out < buffer.data()) {
out += max_delay + 1;

View file

@ -95,7 +95,7 @@ public:
return out_sample;
}
Common::FixedPoint<50, 14> Read() {
Common::FixedPoint<50, 14> Read() const {
return *output;
}
@ -106,7 +106,7 @@ public:
}
}
Common::FixedPoint<50, 14> TapOut(const s32 index) {
Common::FixedPoint<50, 14> TapOut(const s32 index) const {
auto out{input - (index + 1)};
if (out < buffer.data()) {
out += sample_count;

View file

@ -56,7 +56,7 @@ class NodeStates {
*
* @return The current stack position.
*/
u32 Count() {
u32 Count() const {
return pos;
}
@ -83,7 +83,7 @@ class NodeStates {
*
* @return The node on the top of the stack.
*/
u32 top() {
u32 top() const {
return stack[pos - 1];
}