radioengine/utils/src/cradioroutableaudio.cpp
branchRCL_3
changeset 19 cce62ebc198e
equal deleted inserted replaced
18:1a6714c53019 19:cce62ebc198e
       
     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 // System includes
       
    19 #include <AudioOutput.h>
       
    20 
       
    21 // User includes
       
    22 #include "cradioroutableaudio.h"
       
    23 #include "cradioaudiorouter.h"
       
    24 #include "cradioenginelogger.h"
       
    25 
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 EXPORT_C CRadioRoutableAudio::CRadioRoutableAudio( CRadioAudioRouter* aAudioRouter )
       
    32     : iAudioRouter( aAudioRouter )
       
    33     {
       
    34     LEVEL3( LOG_METHOD_AUTO );
       
    35     iAudioRouter->RegisterRoutableAudio( this );
       
    36     }
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 EXPORT_C CRadioRoutableAudio::~CRadioRoutableAudio()
       
    43     {
       
    44     iAudioRouter->UnRegisterRoutableAudio( this );
       
    45     delete iAudioOutput;
       
    46     delete iAudioRouter;
       
    47     }
       
    48 
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 EXPORT_C void CRadioRoutableAudio::SetAudioOutput( CAudioOutput* aAudioOutput )
       
    55     {
       
    56     LEVEL3( LOG_METHOD_AUTO );
       
    57     delete iAudioOutput;
       
    58     iAudioOutput = aAudioOutput;
       
    59     }
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 EXPORT_C void CRadioRoutableAudio::DeleteAudioOutput()
       
    66     {
       
    67     LEVEL3( LOG_METHOD_AUTO );
       
    68     delete iAudioOutput;
       
    69     iAudioOutput = NULL;
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 EXPORT_C void CRadioRoutableAudio::SetAudioRouteL( RadioEngine::TRadioAudioRoute aRoute )
       
    77     {
       
    78     LEVEL3( LOG_METHOD_AUTO );
       
    79     if ( iAudioOutput )
       
    80         {
       
    81         iAudioOutput->SetAudioOutputL( aRoute == RadioEngine::ERadioSpeaker ? CAudioOutput::EPublic
       
    82                                                                             : CAudioOutput::EPrivate );
       
    83         }
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 EXPORT_C TBool CRadioRoutableAudio::AudioRoutingSupported() const
       
    91     {
       
    92     LEVEL3( LOG_METHOD_AUTO );
       
    93 #ifdef __WINS__
       
    94     return ETrue;
       
    95 #else
       
    96     return iAudioOutput ? ETrue : EFalse;
       
    97 #endif
       
    98     }