WEB开发网
开发学院手机开发Symbian 开发 Symbian中音频API的运用 阅读

Symbian中音频API的运用

 2010-07-22 01:41:00 来源:WEB开发网   
核心提示:开始播放,这是个异步函数,Symbian中音频API的运用(2),当播放完成时会调用MMdaAudioToneObserver::MatoPlayComplete(TInt aError)方法, *//* iAudioToneUtility->CancelPlay(); // 我们也可以取消播放,CMdaAudi
开始播放。这是个异步函数,当播放完成时会调用MMdaAudioToneObserver::MatoPlayComplete(TInt aError)方法。 */

/* 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)

上一页  1 2 3 4 5 6 7  下一页

Tags:Symbian 音频 API

编辑录入:coldstar [复制链接] [打 印]
赞助商链接