summaryrefslogtreecommitdiff
path: root/AudioManagerCore/src
diff options
context:
space:
mode:
authorMartin Koch <mkoch@de.adit-jv.com>2020-01-16 15:31:05 +0100
committerMartin Koch <mkoch@de.adit-jv.com>2020-01-17 09:14:36 +0100
commita2af83777be4860d554bceaf28c87218729cf309 (patch)
tree58472fdde28c6660ba60d1efd4f8b119eafd1ab5 /AudioManagerCore/src
parentce501a931e9eeb20013406373156bf70fb007cda (diff)
downloadaudiomanager-a2af83777be4860d554bceaf28c87218729cf309.tar.gz
AM: add plural form of set...SoundProperties for sources and sinks to command and control interface
- implement plural form of requests and acknowledgments in core - provide empty default implementations in interfaces to ensure backward compatibility with older plugins - accommodate extensions in module tests - leave existing singular form untouched Main purpose of this extension is to allow for one-shot (uninterrupted), consistent change of multiple, possibly interrelated sound properties. Signed-off-by: Martin Koch <mkoch@de.adit-jv.com>
Diffstat (limited to 'AudioManagerCore/src')
-rw-r--r--AudioManagerCore/src/CAmCommandReceiver.cpp12
-rw-r--r--AudioManagerCore/src/CAmCommandSender.cpp16
-rw-r--r--AudioManagerCore/src/CAmControlReceiver.cpp10
-rw-r--r--AudioManagerCore/src/CAmControlSender.cpp12
-rw-r--r--AudioManagerCore/src/CAmDatabaseHandlerMap.cpp71
5 files changed, 121 insertions, 0 deletions
diff --git a/AudioManagerCore/src/CAmCommandReceiver.cpp b/AudioManagerCore/src/CAmCommandReceiver.cpp
index 78d8cbe..1937f32 100644
--- a/AudioManagerCore/src/CAmCommandReceiver.cpp
+++ b/AudioManagerCore/src/CAmCommandReceiver.cpp
@@ -111,12 +111,24 @@ am_Error_e CAmCommandReceiver::setMainSinkSoundProperty(const am_MainSoundProper
return (mControlSender->hookUserSetMainSinkSoundProperty(sinkID, soundProperty));
}
+am_Error_e CAmCommandReceiver::setMainSinkSoundProperties(const std::vector<am_MainSoundProperty_s> &listSoundProperties, const am_sinkID_t sinkID)
+{
+ logInfo(__METHOD_NAME__, "sinkID=", sinkID);
+ return (mControlSender->hookUserSetMainSinkSoundProperties(sinkID, listSoundProperties));
+}
+
am_Error_e CAmCommandReceiver::setMainSourceSoundProperty(const am_MainSoundProperty_s &soundProperty, const am_sourceID_t sourceID)
{
logInfo(__METHOD_NAME__, "sourceID=", sourceID, "soundPropertyType=", soundProperty.type, "soundPropertyValue=", soundProperty.value);
return (mControlSender->hookUserSetMainSourceSoundProperty(sourceID, soundProperty));
}
+am_Error_e CAmCommandReceiver::setMainSourceSoundProperties(const std::vector<am_MainSoundProperty_s> &listSoundProperties, const am_sourceID_t sourceID)
+{
+ logInfo(__METHOD_NAME__, "sourceID=", sourceID);
+ return (mControlSender->hookUserSetMainSourceSoundProperties(sourceID, listSoundProperties));
+}
+
am_Error_e CAmCommandReceiver::setSystemProperty(const am_SystemProperty_s &property)
{
logInfo(__METHOD_NAME__, "type=", property.type, "systemPropertyValue=", property.value);
diff --git a/AudioManagerCore/src/CAmCommandSender.cpp b/AudioManagerCore/src/CAmCommandSender.cpp
index d1a4a22..622e5fd 100644
--- a/AudioManagerCore/src/CAmCommandSender.cpp
+++ b/AudioManagerCore/src/CAmCommandSender.cpp
@@ -118,9 +118,15 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string> &listOfPluginD
dboMainSinkSoundPropertyChanged = [&](const am_sinkID_t sinkID, const am_MainSoundProperty_s &SoundProperty) {
mSerializer.asyncCall(this, &CAmCommandSender::cbMainSinkSoundPropertyChanged, sinkID, SoundProperty);
};
+ dboMainSinkSoundPropertiesChanged = [&](const am_sinkID_t sinkID, const std::vector<am_MainSoundProperty_s> &listSoundProperties) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbMainSinkSoundPropertiesChanged, sinkID, listSoundProperties);
+ };
dboMainSourceSoundPropertyChanged = [&](const am_sourceID_t sourceID, const am_MainSoundProperty_s &SoundProperty) {
mSerializer.asyncCall(this, &CAmCommandSender::cbMainSourceSoundPropertyChanged, sourceID, SoundProperty);
};
+ dboMainSourceSoundPropertiesChanged = [&](const am_sourceID_t sourceID, const std::vector<am_MainSoundProperty_s> &listSoundProperties) {
+ mSerializer.asyncCall(this, &CAmCommandSender::cbMainSourceSoundPropertiesChanged, sourceID, listSoundProperties);
+ };
dboSinkAvailabilityChanged = [&](const am_sinkID_t sinkID, const am_Availability_s &availability) {
mSerializer.asyncCall(this, &CAmCommandSender::cbSinkAvailabilityChanged, sinkID, availability);
};
@@ -310,11 +316,21 @@ void CAmCommandSender::cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID,
CALL_ALL_INTERFACES(cbMainSinkSoundPropertyChanged(sinkID, SoundProperty))
}
+void CAmCommandSender::cbMainSinkSoundPropertiesChanged(const am_sinkID_t sinkID, const std::vector<am_MainSoundProperty_s> &listSoundProperties)
+{
+ CALL_ALL_INTERFACES(cbMainSinkSoundPropertiesChanged(sinkID, listSoundProperties))
+}
+
void CAmCommandSender::cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s &SoundProperty)
{
CALL_ALL_INTERFACES(cbMainSourceSoundPropertyChanged(sourceID, SoundProperty))
}
+void CAmCommandSender::cbMainSourceSoundPropertiesChanged(const am_sourceID_t sourceID, const std::vector<am_MainSoundProperty_s> &listSoundProperties)
+{
+ CALL_ALL_INTERFACES(cbMainSourceSoundPropertiesChanged(sourceID, listSoundProperties))
+}
+
void CAmCommandSender::cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s &availability)
{
CALL_ALL_INTERFACES(cbSinkAvailabilityChanged(sinkID, availability))
diff --git a/AudioManagerCore/src/CAmControlReceiver.cpp b/AudioManagerCore/src/CAmControlReceiver.cpp
index 6fec509..0fe9b03 100644
--- a/AudioManagerCore/src/CAmControlReceiver.cpp
+++ b/AudioManagerCore/src/CAmControlReceiver.cpp
@@ -206,11 +206,21 @@ am_Error_e CAmControlReceiver::changeMainSinkSoundPropertyDB(const am_MainSoundP
return (mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty, sinkID));
}
+am_Error_e CAmControlReceiver::changeMainSinkSoundPropertiesDB(const std::vector<am_MainSoundProperty_s> &listSoundProperties, const am_sinkID_t sinkID)
+{
+ return (mDatabaseHandler->changeMainSinkSoundPropertiesDB(listSoundProperties, sinkID));
+}
+
am_Error_e CAmControlReceiver::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s &soundProperty, const am_sourceID_t sourceID)
{
return (mDatabaseHandler->changeMainSourceSoundPropertyDB(soundProperty, sourceID));
}
+am_Error_e CAmControlReceiver::changeMainSourceSoundPropertiesDB(const std::vector<am_MainSoundProperty_s> &listSoundProperties, const am_sourceID_t sourceID)
+{
+ return (mDatabaseHandler->changeMainSourceSoundPropertiesDB(listSoundProperties, sourceID));
+}
+
am_Error_e CAmControlReceiver::changeSourceAvailabilityDB(const am_Availability_s &availability, const am_sourceID_t sourceID)
{
return (mDatabaseHandler->changeSourceAvailabilityDB(availability, sourceID));
diff --git a/AudioManagerCore/src/CAmControlSender.cpp b/AudioManagerCore/src/CAmControlSender.cpp
index 1baeb30..e8f2285 100644
--- a/AudioManagerCore/src/CAmControlSender.cpp
+++ b/AudioManagerCore/src/CAmControlSender.cpp
@@ -193,12 +193,24 @@ am_Error_e CAmControlSender::hookUserSetMainSinkSoundProperty(const am_sinkID_t
return (mController->hookUserSetMainSinkSoundProperty(sinkID, soundProperty));
}
+am_Error_e CAmControlSender::hookUserSetMainSinkSoundProperties(const am_sinkID_t sinkID, const std::vector<am_MainSoundProperty_s > &listSoundProperties)
+{
+ assert(mController);
+ return (mController->hookUserSetMainSinkSoundProperties(sinkID, listSoundProperties));
+}
+
am_Error_e CAmControlSender::hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s &soundProperty)
{
assert(mController);
return (mController->hookUserSetMainSourceSoundProperty(sourceID, soundProperty));
}
+am_Error_e CAmControlSender::hookUserSetMainSourceSoundProperties(const am_sourceID_t sourceID, const std::vector<am_MainSoundProperty_s > &listSoundProperties)
+{
+ assert(mController);
+ return (mController->hookUserSetMainSourceSoundProperties(sourceID, listSoundProperties));
+}
+
am_Error_e CAmControlSender::hookUserSetSystemProperty(const am_SystemProperty_s &property)
{
assert(mController);
diff --git a/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
index c79fbf3..eabcb18 100644
--- a/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
+++ b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
@@ -1526,6 +1526,42 @@ am_Error_e CAmDatabaseHandlerMap::changeMainSinkSoundPropertyDB(const am_MainSou
}
}
+am_Error_e CAmDatabaseHandlerMap::changeMainSinkSoundPropertiesDB(const std::vector<am_MainSoundProperty_s> &listSoundProperties, const am_sinkID_t sinkID)
+{
+
+ if (!existSink(sinkID))
+ {
+ logError(__METHOD_NAME__, "sinkID=", sinkID," must exist");
+ return (E_NON_EXISTENT);
+ }
+
+ am_Sink_Database_s &sink = mMappedData.mSinkMap[sinkID];
+ std::vector<am_MainSoundProperty_s>::iterator elementIterator;
+
+ for (auto &itlistSoundProperties : listSoundProperties )
+ {
+ for (elementIterator = sink.listMainSoundProperties.begin(); elementIterator != sink.listMainSoundProperties.end();
+ ++elementIterator )
+ {
+ if (elementIterator->type == itlistSoundProperties.type)
+ {
+ DB_COND_UPDATE_RIE(elementIterator->value, itlistSoundProperties.value);
+ if (sink.cacheMainSoundProperties.size())
+ {
+ sink.cacheMainSoundProperties[itlistSoundProperties.type] = itlistSoundProperties.value;
+ }
+
+ break;
+ }
+ }
+ }
+
+ logVerbose("DatabaseHandler::changeMainSinkSoundPropertiesDB changed MainSinkSoundProperties of sink:", sinkID);
+
+ NOTIFY_OBSERVERS2(dboMainSinkSoundPropertiesChanged, sinkID, listSoundProperties)
+ return (E_OK);
+}
+
am_Error_e CAmDatabaseHandlerMap::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s &soundProperty, const am_sourceID_t sourceID)
{
@@ -1567,6 +1603,41 @@ am_Error_e CAmDatabaseHandlerMap::changeMainSourceSoundPropertyDB(const am_MainS
}
}
+am_Error_e CAmDatabaseHandlerMap::changeMainSourceSoundPropertiesDB(const std::vector<am_MainSoundProperty_s> &listSoundProperties, const am_sourceID_t sourceID)
+{
+ if (!existSource(sourceID))
+ {
+ logError(__METHOD_NAME__, "sourceID=", sourceID, " must exist");
+ return (E_NON_EXISTENT);
+ }
+
+ am_Source_Database_s &source = mMappedData.mSourceMap.at(sourceID);
+ std::vector<am_MainSoundProperty_s>::iterator elementIterator;
+
+ for (auto &itlistSoundProperties : listSoundProperties )
+ {
+ for (elementIterator = source.listMainSoundProperties.begin(); elementIterator != source.listMainSoundProperties.end();
+ ++elementIterator )
+ {
+ if (elementIterator->type == itlistSoundProperties.type)
+ {
+ DB_COND_UPDATE_RIE(elementIterator->value, itlistSoundProperties.value);
+ if (source.cacheMainSoundProperties.size())
+ {
+ source.cacheMainSoundProperties[itlistSoundProperties.type] = itlistSoundProperties.value;
+ }
+
+ break;
+ }
+ }
+ }
+
+ logVerbose("DatabaseHandler::changeMainSourceSoundPropertiesDB changed MainSinkSoundProperties of source:", sourceID);
+
+ NOTIFY_OBSERVERS2(dboMainSourceSoundPropertiesChanged, sourceID, listSoundProperties)
+ return (E_OK);
+}
+
am_Error_e CAmDatabaseHandlerMap::changeSourceAvailabilityDB(const am_Availability_s &availability, const am_sourceID_t sourceID)
{
if (!(availability.availability >= A_UNKNOWN && availability.availability <= A_MAX))