CMdaAudioPlayerUtility panic 1 on P800??
| Mon, 2005-07-04 11:10 | |
|
Hi
I am playing sound using a wav file as described in the NEWLC article ttp://www.newlc.com/article.php3?id_article=38.I am successful in playing sound in N9300.But it is not working in case of P800 ,my application crashes giving 1 PANIC. Given that 1 panic is raised by the function play()/SetVolume() in the CMdaAudioPlayerUtility class when if the audio player utility is not initialised.But I did initialise it properly and is working fine in N9300 . For N9300 i used the filepathname as "Z:\\system\\ringing_tones\\attraction.mid" where the inbult ringtones r stored for N9300 and its working fine there. For P800, used the DeafultSounds folder on the device "c:\system\data\DefaultSounds\alarm.wav".I tried using mid file also.Nothing works..What might be the problem ...... Below is the code snippet for the same... in OkToExitL() fn case EDynamicPrefPlay: { if((iPlayCtrl->State()) == CEikCheckBox::EClear) { //TFileName iRingTone=_L("c:\\documents\\Media files\\audio\\unfiled\\canyon.mid"); TFileName iRingTone=_L("c:\\system\\data\\DefaultSounds\\alarm.wav"); User::InfoPrint(iRingTone); if(iAppUi.iPlayerAdapter) {delete iAppUi.iPlayerAdapter;iAppUi.iPlayerAdapter =NULL;} //iAppUi.IsAudioAlarmActiveFlag=EFalse; User::InfoPrint(_L("Play0")); iAppUi.iPlayerAdapter = CPlayerAdapter::NewL(iRingTone,iAppUi); User::InfoPrint(_L("Play01")); iAppUi.iAudioAdapter= iAppUi.iPlayerAdapter; iAppUi.IsAudioAlarmActiveFlag=ETrue; User::InfoPrint(_L("Play002")); iAppUi.iAudioAdapter->SetVolume(iAppUi.iAudioAdapter->MaxVolume()); User::InfoPrint(_L("Play0003")); iAppUi.iAudioAdapter->PlayL(); User::InfoPrint(_L("Play00004")); } break; //Implementation of Cplayeradapter //class CPlayerAdapter : public CBase, public MAudioAdapter, public MMdaAudioPlayerCallback #include "playeradapter.h" #include "Simple.h" CPlayerAdapter::CPlayerAdapter(CSimpleAppUi& aAppUi) : iState(ENotReady), iAppUi(aAppUi) { } CPlayerAdapter* CPlayerAdapter::NewL(const TDesC& aFileName, CSimpleAppUi& aAppUi) { CPlayerAdapter* self = NewLC(aFileName, aAppUi); CleanupStack::Pop(self); return self; } CPlayerAdapter* CPlayerAdapter::NewLC(const TDesC& aFileName, CSimpleAppUi& aAppUi) { CPlayerAdapter* self = new (ELeave) CPlayerAdapter(aAppUi); CleanupStack::PushL(self); self->ConstructL(aFileName); return self; } void CPlayerAdapter::ConstructL(const TDesC& aFileName) { iMdaAudioPlayerUtility = CMdaAudioPlayerUtility::NewFilePlayerL(aFileName,*this); } CPlayerAdapter::~CPlayerAdapter() { delete iMdaAudioPlayerUtility; iMdaAudioPlayerUtility = NULL; } // Note that this implementation of the virtual function does not leave. TInt CPlayerAdapter::MaxVolume() { return iMdaAudioPlayerUtility->MaxVolume(); } void CPlayerAdapter::SetVolume(TInt aVolume) { iMdaAudioPlayerUtility->SetVolume(aVolume); } void CPlayerAdapter::PlayL() { //added if check if(iState==EReadyToPlay) { iMdaAudioPlayerUtility->Play(); iState = EPlaying; } } // CMdaAudioPlayerUtility is not able to record void CPlayerAdapter::RecordL() { } // Note that this implementation of the virtual function does not leave. void CPlayerAdapter::StopL() { iMdaAudioPlayerUtility->Stop(); iState = EReadyToPlay; } // from MMdaAudioPlayerCallback void CPlayerAdapter::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/) { iState = aError ? ENotReady : EReadyToPlay; TBuf8<10> buf; buf.AppendNum(iState); User::InfoPrint(buf); } void CPlayerAdapter::MapcPlayComplete(TInt aError) { iState = aError ? ENotReady : EReadyToPlay; } thanks in advance |
|





