×

Discussion Board

Results 1 to 3 of 3

Thread: Playing Audio

  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    128

    RE: Playing Audio

    You must implement the MapcInitComplete() function in MMdaAudioPlayerCallback!
    So you can not call the play() function in the appUI, you must call the play function in the MapcInitComplete() function which implemented by youselef!
    Think this will be help for you!
    Any questions more, Please let me know!

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    128

    RE: Playing Audio

    class CHMMMdaAudioPlayerCallback : public MMdaAudioPlayerCallback
    {
    public:
    CHMMMdaAudioPlayerCallback( const TDesC & aFile );
    ~CHMMMdaAudioPlayerCallback();
    protected:
    void MapcInitComplete( TInt aError, const TTimeIntervalMicroSeconds& aDuration );
    void MapcPlayComplete( TInt aError );

    public:
    CMdaAudioPlayerUtility * iMdaAudioPlayerUtility;
    };
    CHMMMdaAudioPlayerCallback::CHMMMdaAudioPlayerCallback( const TDesC & aFile )
    {
    iMdaAudioPlayerUtility = CMdaAudioPlayerUtility::NewFilePlayerL( aFile, * this );
    };
    void CHMMMdaAudioPlayerCallback::MapcInitComplete( TInt aError, const TTimeIntervalMicroSeconds& aDuration )
    {
    iMdaAudioPlayerUtility->Play();
    iMdaAudioPlayerUtility->SetVolume( iMdaAudioPlayerUtility->MaxVolume()/6 );
    };
    void CHMMMdaAudioPlayerCallback::MapcPlayComplete( TInt aError )
    {
    iMdaAudioPlayerUtility->Stop();
    if( iMdaAudioPlayerUtility )
    {
    delete iMdaAudioPlayerUtility;
    iMdaAudioPlayerUtility = NULL;
    }
    };

    You just need call like this:
    CHMMMdaAudioPlayerCallback * pAudioPlayer = new CHMMMdaAudioPlayerCallback( _L( "C:\\SYSTEM\\APPS\\HOSTMIND\\RES\\pclientstart.wav" ) );

    Any questions more. Please let me know!
    THX:_)

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    1

    Playing Audio

    I am trying to play a .wav audio file using the CMdaAudioPlayerUtility. I am following the example/snippet in book "Programming for the Series 60 PLatform" i.e. I have a class
    CHSAudioPlayer that implements MMdaAudioPlayerCallback. The constructor looks like this:
    CHSAudioPlayer::CHSAudioPlayer(const TDesC& audioFileName)
    {
    aInitStatus = KErrNotReady;
    //aInitStatus = KErrNone;
    iPlayer = CMdaAudioPlayerUtility::NewFilePlayerL( audioFileName, *this );
    }

    I also have the MapcInitComplete and MapcPlayComplete methods implemented.

    In my AppUI I am trying to do something like this:
    _LIT(KAuFileName, "c:\\MyProjects\\Hello\\jam1.wav");
    answer.Append(KAuFileName);
    CHSAudioPlayer* aAuPlayer = new CHSAudioPlayer(answer);
    aAuPlayer->Play();

    But I end up getting a System Error soon as the new CHSAudioPlayer(answer); is called. It never hits the MapcInitComplete method with an error code. Seems like I am doing something fundamentally wrong and so I dont even hit the MapcInitComplete method. I am not sure if :
    (a) the file path is wrong
    (b) the way I am implementing this is wrong
    (c) the file format is wrong (I've tried .au and .wav files (I've even tried recording my own .wav audio clips in 8 bit PCM, 8 bit A-Law and 8 bit IMA ADPCM formats but I get the same result)
    (d) something else is being overlooked

    I have already researched this forum for this subject and have not been able to find a previous answer.

    I've downloaded the Audio Streaming Plugin and copied the files per the Readme file's instructions but that hasn't helped either.

    I'd really appreciate any help/input in this regard. Thanks in advance.

Posting Permissions

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