gpt4 book ai didi

audio - 在Symbian S60中播放声音

转载 作者:行者123 更新时间:2023-12-03 01:04:00 25 4
gpt4 key购买 nike

我是Symbian的新手,无法播放声音。我看了很多例子,但找不到错误。其他人有经验吗?任何方向都将有所帮助。我用另一个类的计时器打来Play。

header :

class TonePlayer : public CBase, public MMdaAudioPlayerCallback
{
public:
static TonePlayer* NewL();
static TonePlayer* NewLC();
~TonePlayer();

void Play();
void Stop();

protected:
TonePlayer();

void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration);
void MapcPlayComplete(TInt aError);

private:
CMdaAudioPlayerUtility* m_pAudioPlayer;

void ConstructL();
};

cpp:
TonePlayer* TonePlayer::NewL()
{
TonePlayer* self = NewLC();
CleanupStack::Pop(self);
return self;
}

TonePlayer* TonePlayer::NewLC()
{
TonePlayer* self = new (ELeave) TonePlayer();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}

TonePlayer::TonePlayer()
{
}

TonePlayer::~TonePlayer()
{
delete m_pAudioPlayer;
m_pAudioPlayer = NULL;
}

void TonePlayer::ConstructL()
{
m_pAudioPlayer = CMdaAudioPlayerUtility::NewL(*this);
}

void TonePlayer::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration)
{
MProEngEngine* pProfileEngine = ProEngFactory::NewEngineLC();
MProEngProfile* pProfile = pProfileEngine->ActiveProfileL();
MProEngTones& oTones = pProfile->ProfileTones();

m_pAudioPlayer->OpenFileL(oTones.MessageAlertTone());
m_pAudioPlayer->SetVolume(m_pAudioPlayer->MaxVolume());

Play();

delete pProfileEngine;
}

void TonePlayer::MapcPlayComplete(TInt aError)
{
}

void TonePlayer::Play()
{
m_pAudioPlayer->Play();
}

void TonePlayer::Stop()
{
m_pAudioPlayer->Stop();
}

最佳答案

诺基亚论坛上的家伙帮助了我,这是最终结果

TonePlayer* TonePlayer::NewL()
{
TonePlayer* self = NewLC();
CleanupStack::Pop(self);
return self;
}

TonePlayer* TonePlayer::NewLC()
{
TonePlayer* self = new (ELeave) TonePlayer();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}

TonePlayer::TonePlayer()
{
}

TonePlayer::~TonePlayer()
{
delete m_pAudioPlayer;
m_pAudioPlayer = NULL;
}

void TonePlayer::ConstructL()
{
MProEngEngine* pProfileEngine = ProEngFactory::NewEngineLC();
MProEngProfile* pProfile = pProfileEngine->ActiveProfileLC();
MProEngTones& oTones = pProfile->ProfileTones();

m_pAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(oTones.MessageAlertTone(), *this);

CleanupStack::PopAndDestroy(2);
}

void TonePlayer::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration)
{
if( aError == KErrNone )
{
m_pAudioPlayer->SetVolume(m_pAudioPlayer->MaxVolume());
}
}

void TonePlayer::MapcPlayComplete(TInt aError)
{
}

void TonePlayer::Play()
{

m_pAudioPlayer->Play();
}

void TonePlayer::Stop()
{
m_pAudioPlayer->Stop();
}

链接到论坛帖子 http://discussion.forum.nokia.com/forum/showthread.php?219262-Playing-the-current-massage-tone&p=819083#post819083

关于audio - 在Symbian S60中播放声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4981801/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com