summaryrefslogtreecommitdiff
path: root/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
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/CAmDatabaseHandlerMap.cpp
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/CAmDatabaseHandlerMap.cpp')
-rw-r--r--AudioManagerCore/src/CAmDatabaseHandlerMap.cpp71
1 files changed, 71 insertions, 0 deletions
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))