Could someone tell me the simplest possible way to play a beep or a wav-sound.
Im using a Nokia 9210.
Simplest way to play a sound
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.
Can I find an example of this somewhere. I hate that documentation as there arent any examples 😞
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:\\system\\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.
Thanks a lot even if it is untested I will test it and well see if I can get a working example 😃
This was a good start for today !!