1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __COESNDPY_H__
17 #define __COESNDPY_H__
21 class TBaSystemSoundType;
22 class CCoeSoundPlayerManager;
25 /** Utility class for simple sound playing.
27 Must be used in the same thread as an active UI Control Framework environment
30 This class plays the sound specified by a TBaSystemSoundType object. The
31 caller can request the sound to be repeated, and the time between repeats.
32 If the exact sound cannot be found on a particular device, a match only by
33 category (first UID) is used. No sound will play if a match is not found.
40 enum { ENoRepeat=1, ERepeatForever=KMaxTInt};
42 inline static void PlaySound(const TBaSystemSoundType& aType);
43 inline static void PlaySound(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap);
44 inline static void PlaySoundNow(const TBaSystemSoundType& aType);
45 inline static void PlaySoundNow(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap);
46 IMPORT_C static void CancelSound(const TBaSystemSoundType& aType);
48 IMPORT_C static void PlaySound(const TBaSystemSoundType& aType,TInt aPlayCount,
49 TTimeIntervalMicroSeconds32 aGap,TBool aInterrupt);
50 static CCoeSoundPlayerManager* ManagerL();
57 /** Plays the specified sound.
59 This function only interrupts another, currently playing, sound if the new
60 sound has a higher priority than the currently playing sound. If you wish
61 to interrupt any currently playing sound and play a new one, use PlaySoundNow()
62 instead of PlaySound().
64 @param aType The sound to play.*/
65 inline void CoeSoundPlayer::PlaySound(const TBaSystemSoundType& aType)
66 {CoeSoundPlayer::PlaySound(aType,ENoRepeat,TTimeIntervalMicroSeconds32(0),EFalse);}
68 /** Plays the specified sound for the specifed number of times with the specified
71 This function only interrupts another, currently playing, sound if the new sound
72 has a higher priority than the current one. If you wish to interrupt
73 any currently playing sound and play a new one, use PlaySoundNow() instead of PlaySound().
75 @param aType The sound to play.
76 @param aPlayCount The number of times the sound is played.
77 @param aGap The interval in microseconds between each time the sound is played. */
78 inline void CoeSoundPlayer::PlaySound(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap)
79 {CoeSoundPlayer::PlaySound(aType,aPlayCount,aGap,EFalse);}
81 /** Plays the specified sound, interrupting any other sound that is currently playing.
83 @param aType The sound to play. */
84 inline void CoeSoundPlayer::PlaySoundNow(const TBaSystemSoundType& aType)
85 {CoeSoundPlayer::PlaySound(aType,ENoRepeat,TTimeIntervalMicroSeconds32(0),ETrue);}
87 /** Plays the specified sound the specifed number of times with the
88 specified interval, interrupting any other sound that is currently playing.
90 @param aType The sound to play.
91 @param aPlayCount The number of times the sound is played.
92 @param aGap The interval in microseconds between each time the sound is played. */
93 inline void CoeSoundPlayer::PlaySoundNow(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap)
94 {CoeSoundPlayer::PlaySound(aType,aPlayCount,aGap,ETrue);}
96 #endif // __COESNDPY_H__