epoc32/include/coesndpy.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 coesndpy.h
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __COESNDPY_H__
       
    17 #define __COESNDPY_H__
       
    18 
       
    19 #include <e32std.h>
       
    20 
       
    21 class TBaSystemSoundType;
       
    22 class CCoeSoundPlayerManager;
       
    23 
       
    24 
       
    25 /** Utility class for simple sound playing.
       
    26 
       
    27 Must be used in the same thread as an active UI Control Framework environment 
       
    28 (CCoeEnv). 
       
    29 
       
    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.
       
    34 
       
    35 @publishedAll
       
    36 @released */
       
    37 class CoeSoundPlayer
       
    38 	{
       
    39 public:
       
    40 	enum { ENoRepeat=1, ERepeatForever=KMaxTInt};
       
    41 public:
       
    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);
       
    47 private:
       
    48 	IMPORT_C static void PlaySound(const TBaSystemSoundType& aType,TInt aPlayCount,
       
    49 											TTimeIntervalMicroSeconds32 aGap,TBool aInterrupt);
       
    50 	static CCoeSoundPlayerManager* ManagerL();
       
    51 	};
       
    52 
       
    53 
       
    54 
       
    55 
       
    56 
       
    57 /** Plays the specified sound. 
       
    58 
       
    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().
       
    63 
       
    64 @param aType The sound to play.*/
       
    65 inline void CoeSoundPlayer::PlaySound(const TBaSystemSoundType& aType)
       
    66 	{CoeSoundPlayer::PlaySound(aType,ENoRepeat,TTimeIntervalMicroSeconds32(0),EFalse);}
       
    67 
       
    68 /** Plays the specified sound for the specifed number of times with the specified 
       
    69 interval. 
       
    70 
       
    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().
       
    74 
       
    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);}
       
    80 
       
    81 /** Plays the specified sound, interrupting any other sound that is currently playing.
       
    82 
       
    83 @param aType The sound to play. */
       
    84 inline void CoeSoundPlayer::PlaySoundNow(const TBaSystemSoundType& aType)
       
    85 	{CoeSoundPlayer::PlaySound(aType,ENoRepeat,TTimeIntervalMicroSeconds32(0),ETrue);}
       
    86 
       
    87 /** Plays the specified sound the specifed number of times with the 
       
    88 specified interval, interrupting any other sound that is currently playing.
       
    89 
       
    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);}
       
    95 
       
    96 #endif	// __COESNDPY_H__