devsound/a3fdevsound/src/devsoundadaptor/cdevcommoncontrol.h
changeset 0 b8ed18f6c07b
equal deleted inserted replaced
-1:000000000000 0:b8ed18f6c07b
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CDEVCOMMONCONTROL_H
       
    19 #define CDEVCOMMONCONTROL_H
       
    20 
       
    21 #include "cdevaudiocontrol.h"
       
    22 #include <a3f/a3f_trace_utils.h>
       
    23 #include <a3f/maudioprocessingunitobserver.h>
       
    24 
       
    25 /**
       
    26  * CDevCommonControl
       
    27  *
       
    28  * Common functionality required by:
       
    29  *      CDevPlayControl
       
    30  *      CDevRecordControl
       
    31  *      CDevToneControl
       
    32  *
       
    33  * @lib mmfdevsoundadaptation.lib
       
    34  * @since
       
    35  */
       
    36 
       
    37 NONSHARABLE_CLASS(CDevCommonControl) :  public CDevAudioControl,  
       
    38                                         public MAudioProcessingUnitObserver
       
    39 	{
       
    40 public:
       
    41     CDevCommonControl();
       
    42     ~CDevCommonControl();
       
    43     
       
    44     // from CDevAudioControl
       
    45     TInt Stop();
       
    46     TInt Pause();
       
    47     TInt Resume();
       
    48     
       
    49     // from MAudioProcessingUnitObserver
       
    50     void StateEvent(MAudioStream& aStream, TInt aError, TAudioState aNewState);
       
    51     void ProcessingUnitError(MAudioProcessingUnit* aInstance, TInt aError);
       
    52     
       
    53     // from MAudioContextObserver
       
    54     void ContextEvent(TUid aEvent, TInt aError);
       
    55     
       
    56 protected:
       
    57     // methods introduced by this class
       
    58     virtual void FinishWithError(TInt aError) = 0;
       
    59     
       
    60 private:
       
    61     //  Internal functions which together implement CDevCommonControl::ContextEvent
       
    62     void ContextEventUpdateWithoutStateEventNoError();
       
    63     void ContextEventUpdateWithoutStateEventButWithError(TInt aError);
       
    64     void ContextEventUpdateWithStateEventNoError();
       
    65     void ContextEventStateDevSoundAdaptorLoading(); 
       
    66     void ContextEventStateDevSoundAdaptorUnloading(); 
       
    67     void ContextEventStateDevSoundAdaptorStopping();
       
    68     void ContextEventStateDevSoundAdaptorUninitializing();
       
    69     void ContextEventStateDevSoundAdaptorBeingPreempted();
       
    70     void ContextEventPauseResumeSequenceDueToEmptyBuffers(TBool aFlush);
       
    71     void ContextEventUpdateWithStateEventAndError(TInt aError);
       
    72     void ContextEventUpdateComplete(TInt aError);
       
    73     void ContextEventPreEmption(TUid aEvent, TInt aError);
       
    74     void ContextEventAbort(TInt aError);
       
    75     void ContextEventErrorStateDevSoundAdaptorActivating(TInt aError);
       
    76     void ContextEventErrorStateDevSoundAdaptorBeingPreempted();
       
    77     void ContextEventAsynchronousPlayCompletion(TInt aError);
       
    78     void ContextEventAsynchronousInitializeComplete(TInt aError);
       
    79     void ContextEventStopDevSoundNotifications();
       
    80     
       
    81 private:
       
    82     TBool iBeingPreempted;
       
    83     TBool iPreemptionClash;
       
    84 	};
       
    85 
       
    86 #endif // CDEVCOMMONCONTROL_H
       
    87 
       
    88 // end of file