×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 27

Thread: Play .wav file

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    62

    Play .wav file

    I need to develop application that play audio from specific path.

    I use CSoundPlayer class that implemented as follow:

    Code:
    #include <MdaAudioSamplePlayer.h>

    CSoundPlayer* CSoundPlayer::NewL(const TDesC& aFile)
    {
    CSoundPlayer* self = NewLC(aFile);
    CleanupStack::Pop(self);
    return self;
    }


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

    CSoundPlayer::CSoundPlayer()
    {
    }


    CSoundPlayer::~CSoundPlayer()
    {
    delete iMdaPlayer;
    iMdaPlayer = NULL;
    }


    void CSoundPlayer::ConstructL(const TDesC& aFile)
    {
    //
    // Create a file audio player utility instance
    //
    iMdaPlayer=CMdaAudioPlayerUtility::NewFilePlayerL(aFile,*this);
    }



    void CSoundPlayer::Play()
    {
    if(iState==EReady)
    {
    iState=EPlaying;
    iMdaPlayer->Play();
    }
    }


    void CSoundPlayer::Stop()
    {
    if(iState==EPlaying)
    {
    iMdaPlayer->Stop();
    iState = EReady;
    }
    }


    // from MMdaAudioPlayerCallback
    void CSoundPlayer::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
    {
    iState = aError ? ENotReady : EReady;
    }


    void CSoundPlayer::MapcPlayComplete(TInt aError)
    {
    iState = aError ? ENotReady : EReady;
    }
    when I try to create object and use it like that:

    iSoundPlayer = CSoundPlayer::NewL(_L("E:\\OutputWaveFile\\wave.wav"));
    iSoundPlayer ->Play();

    the sound doesn't paly on emulator or device...

    I use carbide v2.0 and sdk 5th

    can anyone help me?

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: Play .wav file

    Can you try to set volume? and just to make sure if you have implemented MMdaAudioPlayerCallback?

    iPlayUtility->SetVolume(Vol);
    iPlayUtility->Play();

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    62

    Re: Play .wav file

    The problem still exist

    I add this function to my class:
    void CSoundPlayer::SetVolume(int value)
    {

    iMdaPlayer->SetVolume(value);

    }
    and call it as follow:

    iSoundPlayer->SetVolume(10);
    iSoundPlayer ->Play();

    but the player still doesn't work

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,691

    Re: Play .wav file

    Quote Originally Posted by NMMA View Post
    the sound doesn't paly on emulator or device...
    Would it play at all? Consider playing it via the File Manager.

  5. #5
    Registered User
    Join Date
    Apr 2010
    Posts
    62

    Re: Play .wav file

    I can play the file via file manager ..but not through my palyer

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,691

    Re: Play .wav file

    Have you checked your variables? Perhaps what actual aError-s do you get?
    Who and when calls CSoundPlayer::Play?

    An extremely simplified example is available in #3 of http://discussion.forum.nokia.com/fo...d.php?t=125891

  7. #7
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: Play .wav file

    Also check if your file is in E:
    Are you storing it to E:?

  8. #8
    Registered User
    Join Date
    Apr 2010
    Posts
    62

    Re: Play .wav file

    Yes..

    I try to run my application on 3rd Fp2 and it worked well

    so..what is the problem?

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,691

    Re: Play .wav file

    Check aError.
    An explicit panic can help you already
    Code:
    void CSoundPlayer::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
    {
    if(aError!=KErrNone)User::Panic(_L("MapcInitComplete"),aError);
    iState = aError ? ENotReady : EReady;
    }
    assuming that you have enabled the error messages (http://wiki.forum.nokia.com/index.ph...ded_panic_code), of course.

  10. #10
    Registered User
    Join Date
    Apr 2010
    Posts
    62

    Re: Play .wav file

    I cannot find "Extended panic code file" option..

    and when start emulator..tool-->preference disabled

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,691

    Re: Play .wav file

    If you have some problems with 'ECMT Manager', search for ecmt in the Wiki, and fix the configuration files.
    Otherwise you can manually create a file called errrd in epoc32\winscw\c\resource, it can be empty, or you can copy any file there and rename.

  12. #12
    Registered User
    Join Date
    Apr 2010
    Posts
    62

    Re: Play .wav file

    I found this msg in errrd file

    "ECHO is off"

  13. #13
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,691

    Re: Play .wav file

    The content of the file does not matter. However if the file exists, the error messages are going to be displayed in the emulator, when your application abruptly dies (that is what User::Panic causes).
    However if your application does not die, probably you have no error.
    You can check if MapcInitComplete gets invoked at all, if you remove the "if(aError!=KErrNone)" part, so User::Panic will always get invoked.

  14. #14
    Registered User
    Join Date
    Apr 2010
    Posts
    62

    Re: Play .wav file

    I tested this part of code

    "if(aError!=KErrNone)User::Panic(_L("MapcInitComplete"),aError)"

    and no error appear on emulator..the value of aError=0

  15. #15
    Registered User
    Join Date
    Apr 2010
    Posts
    62

    Re: Play .wav file

    Any suggestion ?

Similar Threads

  1. Regarding BMCONV
    By sanah007 in forum Symbian
    Replies: 2
    Last Post: 2009-05-26, 12:47
  2. Play .wav file
    By pavan.pareta in forum Symbian
    Replies: 2
    Last Post: 2009-03-28, 19:56
  3. Problem with GCCE build in Carbide.vs
    By raffaelbechara in forum Symbian
    Replies: 6
    Last Post: 2008-10-20, 16:06
  4. problem when importing from carbide c++ to vs 2003!
    By misfit.physics in forum Symbian Tools & SDKs
    Replies: 12
    Last Post: 2008-02-19, 09:45
  5. How to Play .wav File in Active Call in S60 2nd Edition?
    By Tanya in forum Symbian Media (Closed)
    Replies: 29
    Last Post: 2007-12-20, 08:53

Posting Permissions

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