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