os/ossrv/lowlevellibsandfws/apputils/inc/BASSND.H
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/apputils/inc/BASSND.H	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,312 @@
     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 "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.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 +#if !defined(__EIKSSND_H__)
    1.20 +#define __EIKSSND_H__
    1.21 +
    1.22 +#include <e32base.h>
    1.23 +#include <s32file.h>
    1.24 +#include <mmf/common/mmfbase.h>
    1.25 +
    1.26 +
    1.27 +/**
    1.28 +Specifies a system sound for a ring, alarm, message, error or event.
    1.29 +"bafl.lib"
    1.30 +@since 6.0
    1.31 +@publishedAll
    1.32 +@released
    1.33 +*/
    1.34 +typedef TUid TBaSystemSoundUid;
    1.35 +
    1.36 +/**
    1.37 +Specifies a system sound file name.
    1.38 +"bafl.lib"
    1.39 +@since 6.0
    1.40 +@publishedAll
    1.41 +@released
    1.42 +*/
    1.43 +typedef TFileName TBaSystemSoundName;
    1.44 +
    1.45 +/**
    1.46 +@publishedAll
    1.47 +@released
    1.48 +*/
    1.49 +#define KSystemSoundDefaultVolume	1
    1.50 +#define KSystemSoundDefaultPriority	0
    1.51 +
    1.52 +/**
    1.53 +this dll may use uids 48aa to 48ca
    1.54 +@publishedAll
    1.55 +@released
    1.56 +*/
    1.57 +const TBaSystemSoundUid KSystemSoundRingUID		= {0x100048AB};
    1.58 +const TBaSystemSoundUid KSystemSoundAlarmUID	= {0x100048AC};
    1.59 +const TBaSystemSoundUid KSystemSoundMessageUID	= {0x100048AD};
    1.60 +
    1.61 +const TBaSystemSoundUid KUidSystemSoundError={0x1000609E};
    1.62 +const TBaSystemSoundUid KUidSystemSoundEvent={0x1000609F};
    1.63 +
    1.64 +
    1.65 +
    1.66 +class TBaSystemSoundType
    1.67 +/** 
    1.68 +Provides a logical sound wrapper. A sound is specified logically using two 
    1.69 +UIDs. The first UID specifies the sound's category which can be a file, tone 
    1.70 +or sequence; the second, which is optional, specifies an instance of that 
    1.71 +category. The pair of UIDs is encapsulated in a TBaSystemSoundType object.
    1.72 +
    1.73 +Once a TBaSystemSoundType object is constructed, the sound player class CoeSoundPlayer 
    1.74 +is used to play the sound. 
    1.75 +@publishedAll
    1.76 +@released
    1.77 +*/
    1.78 +	{
    1.79 +public:
    1.80 +	IMPORT_C TBaSystemSoundType();
    1.81 +	IMPORT_C TBaSystemSoundType(TBaSystemSoundUid aMajor,TUid aMinor=KNullUid);
    1.82 +public:
    1.83 +	inline TBool IsNull() const;
    1.84 +	IMPORT_C TBool operator==(const TBaSystemSoundType& aType) const;
    1.85 +public:
    1.86 +	/** Specifies a sound's category. */
    1.87 +	TBaSystemSoundUid iMajor;
    1.88 +	/** Specifies an instance of a sound's category. */
    1.89 +	TUid iMinor;
    1.90 +	};
    1.91 +
    1.92 +
    1.93 +class TBaSystemSoundInfo
    1.94 +/** 
    1.95 +Provides functions that contain the information for a system sound. A sound 
    1.96 +may be a file, a tone or a fixed sequence.
    1.97 +
    1.98 +The characteristics of a physical sound that corresponds to a logical sound 
    1.99 +are encapsulated in a TBaSystemSoundInfo object. You can get and set the physical 
   1.100 +sound for a logical sound through the functions provided by the BaSystemSound 
   1.101 +class. 
   1.102 +@publishedAll
   1.103 +@released
   1.104 +*/
   1.105 +	{
   1.106 +public:
   1.107 +	
   1.108 +	class TTone
   1.109 +/** 
   1.110 +Provides functions to define a tone. Once defined, the tone can be encapsulated 
   1.111 +using the TBaSystemSoundInfo class and subsequently played. 
   1.112 +@publishedAll
   1.113 +@released 
   1.114 +
   1.115 +*/
   1.116 +		{
   1.117 +	public:
   1.118 +	
   1.119 +		inline TTone();
   1.120 +		inline TTone(TInt aFrequency,TTimeIntervalMicroSeconds32 aDuration);
   1.121 +	public:
   1.122 +	
   1.123 +		TBool IsNull() const;
   1.124 +	public:
   1.125 +
   1.126 +		void InternalizeL(RReadStream& aStream);
   1.127 +
   1.128 +		void ExternalizeL(RWriteStream& aStream) const;
   1.129 +	public:
   1.130 +	/** Frequency of the tone. */
   1.131 +		TInt iFrequency;
   1.132 +	/** Duration of the tone. */
   1.133 +		TTimeIntervalMicroSeconds32 iDuration;
   1.134 +		};
   1.135 +public:
   1.136 +	/** Specifies the category of the system sound. */
   1.137 +	enum TSoundCategory
   1.138 +		{
   1.139 +		/** Specifies no system sound. */
   1.140 +		ENull,
   1.141 +
   1.142 +		/** Specifies a file as the system sound. */
   1.143 +		EFile,
   1.144 +
   1.145 +		/** Specifies a sequence as the system sound. */
   1.146 +		ESequence,
   1.147 +
   1.148 +		/** Specifies a tone as the system sound. */
   1.149 +		ETone
   1.150 +		};
   1.151 +public:
   1.152 +	IMPORT_C TBaSystemSoundInfo();
   1.153 +	IMPORT_C TBaSystemSoundInfo(const TBaSystemSoundType& aType,const TBaSystemSoundName& aName,
   1.154 +							TInt aVolume=KSystemSoundDefaultVolume,TInt aPriority=KSystemSoundDefaultPriority);
   1.155 +	IMPORT_C TBaSystemSoundInfo(const TBaSystemSoundType& aType,TInt aFixedSequence,
   1.156 +							TInt aVolume=KSystemSoundDefaultVolume,TInt aPriority=KSystemSoundDefaultPriority);
   1.157 +	IMPORT_C TBaSystemSoundInfo(const TBaSystemSoundType& aType,TTone aTone,
   1.158 +							TInt aVolume=KSystemSoundDefaultVolume,TInt aPriority=KSystemSoundDefaultPriority);
   1.159 +public:
   1.160 +	IMPORT_C TSoundCategory SoundCategory() const;
   1.161 +	inline TInt FixedSequenceNumber() const;
   1.162 +	inline TBaSystemSoundName FileName() const;
   1.163 +	inline TTone Tone() const;
   1.164 +	IMPORT_C void SetFixedSequenceNumber(TInt aNumber);
   1.165 +	IMPORT_C void SetFileName(const TBaSystemSoundName& aFileName);
   1.166 +	IMPORT_C void SetTone(const TTone& aTone);
   1.167 +
   1.168 +	void InternalizeL(RReadStream& aStream);
   1.169 +	void ExternalizeL(RWriteStream& aStream) const;
   1.170 +public:
   1.171 +	TBaSystemSoundType iType;
   1.172 +	TInt iVolume;
   1.173 +	TInt iPriority;
   1.174 +private:
   1.175 +	TBaSystemSoundName iName;
   1.176 +	TInt iFixedSequence;
   1.177 +	TTone iTone;
   1.178 +	};
   1.179 +
   1.180 +
   1.181 +/** 
   1.182 +API class to retrieve and modify the system sounds settings.
   1.183 +
   1.184 +Note that SystemSoundFile() is now deprecated and will be removed in a future
   1.185 +release. The filename it returns is no longer valid but is kept for backwards 
   1.186 +compatibility. The system sounds settings are no longer stored in a data file.
   1.187 + 
   1.188 +@see BaSystemSound::SystemSoundFile
   1.189 +@see KSystemSoundRepositoryUID
   1.190 +@publishedAll
   1.191 +@released
   1.192 +*/
   1.193 +class BaSystemSound
   1.194 +	{
   1.195 +public:
   1.196 +	IMPORT_C static TInt GetSound(RFs& aFsSession,const TBaSystemSoundType& aType,TBaSystemSoundInfo& aInfo);
   1.197 +	IMPORT_C static void SetSoundL(RFs& aFsSession,const TBaSystemSoundInfo& aInfo);
   1.198 +    IMPORT_C static TFileName SystemSoundFile(); // Deprecated
   1.199 +private:
   1.200 +	TBaSystemSoundName static DefaultSound(TBaSystemSoundUid aSSUid);
   1.201 +	};
   1.202 +
   1.203 +
   1.204 +class CBaSystemSoundArray: public CBase
   1.205 +/**
   1.206 + * An array to contain the set of system sounds for a TBaSystemSoundUid
   1.207 +@publishedAll
   1.208 +@released
   1.209 + */	
   1.210 + 	{
   1.211 +public:
   1.212 +	CBaSystemSoundArray();
   1.213 +	~CBaSystemSoundArray();
   1.214 +public:
   1.215 +	IMPORT_C static CBaSystemSoundArray* NewL();
   1.216 +	IMPORT_C static CBaSystemSoundArray* NewLC();
   1.217 +	IMPORT_C void RestoreL(RFs& aFsSession,TBaSystemSoundUid aSSUid);
   1.218 +	IMPORT_C TInt Count() ;
   1.219 +	IMPORT_C TBaSystemSoundInfo At(TInt aIndex);
   1.220 +
   1.221 +private:
   1.222 +	TBaSystemSoundUid iUid;
   1.223 +	CArrayFixFlat<TBaSystemSoundInfo> iSystemSounds;
   1.224 +	};
   1.225 +
   1.226 +
   1.227 +class TBaSoundPriorityBase
   1.228 +/**
   1.229 +Utility class to bundle up priority, priority preference and device specific data
   1.230 +Only intended to be used in conjunction with TBaSystemSoundInfo::iPriority
   1.231 +
   1.232 +Layout of class is
   1.233 +bits 31 -> 16:	Device specific priority preference data
   1.234 +bits 15 -> 8:	Standard Epoc TMdaPriorityPreference setting
   1.235 +bits 7 -> 0:		Priority value stored as a TInt8.  Maximum range possible is -256 -> +255
   1.236 +					Note that MediaSvr currently defines a narrower range than this
   1.237 +@publishedAll
   1.238 +@released
   1.239 +*/	
   1.240 +	{
   1.241 +public:
   1.242 +	inline TInt Int() const;
   1.243 +	inline TInt Priority() const;
   1.244 +	IMPORT_C TMdaPriorityPreference PriorityPreference() const;
   1.245 +protected:
   1.246 +	inline TBaSoundPriorityBase();
   1.247 +	void Set(TInt aPriority,TMdaPriorityPreference aPriorityPreference=EMdaPriorityPreferenceTimeAndQuality);
   1.248 +protected:
   1.249 +	TInt iPriority;
   1.250 +	};
   1.251 +
   1.252 +
   1.253 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
   1.254 +#include <bassnduid.h>
   1.255 +#endif
   1.256 +
   1.257 +class TBaSoundPriorityEncoder : public TBaSoundPriorityBase
   1.258 +/**
   1.259 +Encode TBaSystemSoundInfo::iPriority before persisting a sound preference
   1.260 +@publishedAll
   1.261 +@released
   1.262 +*/
   1.263 +	{
   1.264 +public:
   1.265 +	IMPORT_C TBaSoundPriorityEncoder(TInt aPriority,TMdaPriorityPreference aPriorityPreference=EMdaPriorityPreferenceTimeAndQuality);
   1.266 +	};
   1.267 +
   1.268 +
   1.269 +
   1.270 +inline TBool TBaSystemSoundType::IsNull() const
   1.271 +	/** Tests whether the sound's category and instance are null.
   1.272 +	
   1.273 +	@return ETrue if the sound's category and instance are null, EFalse otherwise. */
   1.274 +	{return iMajor==KNullUid && iMinor==KNullUid;}
   1.275 +
   1.276 +
   1.277 +inline TBaSystemSoundInfo::TTone::TTone()
   1.278 +	: iFrequency(0), iDuration(0)
   1.279 +	/** Default constructor. Sets up a TTone object with null frequency and duration. */
   1.280 +	{}
   1.281 +inline TBaSystemSoundInfo::TTone::TTone(TInt aFrequency,TTimeIntervalMicroSeconds32 aDuration)
   1.282 +	: iFrequency(aFrequency), iDuration(aDuration)
   1.283 +	/** Constructor which sets up a TTone object with specified frequency and duration.
   1.284 +	
   1.285 +	@param aFrequency The tone's frequency. 
   1.286 +	@param aDuration The tone's duration. */
   1.287 +	{}
   1.288 +
   1.289 +inline TInt TBaSystemSoundInfo::FixedSequenceNumber() const
   1.290 +	/** Gets the current sound's sequence.
   1.291 +	
   1.292 +	@return The current sound's sequence. */
   1.293 +	{return iFixedSequence;}
   1.294 +
   1.295 +inline TBaSystemSoundName TBaSystemSoundInfo::FileName() const
   1.296 +	/** Gets the current sound's file.
   1.297 +	
   1.298 +	@return The current sound's file. */
   1.299 +	{return iName;}
   1.300 +
   1.301 +inline TBaSystemSoundInfo::TTone TBaSystemSoundInfo::Tone() const
   1.302 +	/** Gets the current system sound's tone.
   1.303 +	
   1.304 +	@return The current sound's tone. */
   1.305 +	{return iTone;}
   1.306 +
   1.307 +inline TBaSoundPriorityBase::TBaSoundPriorityBase()
   1.308 +	{}
   1.309 +inline TInt TBaSoundPriorityBase::Int() const
   1.310 +	{return iPriority;}
   1.311 +inline TInt TBaSoundPriorityBase::Priority() const
   1.312 +	{return (TInt8)iPriority;}
   1.313 +
   1.314 +
   1.315 +#endif