convergedcallengine/csplugin/src/cspdevsound.cpp
branchRCL_3
changeset 20 987c9837762f
parent 0 ff3b6d0fd310
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Wrapper for CMMFDevSound
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "cspdevsound.h"
       
    20 #include "csplogger.h"
       
    21 #include "mcspdevsoundobserver.h"
       
    22 
       
    23 #include <AudioPreference.h>
       
    24 #include <S60FourCC.h>
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CSPDevSound
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CSPDevSound::CSPDevSound( MCSPDevSoundObserver& aObserver ) : 
       
    33     iObserver( aObserver )
       
    34     {
       
    35     }
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // ConstructL
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 void CSPDevSound::ConstructL( 
       
    42     TMMFState aMode, 
       
    43     TUint aAudioPreference,
       
    44     TUint aAudioPriority )
       
    45     {
       
    46     CSPLOGSTRING( CSPINT, "CSPDevSound::ConstructL; Entry" );
       
    47 
       
    48     TFourCC modemFourCC;
       
    49     modemFourCC.Set(KS60FourCCCodeModem);
       
    50 
       
    51     iDevSound = CMMFDevSound::NewL();
       
    52 #ifndef __WINSCW__
       
    53     iDevSound->InitializeL( *this, modemFourCC, aMode  );   
       
    54 #endif
       
    55     iPrioritySettings.iPriority = aAudioPriority;
       
    56     iPrioritySettings.iPref = 
       
    57         static_cast<TMdaPriorityPreference>( aAudioPreference );
       
    58     iPrioritySettings.iState = aMode;    
       
    59     CSPLOGSTRING( CSPINT, "CSPDevSound::ConstructL; Exit" );
       
    60     }
       
    61     
       
    62 // ---------------------------------------------------------------------------
       
    63 // From class MDevSoundObserver
       
    64 // Not implemented
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 CSPDevSound::~CSPDevSound()
       
    68     {
       
    69     delete iDevSound;
       
    70     }
       
    71     
       
    72 // ---------------------------------------------------------------------------
       
    73 // Tries to activate the audio stream if not active or activating
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 void CSPDevSound::Activate() 
       
    77     {
       
    78     CSPLOGSTRING( CSPINT, "CSPDevSound::Activate" );
       
    79     if( !IsActive() && !IsActivationOngoing() )
       
    80         {
       
    81         iActivationOngoing = ETrue;
       
    82         TInt err = KErrNone; 
       
    83         TRAP( err, DoActivateL() );
       
    84         CSPLOGSTRING2( CSPINT, "CSPDevSound::Activate %d", err );
       
    85         }
       
    86     }
       
    87     
       
    88 // ---------------------------------------------------------------------------
       
    89 // Deactivates the audio device.
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 void CSPDevSound::Deactivate()
       
    93     {
       
    94     CSPLOGSTRING( CSPINT, "CSPDevSound::Deactivate" );
       
    95     if( IsActive() || IsActivationOngoing() )
       
    96         {
       
    97     	CSPLOGSTRING( CSPINT, "CSPDevSound::Deactivate Stopping" );
       
    98         iDevSound->Stop();
       
    99         iActive = EFalse;
       
   100         iActivationOngoing = EFalse;
       
   101         }
       
   102     }
       
   103     
       
   104 // ---------------------------------------------------------------------------
       
   105 // ActivationOngoing
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 TBool CSPDevSound::IsActivationOngoing() const 
       
   109     {
       
   110     return iActivationOngoing;
       
   111     }
       
   112     
       
   113 // ---------------------------------------------------------------------------
       
   114 // IsActive
       
   115 // ---------------------------------------------------------------------------
       
   116 //
       
   117 TBool CSPDevSound::IsActive() const
       
   118     {
       
   119     return iActive;
       
   120     }
       
   121     
       
   122 CMMFDevSound& CSPDevSound::DevSound()
       
   123     {
       
   124     return *iDevSound;
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // From class MDevSoundObserver
       
   129 // Not implemented
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 void CSPDevSound::InitializeComplete( TInt aError ) 
       
   133     {
       
   134     CSPLOGSTRING( CSPINT, "CSPDevSound::InitializeComplete" );
       
   135     if( aError == KErrNone )
       
   136         {
       
   137         iDevSound->SetPrioritySettings( iPrioritySettings );   
       
   138             
       
   139         }
       
   140         
       
   141     }
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // From class MDevSoundObserver
       
   145 // Not implemented
       
   146 // ---------------------------------------------------------------------------
       
   147 //
       
   148 void CSPDevSound::BufferToBeFilled( CMMFBuffer* /*aBuffer*/ )
       
   149     {
       
   150     }
       
   151 
       
   152 // ---------------------------------------------------------------------------
       
   153 // From class MDevSoundObserver
       
   154 // Not implemented
       
   155 // ---------------------------------------------------------------------------
       
   156 //
       
   157 void CSPDevSound::PlayError( TInt /*aError*/ )
       
   158     {
       
   159     }
       
   160 
       
   161 // ---------------------------------------------------------------------------
       
   162 // From class MDevSoundObserver
       
   163 // Not implemented
       
   164 // ---------------------------------------------------------------------------
       
   165 //
       
   166 void CSPDevSound::ToneFinished( TInt /*aError*/ )
       
   167     {
       
   168     }
       
   169 
       
   170 // ---------------------------------------------------------------------------
       
   171 // From class MDevSoundObserver
       
   172 // Not implemented
       
   173 // ---------------------------------------------------------------------------
       
   174 //
       
   175 void CSPDevSound::BufferToBeEmptied( CMMFBuffer* /*aBuffer*/ )
       
   176     {
       
   177     }
       
   178 
       
   179 // ---------------------------------------------------------------------------
       
   180 // From class MDevSoundObserver
       
   181 // Not implemented
       
   182 // ---------------------------------------------------------------------------
       
   183 //
       
   184 void CSPDevSound::RecordError( TInt /*aError*/ )
       
   185     {
       
   186     }
       
   187 
       
   188 // ---------------------------------------------------------------------------
       
   189 // From class MDevSoundObserver
       
   190 // Not implemented
       
   191 // ---------------------------------------------------------------------------
       
   192 //
       
   193 void CSPDevSound::ConvertError( TInt /*aError*/ )
       
   194     {
       
   195     }
       
   196 
       
   197 // ---------------------------------------------------------------------------
       
   198 // From class MDevSoundObserver
       
   199 // Not implemented
       
   200 // ---------------------------------------------------------------------------
       
   201 //
       
   202 void CSPDevSound::DeviceMessage( 
       
   203     TUid /*aMessageType*/, 
       
   204     const TDesC8& /*aMsg*/ )
       
   205     {
       
   206     }
       
   207  
       
   208 //  End of File
       
   209