Results 1 to 2 of 2

Thread: S60, garden and play sound with native functions

  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default S60, garden and play sound with native functions

    Hi,

    since garden doesn't support phonon or QSound yet, i had tried to use the native symbian classes for that: I failed disgraceful, and now I assess Qt even more.

    May someone could help me. Following is my current state of art after c&p various sample codes and snippets... All ends in the compiler message that
    /Symbian/Carbide/workspace/sound/csoundplayer.cpp:36: undefined reference to `CMdaAudioPlayerUtility::NewFilePlayerL(TDesC16 const&, MMdaAudioPlayerCallback&, int, TMdaPriorityPreference, CMdaServer*)' make[2]: *** [\S60\devices\S60_5th_Edition_SDK_v1.0\epoc32\relea se\gcce\udeb\sound.exe] Error 1
    is there a specific *.lib I have to add is the *.mmp?

    Qt Code:
    1. #ifndef AUDIOPLAYER_H_
    2. #define AUDIOPLAYER_H_
    3.  
    4. #include <e32std.h>
    5. #include <MdaAudioSamplePlayer.h>
    6.  
    7. class CPlayerUtility : public CBase, public MMdaAudioPlayerCallback
    8. {
    9. public:
    10. static CPlayerUtility* NewL(const TDesC& aFileName);
    11. static CPlayerUtility* NewLC(const TDesC& aFileName);
    12. ~CPlayerUtility();
    13. private:
    14. CPlayerUtility();
    15. void ConstructL(const TDesC& aFileName);
    16. public:
    17. void Play();
    18. void Stop();
    19. public:
    20. // from MMdaAudioToneObserver
    21. void MapcInitComplete(TInt aError,
    22. const TTimeIntervalMicroSeconds& aDuration);
    23. void MapcPlayComplete(TInt aError);
    24. private:
    25. CMdaAudioPlayerUtility* iPlayUtility;
    26. TBool iPlaying, iPrepared;
    27. };
    28.  
    29. #endif /* AUDIOPLAYER_H_ */
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. #include "CSoundPlayer.h"
    2. #include <MdaAudioSamplePlayer.h>
    3. #include <eikmenup.h>
    4.  
    5. CPlayerUtility* CPlayerUtility::NewL(const TDesC& aFileName)
    6. {
    7. CPlayerUtility* self = NewLC(aFileName);
    8. CleanupStack::Pop(self);
    9. return self;
    10. }
    11.  
    12. CPlayerUtility* CPlayerUtility::NewLC(const TDesC& aFileName)
    13. {
    14. CPlayerUtility* self = new (ELeave) CPlayerUtility();
    15. CleanupStack::PushL(self);
    16. self->ConstructL(aFileName);
    17. return self;
    18. }
    19.  
    20. CPlayerUtility::~CPlayerUtility()
    21. {
    22. if (iPlayUtility)
    23. {
    24. iPlayUtility->Stop();
    25. iPlayUtility->Close();
    26. }
    27. delete iPlayUtility;
    28. }
    29.  
    30. CPlayerUtility::CPlayerUtility()
    31. {
    32. }
    33.  
    34. void CPlayerUtility::ConstructL(const TDesC& aFileName)
    35. {
    36. iPlayUtility = CMdaAudioPlayerUtility::NewFilePlayerL(aFileName, *this,
    37. EMdaPriorityNormal);
    38. iPlaying = iPrepared = EFalse;
    39. }
    40.  
    41. void CPlayerUtility::Play()
    42. {
    43. iPlayUtility->Play();
    44. iPlaying = ETrue;
    45. }
    46.  
    47. void CPlayerUtility::Stop()
    48. {
    49. iPlayUtility->Stop();
    50. iPlaying = EFalse;
    51. }
    52.  
    53. void CPlayerUtility::MapcPlayComplete(TInt /*aError*/)
    54. {
    55. iPlaying = EFalse;
    56. }
    57.  
    58. void CPlayerUtility::MapcInitComplete(TInt aError,
    59. const TTimeIntervalMicroSeconds& /*aDuration*/)
    60. {
    61. if (aError == KErrNone)
    62. {
    63. iPrepared = ETrue;
    64. iPlayUtility->SetVolume(iPlayUtility->MaxVolume());
    65. }
    66. }
    To copy to clipboard, switch view to plain text mode 

    THANKS!

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: S60, garden and play sound with native functions

    One have to link against mediaclientaudio.lib. One step, but still no sound is audible...

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.