2011-02-13 2 views
0

저는 Symbian을 처음 접하는 초보자입니다. 소리를 재생하는 데 문제가 있습니다. 수많은 예제를 살펴본 결과 오류가 발견되지 않습니다. 다른 이에 게 경험이 있습니까? 어떤 방향 으로든 도움이 될 것입니다. 다른 클래스의 타이머로 Play on을 호출합니다.Symbian S60에서 사운드 재생

헤더 : CPP

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(); 
}; 

: 여기

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(); 
} 

링크 포럼 게시물에 대한 최종 결과를 노키아 포럼

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(); 
} 

답변