qtms/src/qtmsglobalgaineffectimpl.cpp
branchRCL_3
changeset 56 63223d4fd956
parent 55 6c1dfe4da5dd
child 59 666f9a5a90a9
equal deleted inserted replaced
55:6c1dfe4da5dd 56:63223d4fd956
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: QT Bindings for TMS
       
    15  *
       
    16  */
       
    17 
       
    18 #include <qtms.h>
       
    19 #include <tmsglobalgaineffect.h>
       
    20 #include "tmsutility.h"
       
    21 #include "qtmsglobalgaineffectimpl.h"
       
    22 
       
    23 using namespace QTMS;
       
    24 using namespace TMS;
       
    25 
       
    26 QTMSGlobalGainEffectImpl::QTMSGlobalGainEffectImpl()
       
    27 {
       
    28 }
       
    29 
       
    30 QTMSGlobalGainEffectImpl::~QTMSGlobalGainEffectImpl()
       
    31 {
       
    32     RemoveObserver(*this);
       
    33 }
       
    34 
       
    35 gint QTMSGlobalGainEffectImpl::Create(QTMSEffect*& qglobalgain, TMS::TMSEffect*& tmsglobalgain)
       
    36 {
       
    37     gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY);
       
    38     QTMSGlobalGainEffectImpl* self = new QTMSGlobalGainEffectImpl();
       
    39     if (self) {
       
    40         ret = self->PostConstruct();
       
    41         if (ret != QTMS_RESULT_SUCCESS) {
       
    42             delete self;
       
    43             self = NULL;
       
    44         }
       
    45         self->iEffect = tmsglobalgain;
       
    46         ret = self->AddObserver(*self, NULL);
       
    47     }
       
    48     qglobalgain = self;
       
    49     return ret;
       
    50 }
       
    51 
       
    52 gint QTMSGlobalGainEffectImpl::PostConstruct()
       
    53 {
       
    54     gint ret(QTMS_RESULT_SUCCESS);
       
    55     return ret;
       
    56 }
       
    57 
       
    58 gint QTMSGlobalGainEffectImpl::AddObserver(TMS::TMSEffectObserver& obsrvr, gpointer user_data)
       
    59 {
       
    60     gint ret(QTMS_RESULT_SUCCESS);
       
    61 
       
    62     if (iEffect) {
       
    63         ret = static_cast<TMSGlobalGainEffect*> (iEffect)->AddObserver(obsrvr, user_data);
       
    64     }
       
    65     return ret;
       
    66 }
       
    67 
       
    68 gint QTMSGlobalGainEffectImpl::RemoveObserver(TMS::TMSEffectObserver& obsrvr)
       
    69 {
       
    70     gint ret(QTMS_RESULT_SUCCESS);
       
    71 
       
    72     if (iEffect) {
       
    73         ret = static_cast<TMSGlobalGainEffect*> (iEffect)->RemoveObserver(obsrvr);
       
    74     }
       
    75     return ret;
       
    76 }
       
    77 
       
    78 void QTMSGlobalGainEffectImpl::EffectsEvent(const TMS::TMSEffect& /*tmseffect*/,
       
    79     TMS::TMSSignalEvent event)
       
    80 {
       
    81     QTMSSignalEvent qevent;
       
    82 
       
    83     qevent.type = event.type;
       
    84     qevent.reason = event.reason;
       
    85     qevent.curr_state = event.curr_state;
       
    86     qevent.prev_state = event.prev_state;
       
    87     qevent.event_data = event.event_data;
       
    88     qevent.user_data = event.user_data;
       
    89 
       
    90     emit QTMS::QTMSGlobalGainEffect::EffectsEvent(static_cast<QTMSEffect&> (*this), qevent);
       
    91 }
       
    92 
       
    93 // End of file