epoc32/include/mw/coesndpy.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/coesndpy.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,96 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __COESNDPY_H__
    1.20 +#define __COESNDPY_H__
    1.21 +
    1.22 +#include <e32std.h>
    1.23 +
    1.24 +class TBaSystemSoundType;
    1.25 +class CCoeSoundPlayerManager;
    1.26 +
    1.27 +
    1.28 +/** Utility class for simple sound playing.
    1.29 +
    1.30 +Must be used in the same thread as an active UI Control Framework environment 
    1.31 +(CCoeEnv). 
    1.32 +
    1.33 +This class plays the sound specified by a TBaSystemSoundType object. The 
    1.34 +caller can request the sound to be repeated, and the time between repeats. 
    1.35 +If the exact sound cannot be found on a particular device, a match only by 
    1.36 +category (first UID) is used. No sound will play if a match is not found.
    1.37 +
    1.38 +@publishedAll
    1.39 +@released */
    1.40 +class CoeSoundPlayer
    1.41 +	{
    1.42 +public:
    1.43 +	enum { ENoRepeat=1, ERepeatForever=KMaxTInt};
    1.44 +public:
    1.45 +	inline static void PlaySound(const TBaSystemSoundType& aType);
    1.46 +	inline static void PlaySound(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap);
    1.47 +	inline static void PlaySoundNow(const TBaSystemSoundType& aType);
    1.48 +	inline static void PlaySoundNow(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap);
    1.49 +	IMPORT_C static void CancelSound(const TBaSystemSoundType& aType);
    1.50 +private:
    1.51 +	IMPORT_C static void PlaySound(const TBaSystemSoundType& aType,TInt aPlayCount,
    1.52 +											TTimeIntervalMicroSeconds32 aGap,TBool aInterrupt);
    1.53 +	static CCoeSoundPlayerManager* ManagerL();
    1.54 +	};
    1.55 +
    1.56 +
    1.57 +
    1.58 +
    1.59 +
    1.60 +/** Plays the specified sound. 
    1.61 +
    1.62 +This function only interrupts another, currently playing, sound if the new 
    1.63 +sound has a higher priority than the currently playing sound. If you wish 
    1.64 +to interrupt any currently playing sound and play a new one, use PlaySoundNow() 
    1.65 +instead of PlaySound().
    1.66 +
    1.67 +@param aType The sound to play.*/
    1.68 +inline void CoeSoundPlayer::PlaySound(const TBaSystemSoundType& aType)
    1.69 +	{CoeSoundPlayer::PlaySound(aType,ENoRepeat,TTimeIntervalMicroSeconds32(0),EFalse);}
    1.70 +
    1.71 +/** Plays the specified sound for the specifed number of times with the specified 
    1.72 +interval. 
    1.73 +
    1.74 +This function only interrupts another, currently playing, sound if the new sound 
    1.75 +has a higher priority than the current one. If you wish to interrupt 
    1.76 +any currently playing sound and play a new one, use PlaySoundNow() instead of PlaySound().
    1.77 +
    1.78 +@param aType The sound to play. 
    1.79 +@param aPlayCount The number of times the sound is played.
    1.80 +@param aGap The interval in microseconds between each time the sound is played. */
    1.81 +inline void CoeSoundPlayer::PlaySound(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap)
    1.82 +	{CoeSoundPlayer::PlaySound(aType,aPlayCount,aGap,EFalse);}
    1.83 +
    1.84 +/** Plays the specified sound, interrupting any other sound that is currently playing.
    1.85 +
    1.86 +@param aType The sound to play. */
    1.87 +inline void CoeSoundPlayer::PlaySoundNow(const TBaSystemSoundType& aType)
    1.88 +	{CoeSoundPlayer::PlaySound(aType,ENoRepeat,TTimeIntervalMicroSeconds32(0),ETrue);}
    1.89 +
    1.90 +/** Plays the specified sound the specifed number of times with the 
    1.91 +specified interval, interrupting any other sound that is currently playing.
    1.92 +
    1.93 +@param aType The sound to play.
    1.94 +@param aPlayCount The number of times the sound is played.
    1.95 +@param aGap The interval in microseconds between each time the sound is played. */
    1.96 +inline void CoeSoundPlayer::PlaySoundNow(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap)
    1.97 +	{CoeSoundPlayer::PlaySound(aType,aPlayCount,aGap,ETrue);}
    1.98 +
    1.99 +#endif	// __COESNDPY_H__