qtms/src/qtmsglobalgaineffectimpl.cpp
changeset 27 cbb1bfb7ebfb
child 50 762d760dcfdf
equal deleted inserted replaced
25:d881023c13eb 27:cbb1bfb7ebfb
       
     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,
       
    36         TMS::TMSEffect*& tmsglobalgain)
       
    37     {
       
    38     gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY);
       
    39     QTMSGlobalGainEffectImpl* self = new QTMSGlobalGainEffectImpl();
       
    40     if (self)
       
    41         {
       
    42         ret = self->PostConstruct();
       
    43         if (ret != QTMS_RESULT_SUCCESS)
       
    44             {
       
    45             delete self;
       
    46             self = NULL;
       
    47             }
       
    48         self->iEffect = tmsglobalgain;
       
    49         ret = self->AddObserver(*self, NULL);
       
    50         }
       
    51     qglobalgain = self;
       
    52     return ret;
       
    53     }
       
    54 
       
    55 gint QTMSGlobalGainEffectImpl::PostConstruct()
       
    56     {
       
    57     gint ret(QTMS_RESULT_SUCCESS);
       
    58     return ret;
       
    59     }
       
    60 
       
    61 gint QTMSGlobalGainEffectImpl::AddObserver(TMS::TMSEffectObserver& obsrvr,
       
    62         gpointer user_data)
       
    63     {
       
    64     gint ret(QTMS_RESULT_SUCCESS);
       
    65 
       
    66     if (iEffect)
       
    67         {
       
    68         ret = static_cast<TMSGlobalGainEffect*> (iEffect)->AddObserver(obsrvr,
       
    69                 user_data);
       
    70         }
       
    71     return ret;
       
    72     }
       
    73 
       
    74 gint QTMSGlobalGainEffectImpl::RemoveObserver(TMS::TMSEffectObserver& obsrvr)
       
    75     {
       
    76     gint ret(QTMS_RESULT_SUCCESS);
       
    77 
       
    78     if (iEffect)
       
    79         {
       
    80         ret = static_cast<TMSGlobalGainEffect*> (iEffect)->RemoveObserver(
       
    81                 obsrvr);
       
    82         }
       
    83     return ret;
       
    84     }
       
    85 
       
    86 void QTMSGlobalGainEffectImpl::EffectsEvent(
       
    87         const TMS::TMSEffect& /*tmseffect*/, TMS::TMSSignalEvent event)
       
    88     {
       
    89     QTMSSignalEvent qevent;
       
    90 
       
    91     qevent.type = event.type;
       
    92     qevent.reason = event.reason;
       
    93     qevent.curr_state = event.curr_state;
       
    94     qevent.prev_state = event.prev_state;
       
    95     qevent.event_data = event.event_data;
       
    96     qevent.user_data = event.user_data;
       
    97 
       
    98     emit QTMS::QTMSGlobalGainEffect::EffectsEvent(
       
    99             static_cast<QTMSEffect&> (*this), qevent);
       
   100     }
       
   101 
       
   102 // End of file