VERY experimental Nintendo Switch 2 emulator
C++
audio_in: Mark several functions as const
Lioncash7ee4876f1717
diff --git a/src/audio_core/in/audio_in.cpp b/src/audio_core/in/audio_in.cppindex c946895d64..91ccd5ad77 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() {return event->GetReadableEvent();}-f32 In::GetVolume() {+f32 In::GetVolume() const {std::scoped_lock l{parent_mutex};return system.GetVolume();}@@ -82,17 +82,17 @@ void In::SetVolume(f32 volume) {system.SetVolume(volume);}-bool In::ContainsAudioBuffer(u64 tag) {+bool In::ContainsAudioBuffer(u64 tag) const {std::scoped_lock l{parent_mutex};return system.ContainsAudioBuffer(tag);}-u32 In::GetBufferCount() {+u32 In::GetBufferCount() const {std::scoped_lock l{parent_mutex};return system.GetBufferCount();}-u64 In::GetPlayedSampleCount() {+u64 In::GetPlayedSampleCount() const {std::scoped_lock l{parent_mutex};return system.GetPlayedSampleCount();}diff --git a/src/audio_core/in/audio_in.h b/src/audio_core/in/audio_in.hindex 6253891d5e..092ab72369 100644--- a/src/audio_core/in/audio_in.h+++ b/src/audio_core/in/audio_in.h@@ -102,7 +102,7 @@ public:** @return The current volume.*/- f32 GetVolume();+ f32 GetVolume() const;/*** Set the system volume.@@ -117,21 +117,21 @@ public:* @param tag - The tag to search for.* @return True if the buffer is in the system, otherwise false.*/- bool ContainsAudioBuffer(u64 tag);+ bool ContainsAudioBuffer(u64 tag) const;/*** Get the maximum number of buffers.** @return The maximum number of buffers.*/- u32 GetBufferCount();+ u32 GetBufferCount() const;/*** Get the total played sample count for this audio in.** @return The played sample count.*/- u64 GetPlayedSampleCount();+ u64 GetPlayedSampleCount() const;private:/// The AudioIn::Manager this audio in is registered withdiff --git a/src/audio_core/in/audio_in_system.cpp b/src/audio_core/in/audio_in_system.cppindex 9c6039aea8..e7f918a47b 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 {return session_id;}-std::string_view System::GetDefaultDeviceName() {+std::string_view System::GetDefaultDeviceName() const {return "BuiltInHeadset";}-std::string_view System::GetDefaultUacDeviceName() {+std::string_view System::GetDefaultUacDeviceName() const {return "Uac";}Result System::IsConfigValid(const std::string_view device_name,- const AudioInParameter& in_params) {+ const AudioInParameter& in_params) const {if ((device_name.size() > 0) &&(device_name != GetDefaultDeviceName() && device_name != GetDefaultUacDeviceName())) {return Service::Audio::ERR_INVALID_DEVICE_NAME;@@ -202,11 +202,11 @@ void System::SetVolume(const f32 volume_) {session->SetVolume(volume_);}-bool System::ContainsAudioBuffer(const u64 tag) {+bool System::ContainsAudioBuffer(const u64 tag) const {return buffers.ContainsBuffer(tag);}-u32 System::GetBufferCount() {+u32 System::GetBufferCount() const {return buffers.GetAppendedRegisteredCount();}diff --git a/src/audio_core/in/audio_in_system.h b/src/audio_core/in/audio_in_system.hindex 9ddc8daae1..b9dc0e60ff 100644--- a/src/audio_core/in/audio_in_system.h+++ b/src/audio_core/in/audio_in_system.h@@ -68,7 +68,7 @@ public:** @return The default audio input device name.*/- std::string_view GetDefaultDeviceName();+ std::string_view GetDefaultDeviceName() const;/*** Get the default USB audio input device name.@@ -77,7 +77,7 @@ public:** @return The default USB audio input device name.*/- std::string_view GetDefaultUacDeviceName();+ std::string_view GetDefaultUacDeviceName() const;/*** Is the given initialize config valid?@@ -86,7 +86,7 @@ public:* @param in_params - Input parameters, see AudioInParameter.* @return Result code.*/- Result IsConfigValid(std::string_view device_name, const AudioInParameter& in_params);+ Result IsConfigValid(std::string_view device_name, const AudioInParameter& in_params) const;/*** Initialize this system.@@ -218,14 +218,14 @@ public:* @param tag - Unique tag to search for.* @return True if the buffer is in the system, otherwise false.*/- bool ContainsAudioBuffer(u64 tag);+ bool ContainsAudioBuffer(u64 tag) const;/*** Get the maximum number of usable buffers (default 32).** @return The number of buffers.*/- u32 GetBufferCount();+ u32 GetBufferCount() const;/*** Get the total number of samples played by this system.