yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

audio_out: Mark several functions as const

These don't affect class state, so we can mark them as such.
This commit is contained in:
Lioncash 2022-09-16 09:38:17 -04:00
parent e9109cb5f2
commit d1f3c121a0
4 changed files with 17 additions and 16 deletions

View File

@ -72,7 +72,7 @@ Kernel::KReadableEvent& Out::GetBufferEvent() {
return event->GetReadableEvent(); return event->GetReadableEvent();
} }
f32 Out::GetVolume() { f32 Out::GetVolume() const {
std::scoped_lock l{parent_mutex}; std::scoped_lock l{parent_mutex};
return system.GetVolume(); return system.GetVolume();
} }
@ -82,17 +82,17 @@ void Out::SetVolume(const f32 volume) {
system.SetVolume(volume); system.SetVolume(volume);
} }
bool Out::ContainsAudioBuffer(const u64 tag) { bool Out::ContainsAudioBuffer(const u64 tag) const {
std::scoped_lock l{parent_mutex}; std::scoped_lock l{parent_mutex};
return system.ContainsAudioBuffer(tag); return system.ContainsAudioBuffer(tag);
} }
u32 Out::GetBufferCount() { u32 Out::GetBufferCount() const {
std::scoped_lock l{parent_mutex}; std::scoped_lock l{parent_mutex};
return system.GetBufferCount(); return system.GetBufferCount();
} }
u64 Out::GetPlayedSampleCount() { u64 Out::GetPlayedSampleCount() const {
std::scoped_lock l{parent_mutex}; std::scoped_lock l{parent_mutex};
return system.GetPlayedSampleCount(); return system.GetPlayedSampleCount();
} }

View File

@ -102,7 +102,7 @@ public:
* *
* @return The current volume. * @return The current volume.
*/ */
f32 GetVolume(); f32 GetVolume() const;
/** /**
* Set the system volume. * Set the system volume.
@ -117,21 +117,21 @@ public:
* @param tag - The tag to search for. * @param tag - The tag to search for.
* @return True if the buffer is in the system, otherwise false. * @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. * Get the maximum number of buffers.
* *
* @return 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 out. * Get the total played sample count for this audio out.
* *
* @return The played sample count. * @return The played sample count.
*/ */
u64 GetPlayedSampleCount(); u64 GetPlayedSampleCount() const;
private: private:
/// The AudioOut::Manager this audio out is registered with /// The AudioOut::Manager this audio out is registered with

View File

@ -27,11 +27,12 @@ void System::Finalize() {
buffer_event->GetWritableEvent().Signal(); buffer_event->GetWritableEvent().Signal();
} }
std::string_view System::GetDefaultOutputDeviceName() { std::string_view System::GetDefaultOutputDeviceName() const {
return "DeviceOut"; return "DeviceOut";
} }
Result System::IsConfigValid(std::string_view device_name, const AudioOutParameter& in_params) { Result System::IsConfigValid(std::string_view device_name,
const AudioOutParameter& in_params) const {
if ((device_name.size() > 0) && (device_name != GetDefaultOutputDeviceName())) { if ((device_name.size() > 0) && (device_name != GetDefaultOutputDeviceName())) {
return Service::Audio::ERR_INVALID_DEVICE_NAME; return Service::Audio::ERR_INVALID_DEVICE_NAME;
} }
@ -200,11 +201,11 @@ void System::SetVolume(const f32 volume_) {
session->SetVolume(volume_); session->SetVolume(volume_);
} }
bool System::ContainsAudioBuffer(const u64 tag) { bool System::ContainsAudioBuffer(const u64 tag) const {
return buffers.ContainsBuffer(tag); return buffers.ContainsBuffer(tag);
} }
u32 System::GetBufferCount() { u32 System::GetBufferCount() const {
return buffers.GetAppendedRegisteredCount(); return buffers.GetAppendedRegisteredCount();
} }

View File

@ -68,7 +68,7 @@ public:
* *
* @return The default audio output device name. * @return The default audio output device name.
*/ */
std::string_view GetDefaultOutputDeviceName(); std::string_view GetDefaultOutputDeviceName() const;
/** /**
* Is the given initialize config valid? * Is the given initialize config valid?
@ -77,7 +77,7 @@ public:
* @param in_params - Input parameters, see AudioOutParameter. * @param in_params - Input parameters, see AudioOutParameter.
* @return Result code. * @return Result code.
*/ */
Result IsConfigValid(std::string_view device_name, const AudioOutParameter& in_params); Result IsConfigValid(std::string_view device_name, const AudioOutParameter& in_params) const;
/** /**
* Initialize this system. * Initialize this system.
@ -209,14 +209,14 @@ public:
* @param tag - Unique tag to search for. * @param tag - Unique tag to search for.
* @return True if the buffer is in the system, otherwise false. * @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). * Get the maximum number of usable buffers (default 32).
* *
* @return The number of buffers. * @return The number of buffers.
*/ */
u32 GetBufferCount(); u32 GetBufferCount() const;
/** /**
* Get the total number of samples played by this system. * Get the total number of samples played by this system.