27-11-2002, 05:59 AM
Could someone tell me the simplest possible way to play a beep or a wav-sound.
Im using a Nokia 9210.
Im using a Nokia 9210.
|
View Full Version : Simplest way to play a sound 27-11-2002, 05:59 AM Could someone tell me the simplest possible way to play a beep or a wav-sound. Im using a Nokia 9210. Mental Blank 27-11-2002, 09:24 AM Unfortunately, there is no "simple" way of doing this, as far as I know. You need to use the Media Server to play the file. Check out the documentation for CMdaAudioPlayerUtility. There is also a User::Beep() function, but this doesn't seem to work on my 7650, as I recall. Mack 27-11-2002, 09:48 AM Can I find an example of this somewhere. I hate that documentation as there arent any examples :( Mental Blank 27-11-2002, 01:25 PM Try looking on Forum Nokia (www.forum.nokia.com). But a basic example (warning: untested!) would be... [code:1] class CMyClass : public CBase, public MMdaAudioPlayerCallback { public: void PlaySoundL(); virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); virtual void MapcPlayComplete(TInt aError); // ...other variables... private: CMdaAudioPlayerUtility* iAudioPlayer; }; void CMyClass::PlaySoundL() { iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(_L("c:\\sys tem\\data\\test.wav"), *this); } void CMyClass::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration) { iAudioPlayer->SetVolume(iAudioPlayer->MaxVolume()); iAudioPlayer->Play(); // action! } void CMyClass::MapcPlayComplete(TInt aError) { // ... do something ... } [/code:1] Hope this helps. Mack 28-11-2002, 07:55 AM Thanks a lot even if it is untested I will test it and well see if I can get a working example :D This was a good start for today !! |