×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    44

    Question how to use CMdaAudioPlayerUtility to Play sounds

    Dear all,

    Recently I develop the test program to sounds.
    I develop the code of playing sounds according to the example "sounds" using CMdaAudioPlayerUtility.
    when I compile and build in the SDK 3rd emulator, it can work and play the "alarm.aac" audio file.
    but when I compile and build in the SDK 3rd FP2 emulator, it can not play the same audio file and there are not any errors also.

    Any one meet the same questions with me and How to solve??

    Thanks !!
    following is the code:
    #include "SoundPlayer.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;
    }

  2. #2
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: Question how to use CMdaAudioPlayerUtility to Play sounds


  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    44

    Re: Question how to use CMdaAudioPlayerUtility to Play sounds

    Quote Originally Posted by A.A.M. View Post
    Thanks very much,
    I have read the thread.
    I think "alarm.aac" is included in the SDK. So it should be play. also I install my application to the device. it also can not play. but when I open the device profile to set the ringing tone "profile>General>personalise>RingingTone" to select "alarm.aac" it can Play sound.

  4. #4
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: Question how to use CMdaAudioPlayerUtility to Play sounds

    You using hardcoded path to "alarm.aac" file? Try to copy any another audio file, for example "SomeFile.mp3", to <path_to_SDK>\Epoc32\winscw\c\ and then try to play file "C:\\SomeFile.mp3" with your application.

  5. #5
    Registered User
    Join Date
    Dec 2006
    Posts
    44

    Re: Question how to use CMdaAudioPlayerUtility to Play sounds

    Quote Originally Posted by A.A.M. View Post
    You using hardcoded path to "alarm.aac" file? Try to copy any another audio file, for example "SomeFile.mp3", to <path_to_SDK>\Epoc32\winscw\c\ and then try to play file "C:\\SomeFile.mp3" with your application.
    Thanks reply.
    I try to play MP3 file , I also copy the audio to "C\data\", and I also set the path .but it can not play in SDK 3rd emulator also.

  6. #6
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: Question how to use CMdaAudioPlayerUtility to Play sounds

    I try to play MP3 file , I also copy the audio to "C\data\", and I also set the path .but it can not play in SDK 3rd emulator also.
    Are you getting any errors?

    Also you can try this example from Wiki - Playing audio files
    I've tested it on 3rd FP1 and 5th ed. and all works correctly.

  7. #7
    Registered User
    Join Date
    Dec 2006
    Posts
    44

    Re: Question how to use CMdaAudioPlayerUtility to Play sounds

    Quote Originally Posted by A.A.M. View Post
    Are you getting any errors?

    Also you can try this example from Wiki - Playing audio files
    I've tested it on 3rd FP1 and 5th ed. and all works correctly.
    Yes, I put the code on the board. and I test it in SDK 3rd, and it work well. but I can not test it on 3rd FP1. I test it on 3rd FP2. it can not work.
    I ask some one said : may some SDKs including the audio codec, some SDKs may not include.

  8. #8
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: Question how to use CMdaAudioPlayerUtility to Play sounds

    I wouldn't be surprised - this is a configuration thing for S60. In most devices the codecs live on a separate DSP and the platform is configured for this by default. For the SDK it should be configured use "software" codecs. However, there may be some licensing issues involved... does Nokia pay a license fee for the codec for every SDK they ship? I doubt it...

    Basically, for audio stuff you should always test on the device.

    Mark

  9. #9
    Registered User
    Join Date
    Dec 2006
    Posts
    44

    Re: Question how to use CMdaAudioPlayerUtility to Play sounds

    Thanks every one who pays attention to my thread:


    In SDK 3rd FP2, I can not play the *.aac audio file, but can play *.AMR file. it work well.
    also in SDK 3rd, it can play *.AMR file.

    Sorcery-ltd is right. I also need to check the source code.

Similar Threads

  1. How to play the system sounds in an application...???
    By divyas in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2005-10-17, 12:11
  2. Replies: 0
    Last Post: 2003-12-29, 06:31
  3. Using Nokia UI API to play sounds
    By nunomorais in forum Mobile Java General
    Replies: 1
    Last Post: 2002-10-09, 06:51
  4. Replies: 1
    Last Post: 2002-09-28, 19:05
  5. Replies: 1
    Last Post: 2002-05-08, 16:37

Posting Permissions

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