Symbian中音频API的运用
2010-07-22 01:41:00 来源:WEB开发网/* iAudioToneUtility->CancelPlay(); // 我们也可以取消播放,这样的话观察器也接受不了MatoPlayComplete通知了 */
}
}
void CMyObserver::MatoPlayComplete(TInt aError)
{
if(aError != KErrNone)
{
iAudioToneUtility->CancelPlay();
}
else // 循环整个播放流程
{
//delete iAudioToneUtility;
//iAudioToneUtility = NULL;
iAudioToneUtility->PrepareToPlayTone(tone, /*aDuration*/1000000);
tone += 1000;
}
}
二. CMdaAudioPlayerUtility
播放音频数据,例如.wav和.midi
CMdaAudioPlayerUtility * iAudioPlayer = CMdaAudioPlayerUtility::NewL(MyObserver);
...
iAudioPlayer->OpenFileL(_L("c:\data\Ring.wav")); /* 载入音频数据。此方法为异步方法,载入完成会调用MyObserver.MapcInitComplete(aError, aDuration)方法 */
// 若数据已经放入描述符缓冲区则调用iAudioPlayer->OpenDesL(const TDesC8 &);
/* 经试验,直到S60 3rd FP1版本,CMdaAudioPlayerUtility::OpenUrlL()方法也不被支持,原文如下:
CMdaAudioPlayerUtility::OpenUrlL() is not supported in the S60 platform. This method does not leave, but KErrNotSupported (-5) is returned in MMdaAudioPlayerCallback::MapcInitComplete().
Solution:
http:// URLs are not supported. However, from S60 2nd Edition FP2 onwards OpenUrlL() from CVideoPlayerUtility can be used for opening rtsp:// URLs with RealAudio (audio-only) streams.
*/
/* 音频数据载入完成。注意有些方法需要在载入音频数据完成后调用才有意义,比如 iAudioPlayer->Duration() 等等 */
void CMyObserver::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration) // the aDuration equal to
{
if (aError == KErrNone)
更多精彩
赞助商链接