From b2c7d55427df5d31b6a63917f27264a676314d10 Mon Sep 17 00:00:00 2001 From: christian mueller Date: Wed, 11 Apr 2012 17:29:39 +0200 Subject: * [GAM-61] implement mute in sample controller Signed-off-by: christian mueller --- .../src/CAmControlSenderBase.cpp | 34 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/PluginControlInterface/src/CAmControlSenderBase.cpp b/PluginControlInterface/src/CAmControlSenderBase.cpp index 4a315b3..1277beb 100644 --- a/PluginControlInterface/src/CAmControlSenderBase.cpp +++ b/PluginControlInterface/src/CAmControlSenderBase.cpp @@ -73,9 +73,9 @@ am_Error_e CAmControlSenderBase::hookUserConnectionRequest(const am_sourceID_t s std::vector listAllMainConnections; mControlReceiveInterface->getListMainConnections(listAllMainConnections); std::vector::iterator itAll(listAllMainConnections.begin()); - for(;itAll!=listAllMainConnections.end();++itAll) + for (; itAll != listAllMainConnections.end(); ++itAll) { - if(itAll->sinkID==sinkID && itAll->sourceID==sourceID) + if (itAll->sinkID == sinkID && itAll->sourceID == sourceID) return (E_ALREADY_EXISTS); } @@ -200,9 +200,33 @@ am_Error_e CAmControlSenderBase::hookUserVolumeStep(const am_sinkID_t SinkID, co am_Error_e CAmControlSenderBase::hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) { - (void) sinkID; - (void) muteState; - return E_NOT_USED; + assert(sinkID!=0); + + mainVolumeSet set; + set.sinkID = sinkID; + am_Error_e error; + am_Sink_s sink; + mControlReceiveInterface->getSinkInfoDB(sinkID, sink); + + if (muteState == MS_MUTED) + { + set.mainVolume = sink.mainVolume; + if ((error = mControlReceiveInterface->setSinkVolume(set.handle, sinkID, 0, RAMP_GENIVI_DIRECT, 20)) != E_OK) + { + return error; + } + } + else + { + set.mainVolume=sink.mainVolume; + if ((error = mControlReceiveInterface->setSinkVolume(set.handle, sinkID, set.mainVolume, RAMP_GENIVI_DIRECT, 20)) != E_OK) + { + return error; + } + } + mListOpenVolumeChanges.push_back(set); + mControlReceiveInterface->changeSinkMuteStateDB(muteState,sinkID); + return (E_OK); } am_Error_e CAmControlSenderBase::hookSystemRegisterDomain(const am_Domain_s & domainData, am_domainID_t & domainID) -- cgit v1.2.1