audio_in: Mark several functions as const
These functions don't modify class state, so we can mark them as such
This commit is contained in:
parent
d1f3c121a0
commit
7a5d235d94
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 with
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue