Nokia N97 SDK
Example Applications Guide

AudioStreamAppUi.cpp

00001 /*
00002 * ==============================================================================
00003 *  Name        : AudioStreamAppUi.cpp
00004 *  Part of     : AudioStream
00005 *  Created     : April 28, 2006 by Forum Nokia
00006 *  Description : 
00007 *  Version     : 2.0
00008 *
00009 *  Copyright (c) 2006 - 2007 Nokia Corporation.
00010 *  This material, including documentation and any related
00011 *  computer programs, is protected by copyright controlled by
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 // INCLUDE FILES
00017 #include <avkon.hrh>
00018 #include <eikmenup.h>
00019 
00020 #include "AudioStreamAppUi.h"
00021 #include "AudioStreamView.h" 
00022 #include <AudioStream.rsg>
00023 #include "AudioStream.hrh"
00024 
00025 #include "AudioStreamEngine.h"
00026 
00027 
00028 // ----------------------------------------------------------------------------
00029 // CAudioStreamAppUi::ConstructL()
00030 //
00031 // standard EPOC 2nd phase constructor
00032 // ----------------------------------------------------------------------------
00033 void CAudioStreamAppUi::ConstructL()
00034     {
00035         BaseConstructL(EAknEnableSkin);
00036         iEngine = CAudioStreamEngine::NewL( this );     
00037         // pass the handle of CAudioStreamEngine to CAudioStreamView so the 
00038         // view can use the engine
00039         iView = CAudioStreamView::NewL(ClientRect(), iEngine);
00040         iView->SetMopParent( this );
00041         // add view to control stack
00042         AddToStackL( iView );   
00043     }
00044 
00045 // ----------------------------------------------------------------------------
00046 // CAudioStreamAppUi::~CAudioStreamAppUi()
00047 //
00048 // destructor
00049 // ----------------------------------------------------------------------------
00050 CAudioStreamAppUi::~CAudioStreamAppUi()
00051         {
00052     // remove view from control stack
00053     RemoveFromStack( iView );
00054     delete iView;
00055         iView=NULL;
00056         
00057         delete iEngine;
00058         iEngine=NULL;
00059         }
00060 
00061 // ----------------------------------------------------------------------------
00062 // CAudioStreamAppUi::DynInitMenuPaneL(TInt aResourceId,
00063 //         CEikMenuPane* aMenuPane)
00064 //
00065 // this function is called by the EIKON framework just before it displays
00066 // a menu pane. Its default implementation is empty, and by overriding it,
00067 // the application can set the state of menu items dynamically according
00068 // to the state of application data.
00069 // ----------------------------------------------------------------------------
00070 void CAudioStreamAppUi::DynInitMenuPaneL(
00071     TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/)
00072     {
00073     }
00074 
00075 // ----------------------------------------------------------------------------
00076 // CAudioStreamAppUi::HandleKeyEventL(
00077 //     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
00078 //
00079 // takes care of key event handling
00080 // ----------------------------------------------------------------------------
00081 TKeyResponse CAudioStreamAppUi::HandleKeyEventL(
00082     const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
00083     {
00084     return EKeyWasNotConsumed;
00085     }
00086 
00087 // ----------------------------------------------------------------------------
00088 // CAudioStreamAppUi::HandleCommandL(TInt aCommand)
00089 //
00090 // takes care of command handling
00091 // ----------------------------------------------------------------------------
00092 void CAudioStreamAppUi::HandleCommandL(TInt aCommand)
00093     {
00094     switch ( aCommand )
00095         {
00096         case EAknSoftkeyBack:
00097         case EEikCmdExit:
00098             {
00099             Exit();
00100             break;
00101             }
00102         case EAudioStreamCmdPlay:
00103             {
00104             iEngine->Play();
00105             break;
00106             }
00107         case EAudioStreamCmdRecord:
00108             {
00109             iEngine->Record();
00110             break;
00111             }
00112         case EAudioStreamCmdStop:
00113             {
00114             iEngine->Stop();
00115             break;
00116             }
00117         case EAudioStreamCmdLoad:
00118             {
00119             iEngine->LoadAudioFileL();
00120             break;
00121             }
00122         case EAudioStreamCmdSave:
00123             {
00124             iEngine->SaveAudioFileL();
00125             break;
00126             }
00127         case EAudioStreamCmdPcm:
00128             {
00129             iEngine->SetEncodingL(EFalse);
00130             break;
00131             }
00132         case EAudioStreamCmdAmr:
00133             {
00134             iEngine->SetEncodingL(ETrue);
00135             break;
00136             }
00137         default:
00138             break;      
00139         }
00140     }
00141 
00142 
00143 // ----------------------------------------------------------------------------
00144 // CAudioStreamView* CAudioStreamAppUi::GetView()
00145 //
00146 // returns a reference to application view
00147 // ----------------------------------------------------------------------------
00148 CAudioStreamView* CAudioStreamAppUi::GetView() const
00149 {
00150         return iView;
00151 }
00152 
00153 
00154 // End of File  
00155 

© Nokia 2009

Back to top