mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-02 06:22:53 +00:00
Merge "audio: Allow Module subclasses to customize Configuration" into main
This commit is contained in:
@@ -286,22 +286,28 @@ std::set<int32_t> Module::portIdsFromPortConfigIds(C portConfigIds) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<internal::Configuration> Module::initializeConfig() {
|
||||||
|
std::unique_ptr<internal::Configuration> config;
|
||||||
|
switch (getType()) {
|
||||||
|
case Type::DEFAULT:
|
||||||
|
config = std::move(internal::getPrimaryConfiguration());
|
||||||
|
break;
|
||||||
|
case Type::R_SUBMIX:
|
||||||
|
config = std::move(internal::getRSubmixConfiguration());
|
||||||
|
break;
|
||||||
|
case Type::STUB:
|
||||||
|
config = std::move(internal::getStubConfiguration());
|
||||||
|
break;
|
||||||
|
case Type::USB:
|
||||||
|
config = std::move(internal::getUsbConfiguration());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
internal::Configuration& Module::getConfig() {
|
internal::Configuration& Module::getConfig() {
|
||||||
if (!mConfig) {
|
if (!mConfig) {
|
||||||
switch (mType) {
|
mConfig = std::move(initializeConfig());
|
||||||
case Type::DEFAULT:
|
|
||||||
mConfig = std::move(internal::getPrimaryConfiguration());
|
|
||||||
break;
|
|
||||||
case Type::R_SUBMIX:
|
|
||||||
mConfig = std::move(internal::getRSubmixConfiguration());
|
|
||||||
break;
|
|
||||||
case Type::STUB:
|
|
||||||
mConfig = std::move(internal::getStubConfiguration());
|
|
||||||
break;
|
|
||||||
case Type::USB:
|
|
||||||
mConfig = std::move(internal::getUsbConfiguration());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return *mConfig;
|
return *mConfig;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ class Module : public BnModule {
|
|||||||
const ::aidl::android::media::audio::common::AudioPort& audioPort, bool connected);
|
const ::aidl::android::media::audio::common::AudioPort& audioPort, bool connected);
|
||||||
virtual ndk::ScopedAStatus onMasterMuteChanged(bool mute);
|
virtual ndk::ScopedAStatus onMasterMuteChanged(bool mute);
|
||||||
virtual ndk::ScopedAStatus onMasterVolumeChanged(float volume);
|
virtual ndk::ScopedAStatus onMasterVolumeChanged(float volume);
|
||||||
|
virtual std::unique_ptr<internal::Configuration> initializeConfig();
|
||||||
|
|
||||||
// Utility and helper functions accessible to subclasses.
|
// Utility and helper functions accessible to subclasses.
|
||||||
void cleanUpPatch(int32_t patchId);
|
void cleanUpPatch(int32_t patchId);
|
||||||
@@ -202,6 +203,7 @@ class Module : public BnModule {
|
|||||||
bool getMicMute() const { return mMicMute; }
|
bool getMicMute() const { return mMicMute; }
|
||||||
const Patches& getPatches() const { return mPatches; }
|
const Patches& getPatches() const { return mPatches; }
|
||||||
const Streams& getStreams() const { return mStreams; }
|
const Streams& getStreams() const { return mStreams; }
|
||||||
|
Type getType() const { return mType; }
|
||||||
bool isMmapSupported();
|
bool isMmapSupported();
|
||||||
template <typename C>
|
template <typename C>
|
||||||
std::set<int32_t> portIdsFromPortConfigIds(C portConfigIds);
|
std::set<int32_t> portIdsFromPortConfigIds(C portConfigIds);
|
||||||
|
|||||||
Reference in New Issue
Block a user