epoc32/include/mw/coesndpy.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __COESNDPY_H__
williamr@2
    17
#define __COESNDPY_H__
williamr@2
    18
williamr@2
    19
#include <e32std.h>
williamr@2
    20
williamr@2
    21
class TBaSystemSoundType;
williamr@2
    22
class CCoeSoundPlayerManager;
williamr@2
    23
williamr@2
    24
williamr@2
    25
/** Utility class for simple sound playing.
williamr@2
    26
williamr@2
    27
Must be used in the same thread as an active UI Control Framework environment 
williamr@2
    28
(CCoeEnv). 
williamr@2
    29
williamr@2
    30
This class plays the sound specified by a TBaSystemSoundType object. The 
williamr@2
    31
caller can request the sound to be repeated, and the time between repeats. 
williamr@2
    32
If the exact sound cannot be found on a particular device, a match only by 
williamr@2
    33
category (first UID) is used. No sound will play if a match is not found.
williamr@2
    34
williamr@2
    35
@publishedAll
williamr@2
    36
@released */
williamr@2
    37
class CoeSoundPlayer
williamr@2
    38
	{
williamr@2
    39
public:
williamr@2
    40
	enum { ENoRepeat=1, ERepeatForever=KMaxTInt};
williamr@2
    41
public:
williamr@2
    42
	inline static void PlaySound(const TBaSystemSoundType& aType);
williamr@2
    43
	inline static void PlaySound(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap);
williamr@2
    44
	inline static void PlaySoundNow(const TBaSystemSoundType& aType);
williamr@2
    45
	inline static void PlaySoundNow(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap);
williamr@2
    46
	IMPORT_C static void CancelSound(const TBaSystemSoundType& aType);
williamr@2
    47
private:
williamr@2
    48
	IMPORT_C static void PlaySound(const TBaSystemSoundType& aType,TInt aPlayCount,
williamr@2
    49
											TTimeIntervalMicroSeconds32 aGap,TBool aInterrupt);
williamr@2
    50
	static CCoeSoundPlayerManager* ManagerL();
williamr@2
    51
	};
williamr@2
    52
williamr@2
    53
williamr@2
    54
williamr@2
    55
williamr@2
    56
williamr@2
    57
/** Plays the specified sound. 
williamr@2
    58
williamr@2
    59
This function only interrupts another, currently playing, sound if the new 
williamr@2
    60
sound has a higher priority than the currently playing sound. If you wish 
williamr@2
    61
to interrupt any currently playing sound and play a new one, use PlaySoundNow() 
williamr@2
    62
instead of PlaySound().
williamr@2
    63
williamr@2
    64
@param aType The sound to play.*/
williamr@2
    65
inline void CoeSoundPlayer::PlaySound(const TBaSystemSoundType& aType)
williamr@2
    66
	{CoeSoundPlayer::PlaySound(aType,ENoRepeat,TTimeIntervalMicroSeconds32(0),EFalse);}
williamr@2
    67
williamr@2
    68
/** Plays the specified sound for the specifed number of times with the specified 
williamr@2
    69
interval. 
williamr@2
    70
williamr@2
    71
This function only interrupts another, currently playing, sound if the new sound 
williamr@2
    72
has a higher priority than the current one. If you wish to interrupt 
williamr@2
    73
any currently playing sound and play a new one, use PlaySoundNow() instead of PlaySound().
williamr@2
    74
williamr@2
    75
@param aType The sound to play. 
williamr@2
    76
@param aPlayCount The number of times the sound is played.
williamr@2
    77
@param aGap The interval in microseconds between each time the sound is played. */
williamr@2
    78
inline void CoeSoundPlayer::PlaySound(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap)
williamr@2
    79
	{CoeSoundPlayer::PlaySound(aType,aPlayCount,aGap,EFalse);}
williamr@2
    80
williamr@2
    81
/** Plays the specified sound, interrupting any other sound that is currently playing.
williamr@2
    82
williamr@2
    83
@param aType The sound to play. */
williamr@2
    84
inline void CoeSoundPlayer::PlaySoundNow(const TBaSystemSoundType& aType)
williamr@2
    85
	{CoeSoundPlayer::PlaySound(aType,ENoRepeat,TTimeIntervalMicroSeconds32(0),ETrue);}
williamr@2
    86
williamr@2
    87
/** Plays the specified sound the specifed number of times with the 
williamr@2
    88
specified interval, interrupting any other sound that is currently playing.
williamr@2
    89
williamr@2
    90
@param aType The sound to play.
williamr@2
    91
@param aPlayCount The number of times the sound is played.
williamr@2
    92
@param aGap The interval in microseconds between each time the sound is played. */
williamr@2
    93
inline void CoeSoundPlayer::PlaySoundNow(const TBaSystemSoundType& aType,TInt aPlayCount,const TTimeIntervalMicroSeconds32& aGap)
williamr@2
    94
	{CoeSoundPlayer::PlaySound(aType,aPlayCount,aGap,ETrue);}
williamr@2
    95
williamr@2
    96
#endif	// __COESNDPY_H__