Results 1 to 6 of 6

Thread: Error Including Symbian C++ APIs

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2011
    Posts
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Angry Error Including Symbian C++ APIs

    Hi there,

    Recently, I'm developing a Symbian App using Qt.
    There is big problem driving me crazy :

    I'm Using Qt 4.7 and I wanna Use Text-to-Speech API of S60.
    Here is the code :

    ttsplayer.h :
    Qt Code:
    1. #ifndef __TTSPLAYER_H__
    2. #define __TTSPLAYER_H__
    3.  
    4. // Include Files
    5. #include <MdaAudioSamplePlayer.h>
    6. #include <e32base.h>
    7.  
    8. class CTtsPlayer : public CBase, public MMdaAudioPlayerCallback
    9. {
    10. public:
    11. // construction
    12. static CTtsPlayer* NewLC();
    13. ~CTtsPlayer();
    14. /** Simplified call'n'forget interface.
    15.   * Synchronous function
    16.   * @leave System-wide error codes. @see MMdaAudioPlayerCallback errors
    17.   */
    18. void PlayTextL( TDesC& aText );
    19. // From the observer interface
    20. public:
    21. virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration);
    22. virtual void MapcPlayComplete(TInt aError);
    23. private:
    24. void ConstructL();
    25. private:
    26. CMdaAudioPlayerUtility* iPlayer;
    27. TBool iPlaybackInProgress;
    28. CActiveSchedulerWait* iWaiter;
    29. // Playback error code
    30. TInt iErr;
    31. };
    32.  
    33.  
    34. #endif // __TTSPLAYER_H__
    35.  
    36. // End of file
    To copy to clipboard, switch view to plain text mode 

    ttsplayer.cpp :
    Qt Code:
    1. // Include Files
    2.  
    3. #include <e32base.h>
    4. #include <e32std.h>
    5. #include <e32def.h>
    6. #include "TtsPlayer.h"
    7.  
    8. // Prefix telling the audio utility that TTS should be used
    9. _LIT( KTtsPrefix, "(tts)" );
    10.  
    11. CTtsPlayer* CTtsPlayer::NewLC()
    12. {
    13. CTtsPlayer* self = new (ELeave) CTtsPlayer;
    14. CleanupStack::PushL( self );
    15. self->ConstructL();
    16. return self;
    17. }
    18.  
    19. CTtsPlayer::~CTtsPlayer()
    20. {
    21. delete iWaiter;
    22. delete iPlayer;
    23. }
    24.  
    25. void CTtsPlayer::ConstructL()
    26. {
    27. iPlayer = CMdaAudioPlayerUtility::NewL( *this );
    28. iWaiter = new (ELeave) CActiveSchedulerWait;
    29. }
    30.  
    31. void CTtsPlayer::PlayTextL( TDesC& aText )
    32. {
    33. __ASSERT_ALWAYS( iPlaybackInProgress == EFalse, User::Leave( KErrNotReady ) );
    34. HBufC8* playableText = HBufC8::NewLC( aText.Length() + KTtsPrefix().Length() );
    35. playableText->Des().Append( KTtsPrefix );
    36. playableText->Des().Append( aText );
    37. iPlayer->OpenDesL( *playableText );
    38. iPlaybackInProgress = ETrue;
    39. iWaiter->Start();
    40. // At this point playback is already completed or failed
    41. User::LeaveIfError( iErr );
    42. CleanupStack::PopAndDestroy( playableText );
    43. }
    44.  
    45. void CTtsPlayer::MapcInitComplete( TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/ )
    46. {
    47. iErr = aError;
    48. if( aError != KErrNone )
    49. {
    50. iPlaybackInProgress = EFalse;
    51. // Let the paused PlayTextL complete
    52. iWaiter->AsyncStop();
    53. }
    54. else
    55. {
    56. iPlayer->Play();
    57. }
    58. }
    59.  
    60. void CTtsPlayer::MapcPlayComplete( TInt aError )
    61. {
    62. iErr = aError;
    63. iPlaybackInProgress = EFalse;
    64. // Let the paused PlayTextL complete
    65. iWaiter->AsyncStop();
    66. }
    67. // End of file
    To copy to clipboard, switch view to plain text mode 

    and in the mainwindow.cpp I use this like this :
    Qt Code:
    1. CTtsPlayer* player = CTtsPlayer::NewLC();
    2. _LIT( KTextToSay, "All your voices are belong to us!" );
    3. TBuf<100> bTextToSay( KTextToSay );
    4.  
    5. TRAPD( err, player->PlayTextL( bTextToSay ) );
    6. if( err != KErrNone )
    7. {
    8. qDebug() << QString("TTS playback failed with [%1]").arg(err);
    9. }
    10. else
    11. {
    12. qDebug() << "TTS playback completed successfully" ;
    13. }
    14. CleanupStack::PopAndDestroy( player );
    To copy to clipboard, switch view to plain text mode 

    and I also added these files(ttsplayer.cpp,ttsplayer.h) to symbian in .pro file.
    But Now my problem is errors below :
    :-1: error: Recipe compile failed with exit code 1.
    :-1: error: The make-engine exited with errors.

    Please Help.
    Thanks in advance.
    Last edited by amir; 4th September 2011 at 08:28.

Similar Threads

  1. Error including <libnotify/notify.h>
    By Marwa Shams in forum Qt Programming
    Replies: 5
    Last Post: 7th August 2011, 12:24
  2. : error: [\NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\udeb\V ideo.exe] Error 1
    By ranjit.kadam in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 1st May 2011, 22:11
  3. Problem while using the S60 extension APIs and the Qt Mobility APIs
    By sudhir.linux in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 3rd January 2011, 12:48
  4. Replies: 0
    Last Post: 8th December 2010, 12:44
  5. Replies: 2
    Last Post: 24th July 2010, 09:41

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
  •  
Qt is a trademark of The Qt Company.