javauis/amms_qt/mmacontrol/src.emc/cammsemcbasemmfdevsound.cpp
changeset 23 98ccebc37403
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Group for effect controls
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <logger.h>
       
    21 #include "cammsemcbasemmfdevsound.h"
       
    22 
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 // Constructors
       
    26 
       
    27 CAMMSEMCBaseMMFDevSound::CAMMSEMCBaseMMFDevSound()
       
    28 {
       
    29     LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound:: CAMMSEMCBaseMMFDevSound()");
       
    30 }
       
    31 
       
    32 // Destructor
       
    33 CAMMSEMCBaseMMFDevSound::~CAMMSEMCBaseMMFDevSound()
       
    34 {
       
    35     LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::~ +");
       
    36     if (iMMFDevSound)
       
    37     {
       
    38         delete iMMFDevSound;
       
    39         iMMFDevSound = NULL;
       
    40     }
       
    41 
       
    42     if (iActiveSchedulerWait)
       
    43     {
       
    44         delete iActiveSchedulerWait;
       
    45         iActiveSchedulerWait = NULL;
       
    46     }
       
    47     LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::~ -");
       
    48 }
       
    49 
       
    50 /******************************************************************************
       
    51 * Method Name:  CAMMSEMCBaseMMFDevSound::CreateAndInitializeDevSoundL()
       
    52 ******************************************************************************/
       
    53 TInt CAMMSEMCBaseMMFDevSound::CreateAndInitializeDevSoundL()
       
    54 {
       
    55     LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::CreateAndInitializeDevSoundL");
       
    56     TInt initError;
       
    57     if (iMMFDevSound)
       
    58     {
       
    59         delete iMMFDevSound;
       
    60         iMMFDevSound = NULL;
       
    61     }
       
    62     TRAP(initError, iMMFDevSound = CMMFDevSound::NewL());
       
    63     if (initError)
       
    64         return initError;
       
    65 
       
    66     TRAP(initError,iMMFDevSound->InitializeL(*this, EMMFStatePlaying));
       
    67 
       
    68     if (!initError)
       
    69     {
       
    70         __ASSERT_DEBUG(!iActiveSchedulerWait->IsStarted(), User::Invariant());
       
    71         // Wait until InitializeComplete() has been called.
       
    72         iActiveSchedulerWait->Start();  // CSI: 10 iActiveSchedulerWait cannot be started, also checked in debug build #
       
    73 
       
    74     }
       
    75 
       
    76     return initError;
       
    77 }
       
    78 
       
    79 /******************************************************************************
       
    80 * Method Name:  CAMMSEMCBaseMMFDevSound::DeleteDevSound()
       
    81 ******************************************************************************/
       
    82 void CAMMSEMCBaseMMFDevSound::DeleteDevSound()
       
    83 {
       
    84     LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::DeleteDevSound + ");
       
    85     if (iMMFDevSound)
       
    86     {
       
    87         delete iMMFDevSound;
       
    88         iMMFDevSound = NULL;
       
    89     }
       
    90     LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::DeleteDevSound - ");
       
    91 }
       
    92 
       
    93 /******************************************************************************
       
    94 ******************************** CALLBACK ************************************
       
    95 *******************************************************************************/
       
    96 
       
    97 /******************************************************************************
       
    98 * Method Name:  CAMMSEMCBaseMMFDevSound::InitializeComplete
       
    99 * Description:  CMMFDevSound callback when Initialization is complete
       
   100 ******************************************************************************/
       
   101 void CAMMSEMCBaseMMFDevSound::InitializeComplete(TInt aError)
       
   102 {
       
   103     ELOG1( EJavaAMMS, "AMMS::CAMMSEMCBaseMMFDevSound::InitializeComplete err = %d ",aError);
       
   104     // Just to suppress warning in release build
       
   105     (void)aError;
       
   106     __ASSERT_DEBUG(iActiveSchedulerWait->IsStarted(), User::Invariant());
       
   107     // Stop waiting in CreateAndInitializeDevSoundL() function.
       
   108     iActiveSchedulerWait->AsyncStop();
       
   109 
       
   110 }
       
   111 
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CAMMSEMCBaseMMFDevSound::ConstructL
       
   115 // Symbian 2nd phase constructor can leave.
       
   116 // (other items were commented in a header).
       
   117 // -----------------------------------------------------------------------------
       
   118 void CAMMSEMCBaseMMFDevSound::ConstructL()
       
   119 {
       
   120     LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCBaseMMFDevSound::ConstructL ");
       
   121     // create CActiveSchedulerWait
       
   122     iActiveSchedulerWait = new(ELeave)CActiveSchedulerWait;
       
   123 }
       
   124 
       
   125 //  End of File