diff options
| author | 2022-09-16 09:38:17 -0400 | |
|---|---|---|
| committer | 2022-09-16 09:45:51 -0400 | |
| commit | d1f3c121a04fdc1e4d8840ef6a5bbb65212ed7a7 (patch) | |
| tree | c5f475b24fa39614aa9257d248928fb51b152520 /src/audio_core/out | |
| parent | audio_buffers: Pass by const-ref in AppendBuffers (diff) | |
| download | yuzu-d1f3c121a04fdc1e4d8840ef6a5bbb65212ed7a7.tar.gz yuzu-d1f3c121a04fdc1e4d8840ef6a5bbb65212ed7a7.tar.xz yuzu-d1f3c121a04fdc1e4d8840ef6a5bbb65212ed7a7.zip | |
audio_out: Mark several functions as const
These don't affect class state, so we can mark them as such.
Diffstat (limited to 'src/audio_core/out')
| -rw-r--r-- | src/audio_core/out/audio_out.cpp | 8 | ||||
| -rw-r--r-- | src/audio_core/out/audio_out.h | 8 | ||||
| -rw-r--r-- | src/audio_core/out/audio_out_system.cpp | 9 | ||||
| -rw-r--r-- | src/audio_core/out/audio_out_system.h | 8 |
4 files changed, 17 insertions, 16 deletions
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 | ||
| 75 | f32 Out::GetVolume() { | 75 | f32 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 | ||
| 85 | bool Out::ContainsAudioBuffer(const u64 tag) { | 85 | bool 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 | ||
| 90 | u32 Out::GetBufferCount() { | 90 | u32 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 | ||
| 95 | u64 Out::GetPlayedSampleCount() { | 95 | u64 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 | ||
| 136 | private: | 136 | private: |
| 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 ae605f65b..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 | ||
| 30 | std::string_view System::GetDefaultOutputDeviceName() { | 30 | std::string_view System::GetDefaultOutputDeviceName() const { |
| 31 | return "DeviceOut"; | 31 | return "DeviceOut"; |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | Result System::IsConfigValid(std::string_view device_name, const AudioOutParameter& in_params) { | 34 | Result 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 | } |
| @@ -200,11 +201,11 @@ void System::SetVolume(const f32 volume_) { | |||
| 200 | session->SetVolume(volume_); | 201 | session->SetVolume(volume_); |
| 201 | } | 202 | } |
| 202 | 203 | ||
| 203 | bool System::ContainsAudioBuffer(const u64 tag) { | 204 | bool System::ContainsAudioBuffer(const u64 tag) const { |
| 204 | return buffers.ContainsBuffer(tag); | 205 | return buffers.ContainsBuffer(tag); |
| 205 | } | 206 | } |
| 206 | 207 | ||
| 207 | u32 System::GetBufferCount() { | 208 | u32 System::GetBufferCount() const { |
| 208 | return buffers.GetAppendedRegisteredCount(); | 209 | return buffers.GetAppendedRegisteredCount(); |
| 209 | } | 210 | } |
| 210 | 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. |