This example will show you how to play a hit tone. It's pretty simple:
Contents |
LIBRARY mediaclientaudio.lib
#include <coecntrl.h> #include <MdaAudioTonePlayer.h> // CLASS DECLARATION class CAppView : public CCoeControl, public MMdaAudioToneObserver { public: // New methods static CAppView* NewL(const TRect& aRect); static CAppView* NewLC(const TRect& aRect); virtual ~CAppView(); public: // Functions from base classes void Draw(const TRect& aRect) const; virtual void SizeChanged(); void PlayTone(); // From MdaAudioToneObserver void MatoPrepareComplete(TInt aError); void MatoPlayComplete(TInt aError); private: // Constructors void ConstructL(const TRect& aRect); private: //Data CMdaAudioToneUtility* iAudioToneUtility; };
#include <coemain.h> #include "AppView.h" void CAppView::ConstructL(const TRect& aRect) { iAudioToneUtility = CMdaAudioToneUtility::NewL (*this); // First argument (700) is the frequency //Second argument (1700) is the duration in micro seconds iAudioToneUtility->PrepareToPlayTone(700, 1700); // Sets the tone volume to max volume iAudioToneUtility->SetVolume(iAudioToneUtility->MaxVolume()); } CAppView::~CAppView() { delete iAudioToneUtility; } void CAppView::PlayTone() { TRAPD(error, iAudioToneUtility->Play()); } void CAppView::MatoPrepareComplete(TInt aError) { } void CAppView::MatoPlayComplete(TInt aError) { }
For more information, search the SDK Help for "tone utility".
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Nokia 22 PBC Con. Terminal | jamiegordon | Nokia M2M | 1 | 2002-12-03 05:51 |
| Sound in Java on 7210 | miraclemaker | Mobile Java Media (Graphics & Sounds) | 4 | 2003-10-30 19:29 |
| Inband tone | poupouNokiaForum | Symbian Networking & Messaging | 0 | 2008-08-20 12:49 |
| How to send a ring tone through SMS? | mosam99 | Smart Messaging | 0 | 2003-09-22 06:50 |
| AMR as ringtone n msg.tone | myfoxz | General Discussion | 0 | 2004-11-27 10:27 |