diff options
| author | 2022-09-16 09:40:41 -0400 | |
|---|---|---|
| committer | 2022-09-16 09:45:54 -0400 | |
| commit | 7a5d235d944bb3837abb0be649303a5c15ea36f5 (patch) | |
| tree | a84ff0e56d2ba965dbcc46a9b655137cea4b14a6 /src | |
| parent | audio_out: Mark several functions as const (diff) | |
| download | yuzu-7a5d235d944bb3837abb0be649303a5c15ea36f5.tar.gz yuzu-7a5d235d944bb3837abb0be649303a5c15ea36f5.tar.xz yuzu-7a5d235d944bb3837abb0be649303a5c15ea36f5.zip | |
audio_in: Mark several functions as const
These functions don't modify class state, so we can mark them as such
Diffstat (limited to 'src')
| -rw-r--r-- | src/audio_core/in/audio_in.cpp | 8 | ||||
| -rw-r--r-- | src/audio_core/in/audio_in.h | 8 | ||||
| -rw-r--r-- | src/audio_core/in/audio_in_system.cpp | 10 | ||||
| -rw-r--r-- | src/audio_core/in/audio_in_system.h | 10 |
4 files changed, 18 insertions, 18 deletions
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 | ||
| 75 | f32 In::GetVolume() { | 75 | f32 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 | ||
| 85 | bool In::ContainsAudioBuffer(u64 tag) { | 85 | bool 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 | ||
| 90 | u32 In::GetBufferCount() { | 90 | u32 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 | ||
| 95 | u64 In::GetPlayedSampleCount() { | 95 | u64 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 | ||
| 136 | private: | 136 | private: |
| 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 9c6039aea..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 | ||
| 37 | std::string_view System::GetDefaultDeviceName() { | 37 | std::string_view System::GetDefaultDeviceName() const { |
| 38 | return "BuiltInHeadset"; | 38 | return "BuiltInHeadset"; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | std::string_view System::GetDefaultUacDeviceName() { | 41 | std::string_view System::GetDefaultUacDeviceName() const { |
| 42 | return "Uac"; | 42 | return "Uac"; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | Result System::IsConfigValid(const std::string_view device_name, | 45 | Result 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; |
| @@ -202,11 +202,11 @@ void System::SetVolume(const f32 volume_) { | |||
| 202 | session->SetVolume(volume_); | 202 | session->SetVolume(volume_); |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | bool System::ContainsAudioBuffer(const u64 tag) { | 205 | bool System::ContainsAudioBuffer(const u64 tag) const { |
| 206 | return buffers.ContainsBuffer(tag); | 206 | return buffers.ContainsBuffer(tag); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | u32 System::GetBufferCount() { | 209 | u32 System::GetBufferCount() const { |
| 210 | return buffers.GetAppendedRegisteredCount(); | 210 | return buffers.GetAppendedRegisteredCount(); |
| 211 | } | 211 | } |
| 212 | 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. |