examples/SFExamples/Quick_Recipes_on_Symbian_OS_Multimedia_Example_Code/AudioPlaying/src/AudioPlayingAppUi.cpp

00001 // 
00002 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
00003 // All rights reserved.
00004 // This component and the accompanying materials are made available
00005 // under the terms of the License "Eclipse Public License v1.0"
00006 // which accompanies this distribution, and is available
00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00008 // 
00009 // Initial Contributors:
00010 // Nokia Corporation - initial contribution.
00011 // 
00012 // Contributors:
00013 // 
00014 // Description:
00015 // 
00016 
00017 // INCLUDES
00018 #include <eikapp.h>
00019 #include <AudioPlaying.rsg>
00020 
00021 #include "AudioPlayingAppUi.h"
00022 #include "AudioPlayingMainView.h"
00023 #include "SimpleAudioPlayer.h"
00024 #include "AudioPlaying.hrh"
00025 
00026 // CONSTANTS
00027 _LIT(KFileName, "\\data\\sample.wav");
00028 
00029 // METHODS DEFINITION
00030 
00031 void CAudioPlayingAppUi::ConstructL()
00032         {
00033 
00034 
00035         BaseConstructL(EAknEnableSkin);
00036         
00037         iMainView = CAudioPlayingMainView::NewL(ClientRect());
00038 
00039         
00040         iAudioPlayer = CSimpleAudioPlayer::NewL();
00041         }
00042         
00043 CAudioPlayingAppUi::~CAudioPlayingAppUi()
00044     {
00045     delete iAudioPlayer;
00046     
00047 
00048     if (iMainView)
00049         {
00050         delete iMainView;
00051         iMainView = NULL;
00052         }
00053 
00054     }
00055 
00056 void CAudioPlayingAppUi::HandleCommandL(TInt aCommand)
00057         {
00058         switch ( aCommand )
00059                 {
00060 
00061                 case EAknSoftkeyExit:
00062 
00063                 case EEikCmdExit:
00064                         {
00065                         Exit();
00066                         break;
00067                         }
00068                 
00069                 case EAudioPlayingPlayFromFile:
00070                         {
00071                         // Construct file name.
00072                         // It adds drive letter to KFileName, where drive letter
00073                         // is the same as the application's executable.
00074                         TParsePtrC parseAppPath(Application()->AppFullName());
00075                         TParse parseFileName;
00076                         parseFileName.Set(parseAppPath.Drive(), 0, &KFileName);
00077                         
00078                         // Play the audio file.
00079                         iAudioPlayer->PlayL(parseFileName.FullName());
00080                         break;
00081                         }
00082                         
00083                 case EAudioPlayingPause:
00084                         {
00085                         iAudioPlayer->Pause();
00086                         break;
00087                         }
00088                         
00089                 case EAudioPlayingResume:
00090                         {
00091                         iAudioPlayer->Resume();
00092                         break;
00093                         }
00094                         
00095                 case EAudioPlayingStop:
00096                         {
00097                         iAudioPlayer->Stop();
00098                         break;
00099                         }
00100                         
00101                 case EAudioPlayingRewind:
00102                         {
00103                         iAudioPlayer->Rewind(5);
00104                         break;
00105                         }
00106                         
00107                 case EAudioPlayingFastForward:
00108                         {
00109                         iAudioPlayer->FastForward(5);
00110                         break;
00111                         }
00112                 
00113                 default:
00114                         // Do nothing
00115                         break;
00116                 }
00117         }
00118 
00119         
00120 
00121 
00122 // --------------------------------------------------------------------------
00123 // Handles screen resolution/size changes.
00124 // --------------------------------------------------------------------------
00125 void CAudioPlayingAppUi::HandleResourceChangeL(TInt aType)
00126         {
00127         CAknAppUi::HandleResourceChangeL(aType);
00128         iMainView->SetRect(ClientRect());
00129         }
00130 
00131 
00132         
00133 // End of File

Generated by  doxygen 1.6.2