×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    22

    Unhappy Play wav file with symbian c++ problem

    Sorry, My English level language not good.
    I have a project play wav with symbian c++, When debug it not error, but when it run, i don't listen sound. Help me, please!
    AudioPlayer:
    #ifndef AUDIOPLAYER_H_
    #define AUDIOPLAYER_H_
    // INCLUDES
    #include <coecntrl.h>
    #include <e32std.h>

    #include <MdaAudioSamplePlayer.h>
    // CLASS DECLARATION
    class CAudioPlayer : public CBase,public MMdaAudioPlayerCallback
    {
    public:
    static CAudioPlayer* NewL(const TDesC& aFileName);
    static CAudioPlayer* NewLC(const TDesC& aFileName);
    ~CAudioPlayer();
    private:
    CAudioPlayer();
    void ConstructL(const TDesC& aFileName);
    public:
    void Play();
    void Stop();
    void Pause();
    TBool checkPlaying();

    public: // from MMdaAudioToneObserver
    void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
    void MapcPlayComplete(TInt aError);
    private:
    CMdaAudioPlayerUtility* iPlayer;
    TBool iPlaying,iStop;
    TFileName iFileName;
    };

    #endif /* AUDIOPLAYER_H_ */
    AudioPlayer.cpp
    #include "AudioPlayer.h"
    #include <MdaAudioTonePlayer.h>

    #include <eikmenup.h>

    CAudioPlayer* CAudioPlayer::NewL(const TDesC& aFileName)
    {

    CAudioPlayer* self = NewLC(aFileName);
    CleanupStack::Pop(self);
    return self;

    }
    CAudioPlayer* CAudioPlayer::NewLC(const TDesC& aFileName)
    {
    CAudioPlayer* self = new (ELeave) CAudioPlayer();
    CleanupStack::PushL(self);
    self->ConstructL(aFileName);
    return self;
    }

    CAudioPlayer::CAudioPlayer()
    {

    }
    CAudioPlayer::~CAudioPlayer()
    {
    if(iPlayer)
    {
    iPlayer->Stop();
    iPlayer->Close();
    }
    delete iPlayer;
    }
    void CAudioPlayer::ConstructL(const TDesC& aFileName)
    {
    iFileName.Copy(aFileName);
    if(iFileName.Length()>0)
    {
    iPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(aFileName,*this,EMdaPriorityMax);
    iPlaying=iStop=EFalse;
    }


    // iPlayer->OpenFileL(aFileName);
    // iPlayer=CMdaAudioPlayerUtility::NewL(*this);
    // iPlayer->OpenFileL(aFileName);
    }
    void CAudioPlayer::Play()
    {
    iPlaying=ETrue;
    // //iPlayer->SetVolume(iPlayer->MaxVolume());

    iPlayer->Play();
    //
    //
    }
    TBool CAudioPlayer::checkPlaying()
    {
    if(iPlaying==TRUE)
    return ETrue;
    return EFalse;
    }
    void CAudioPlayer::Pause()
    {
    iPlayer->Pause();
    iPlaying=EFalse;
    }
    void CAudioPlayer::Stop()
    {
    iPlayer->Stop();
    iPlaying=EFalse;
    }

    void CAudioPlayer::MapcPlayComplete(TInt aError)
    {

    }
    void CAudioPlayer::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration)
    {
    if(!aError)
    {
    iStop=ETrue;
    iPlayer->SetVolume(iPlayer->MaxVolume());
    iPlayer->Play();
    }

    }
    And in file AppView.cpp, i call CAudioPlayer::NewL(aFileName); iPlayer->Play();
    void Cv1AudioAppView::ConstructL(const TRect& aRect)
    {
    // Create a window for this application view
    CreateWindowL();
    // Set the windows size
    SetRect(aRect);
    iPlayer=CAudioPlayer::NewL(SourceFile);
    iPlayer->Play();
    ActivateL();
    }
    This is link download my project:
    http://www.mediafire.com/?yidyt6a7p3a8vhl

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,671

    Re: Play wav file with symbian c++ problem

    You can find a really short example in #3 of http://discussion.forum.nokia.com/fo...-for-an-newbie

  3. #3
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,355

    Re: Play wav file with symbian c++ problem

    Quote Originally Posted by tamnv110 View Post
    Sorry, My English level language not good.
    I have a project play wav with symbian c++, When debug it not error, but when it run, i don't listen sound. Help me, please!
    AudioPlayer:


    AudioPlayer.cpp


    And in file AppView.cpp, i call CAudioPlayer::NewL(aFileName); iPlayer->Play();


    This is link download my project:
    http://www.mediafire.com/?yidyt6a7p3a8vhl
    Are you trying on device? because I have the same issue while playing wav file on emulator (broken sound) and for mp3 doesn't play.

  4. #4
    Registered User
    Join Date
    May 2011
    Posts
    22

    Re: Play wav file with symbian c++ problem

    Thank you, i trying on device.

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Play wav file with symbian c++ problem

    Can you debug and see what callbacks actually gets called, and whether any errors are indicated in there ?

Similar Threads

  1. Play wav file in resources with QMediaPlayerControl
    By daudrain in forum [Archived] Qt Mobility Project
    Replies: 1
    Last Post: 2010-08-18, 14:55
  2. Play .wav file
    By NMMA in forum Symbian Media (Closed)
    Replies: 26
    Last Post: 2010-05-18, 23:05
  3. Play .wav file
    By pavan.pareta in forum Symbian
    Replies: 2
    Last Post: 2009-03-28, 19:56
  4. how to play mp3 file and play long wav file
    By changsshuai in forum Symbian
    Replies: 6
    Last Post: 2008-09-02, 09:50
  5. How play wav in symbian?
    By diluo in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2005-09-16, 11:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×