epoc32/include/bassnd.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100 (2010-03-31)
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
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@2
     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
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.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
#if !defined(__EIKSSND_H__)
williamr@2
    17
#define __EIKSSND_H__
williamr@2
    18
williamr@2
    19
#include <e32base.h>
williamr@2
    20
#include <s32file.h>
williamr@2
    21
#include <mda/common/controller.h>
williamr@2
    22
williamr@2
    23
williamr@2
    24
/**
williamr@2
    25
Specifies a system sound for a ring, alarm, message, error or event.
williamr@2
    26
"bafl.lib"
williamr@2
    27
@since 6.0
williamr@2
    28
@publishedAll
williamr@2
    29
@released
williamr@2
    30
*/
williamr@2
    31
typedef TUid TBaSystemSoundUid;
williamr@2
    32
williamr@2
    33
/**
williamr@2
    34
Specifies a system sound file name.
williamr@2
    35
"bafl.lib"
williamr@2
    36
@since 6.0
williamr@2
    37
@publishedAll
williamr@2
    38
@released
williamr@2
    39
*/
williamr@2
    40
typedef TFileName TBaSystemSoundName;
williamr@2
    41
williamr@2
    42
/**
williamr@2
    43
@publishedAll
williamr@2
    44
@released
williamr@2
    45
*/
williamr@2
    46
#define KSystemSoundDefaultVolume	1
williamr@2
    47
#define KSystemSoundDefaultPriority	0
williamr@2
    48
williamr@2
    49
/**
williamr@2
    50
this dll may use uids 48aa to 48ca
williamr@2
    51
@publishedAll
williamr@2
    52
@released
williamr@2
    53
*/
williamr@2
    54
const TBaSystemSoundUid KSystemSoundRingUID		= {0x100048AB};
williamr@2
    55
const TBaSystemSoundUid KSystemSoundAlarmUID	= {0x100048AC};
williamr@2
    56
const TBaSystemSoundUid KSystemSoundMessageUID	= {0x100048AD};
williamr@2
    57
williamr@2
    58
const TBaSystemSoundUid KUidSystemSoundError={0x1000609E};
williamr@2
    59
const TBaSystemSoundUid KUidSystemSoundEvent={0x1000609F};
williamr@2
    60
williamr@2
    61
/**
williamr@2
    62
This is the UID of the repository where the system sound data is stored.
williamr@2
    63
The UID is published to UI platforms to allow them to use the key value in 
williamr@2
    64
the CRepository::NotifyRequest() API to monitor for changes in the system
williamr@2
    65
sound data.
williamr@2
    66
williamr@2
    67
@see CRepository
williamr@2
    68
@see BaSystemSound::SystemSoundFile
williamr@2
    69
@publishedPartner
williamr@2
    70
@released
williamr@2
    71
*/
williamr@2
    72
const TUid KSystemSoundRepositoryUID = {0x100048AA};
williamr@2
    73
williamr@2
    74
williamr@2
    75
class TBaSystemSoundType
williamr@2
    76
/** 
williamr@2
    77
Provides a logical sound wrapper. A sound is specified logically using two 
williamr@2
    78
UIDs. The first UID specifies the sound's category which can be a file, tone 
williamr@2
    79
or sequence; the second, which is optional, specifies an instance of that 
williamr@2
    80
category. The pair of UIDs is encapsulated in a TBaSystemSoundType object.
williamr@2
    81
williamr@2
    82
Once a TBaSystemSoundType object is constructed, the sound player class CoeSoundPlayer 
williamr@2
    83
is used to play the sound. 
williamr@2
    84
@publishedAll
williamr@2
    85
@released
williamr@2
    86
*/
williamr@2
    87
	{
williamr@2
    88
public:
williamr@2
    89
	IMPORT_C TBaSystemSoundType();
williamr@2
    90
	IMPORT_C TBaSystemSoundType(TBaSystemSoundUid aMajor,TUid aMinor=KNullUid);
williamr@2
    91
public:
williamr@2
    92
	inline TBool IsNull() const;
williamr@2
    93
	IMPORT_C TBool operator==(const TBaSystemSoundType& aType) const;
williamr@2
    94
public:
williamr@2
    95
	/** Specifies a sound's category. */
williamr@2
    96
	TBaSystemSoundUid iMajor;
williamr@2
    97
	/** Specifies an instance of a sound's category. */
williamr@2
    98
	TUid iMinor;
williamr@2
    99
	};
williamr@2
   100
williamr@2
   101
williamr@2
   102
class TBaSystemSoundInfo
williamr@2
   103
/** 
williamr@2
   104
Provides functions that contain the information for a system sound. A sound 
williamr@2
   105
may be a file, a tone or a fixed sequence.
williamr@2
   106
williamr@2
   107
The characteristics of a physical sound that corresponds to a logical sound 
williamr@2
   108
are encapsulated in a TBaSystemSoundInfo object. You can get and set the physical 
williamr@2
   109
sound for a logical sound through the functions provided by the BaSystemSound 
williamr@2
   110
class. 
williamr@2
   111
@publishedAll
williamr@2
   112
@released
williamr@2
   113
*/
williamr@2
   114
	{
williamr@2
   115
public:
williamr@2
   116
	
williamr@2
   117
	class TTone
williamr@2
   118
/** 
williamr@2
   119
Provides functions to define a tone. Once defined, the tone can be encapsulated 
williamr@2
   120
using the TBaSystemSoundInfo class and subsequently played. 
williamr@2
   121
@publishedAll
williamr@2
   122
@released 
williamr@2
   123
williamr@2
   124
*/
williamr@2
   125
		{
williamr@2
   126
	public:
williamr@2
   127
	
williamr@2
   128
		inline TTone();
williamr@2
   129
		inline TTone(TInt aFrequency,TTimeIntervalMicroSeconds32 aDuration);
williamr@2
   130
	public:
williamr@2
   131
	
williamr@2
   132
		TBool IsNull() const;
williamr@2
   133
	public:
williamr@2
   134
williamr@2
   135
		void InternalizeL(RReadStream& aStream);
williamr@2
   136
williamr@2
   137
		void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   138
	public:
williamr@2
   139
	/** Frequency of the tone. */
williamr@2
   140
		TInt iFrequency;
williamr@2
   141
	/** Duration of the tone. */
williamr@2
   142
		TTimeIntervalMicroSeconds32 iDuration;
williamr@2
   143
		};
williamr@2
   144
public:
williamr@2
   145
	/** Specifies the category of the system sound. */
williamr@2
   146
	enum TSoundCategory
williamr@2
   147
		{
williamr@2
   148
		/** Specifies no system sound. */
williamr@2
   149
		ENull,
williamr@2
   150
williamr@2
   151
		/** Specifies a file as the system sound. */
williamr@2
   152
		EFile,
williamr@2
   153
williamr@2
   154
		/** Specifies a sequence as the system sound. */
williamr@2
   155
		ESequence,
williamr@2
   156
williamr@2
   157
		/** Specifies a tone as the system sound. */
williamr@2
   158
		ETone
williamr@2
   159
		};
williamr@2
   160
public:
williamr@2
   161
	IMPORT_C TBaSystemSoundInfo();
williamr@2
   162
	IMPORT_C TBaSystemSoundInfo(const TBaSystemSoundType& aType,const TBaSystemSoundName& aName,
williamr@2
   163
							TInt aVolume=KSystemSoundDefaultVolume,TInt aPriority=KSystemSoundDefaultPriority);
williamr@2
   164
	IMPORT_C TBaSystemSoundInfo(const TBaSystemSoundType& aType,TInt aFixedSequence,
williamr@2
   165
							TInt aVolume=KSystemSoundDefaultVolume,TInt aPriority=KSystemSoundDefaultPriority);
williamr@2
   166
	IMPORT_C TBaSystemSoundInfo(const TBaSystemSoundType& aType,TTone aTone,
williamr@2
   167
							TInt aVolume=KSystemSoundDefaultVolume,TInt aPriority=KSystemSoundDefaultPriority);
williamr@2
   168
public:
williamr@2
   169
	IMPORT_C TSoundCategory SoundCategory() const;
williamr@2
   170
	inline TInt FixedSequenceNumber() const;
williamr@2
   171
	inline TBaSystemSoundName FileName() const;
williamr@2
   172
	inline TTone Tone() const;
williamr@2
   173
	IMPORT_C void SetFixedSequenceNumber(TInt aNumber);
williamr@2
   174
	IMPORT_C void SetFileName(const TBaSystemSoundName& aFileName);
williamr@2
   175
	IMPORT_C void SetTone(const TTone& aTone);
williamr@2
   176
williamr@2
   177
	void InternalizeL(RReadStream& aStream);
williamr@2
   178
	void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   179
public:
williamr@2
   180
	TBaSystemSoundType iType;
williamr@2
   181
	TInt iVolume;
williamr@2
   182
	TInt iPriority;
williamr@2
   183
private:
williamr@2
   184
	TBaSystemSoundName iName;
williamr@2
   185
	TInt iFixedSequence;
williamr@2
   186
	TTone iTone;
williamr@2
   187
	};
williamr@2
   188
williamr@2
   189
williamr@2
   190
/** 
williamr@2
   191
API class to retrieve and modify the system sounds settings.
williamr@2
   192
williamr@2
   193
Note that SystemSoundFile() is now deprecated and will be removed in a future
williamr@2
   194
release. The filename it returns is no longer valid but is kept for backwards 
williamr@2
   195
compatibility. The system sounds settings are no longer stored in a data file.
williamr@2
   196
 
williamr@2
   197
@see BaSystemSound::SystemSoundFile
williamr@2
   198
@see KSystemSoundRepositoryUID
williamr@2
   199
@publishedAll
williamr@2
   200
@released
williamr@2
   201
*/
williamr@2
   202
class BaSystemSound
williamr@2
   203
	{
williamr@2
   204
public:
williamr@2
   205
	IMPORT_C static TInt GetSound(RFs& aFsSession,const TBaSystemSoundType& aType,TBaSystemSoundInfo& aInfo);
williamr@2
   206
	IMPORT_C static void SetSoundL(RFs& aFsSession,const TBaSystemSoundInfo& aInfo);
williamr@2
   207
    IMPORT_C static TFileName SystemSoundFile(); // Deprecated
williamr@2
   208
private:
williamr@2
   209
	TBaSystemSoundName static DefaultSound(TBaSystemSoundUid aSSUid);
williamr@2
   210
	};
williamr@2
   211
williamr@2
   212
williamr@2
   213
class CBaSystemSoundArray: public CBase
williamr@2
   214
/**
williamr@2
   215
 * An array to contain the set of system sounds for a TBaSystemSoundUid
williamr@2
   216
@publishedAll
williamr@2
   217
@released
williamr@2
   218
 */	
williamr@2
   219
 	{
williamr@2
   220
public:
williamr@2
   221
	CBaSystemSoundArray();
williamr@2
   222
	~CBaSystemSoundArray();
williamr@2
   223
public:
williamr@2
   224
	IMPORT_C static CBaSystemSoundArray* NewL();
williamr@2
   225
	IMPORT_C static CBaSystemSoundArray* NewLC();
williamr@2
   226
	IMPORT_C void RestoreL(RFs& aFsSession,TBaSystemSoundUid aSSUid);
williamr@2
   227
	IMPORT_C TInt Count() ;
williamr@2
   228
	IMPORT_C TBaSystemSoundInfo At(TInt aIndex);
williamr@2
   229
williamr@2
   230
private:
williamr@2
   231
	TBaSystemSoundUid iUid;
williamr@2
   232
	CArrayFixFlat<TBaSystemSoundInfo> iSystemSounds;
williamr@2
   233
	};
williamr@2
   234
williamr@2
   235
williamr@2
   236
class TBaSoundPriorityBase
williamr@2
   237
/**
williamr@2
   238
Utility class to bundle up priority, priority preference and device specific data
williamr@2
   239
Only intended to be used in conjunction with TBaSystemSoundInfo::iPriority
williamr@2
   240
williamr@2
   241
Layout of class is
williamr@2
   242
bits 31 -> 16:	Device specific priority preference data
williamr@2
   243
bits 15 -> 8:	Standard Epoc TMdaPriorityPreference setting
williamr@2
   244
bits 7 -> 0:		Priority value stored as a TInt8.  Maximum range possible is -256 -> +255
williamr@2
   245
					Note that MediaSvr currently defines a narrower range than this
williamr@2
   246
@publishedAll
williamr@2
   247
@released
williamr@2
   248
*/	
williamr@2
   249
	{
williamr@2
   250
public:
williamr@2
   251
	inline TInt Int() const;
williamr@2
   252
	inline TInt Priority() const;
williamr@2
   253
	IMPORT_C TMdaPriorityPreference PriorityPreference() const;
williamr@2
   254
protected:
williamr@2
   255
	inline TBaSoundPriorityBase();
williamr@2
   256
	void Set(TInt aPriority,TMdaPriorityPreference aPriorityPreference=EMdaPriorityPreferenceTimeAndQuality);
williamr@2
   257
protected:
williamr@2
   258
	TInt iPriority;
williamr@2
   259
	};
williamr@2
   260
williamr@2
   261
williamr@2
   262
class TBaSoundPriorityEncoder : public TBaSoundPriorityBase
williamr@2
   263
/**
williamr@2
   264
Encode TBaSystemSoundInfo::iPriority before persisting a sound preference
williamr@2
   265
@publishedAll
williamr@2
   266
@released
williamr@2
   267
*/
williamr@2
   268
	{
williamr@2
   269
public:
williamr@2
   270
	IMPORT_C TBaSoundPriorityEncoder(TInt aPriority,TMdaPriorityPreference aPriorityPreference=EMdaPriorityPreferenceTimeAndQuality);
williamr@2
   271
	};
williamr@2
   272
williamr@2
   273
williamr@2
   274
class TBaSoundPriorityDecoder : public TBaSoundPriorityBase
williamr@2
   275
/**
williamr@2
   276
Decode a restored TBaSystemSoundInfo::iPriority
williamr@2
   277
@internalComponent
williamr@2
   278
*/
williamr@2
   279
	{
williamr@2
   280
public:
williamr@2
   281
	inline TBaSoundPriorityDecoder(TInt aVal);
williamr@2
   282
	};
williamr@2
   283
williamr@2
   284
williamr@2
   285
inline TBool TBaSystemSoundType::IsNull() const
williamr@2
   286
	/** Tests whether the sound's category and instance are null.
williamr@2
   287
	
williamr@2
   288
	@return ETrue if the sound's category and instance are null, EFalse otherwise. */
williamr@2
   289
	{return iMajor==KNullUid && iMinor==KNullUid;}
williamr@2
   290
williamr@2
   291
williamr@2
   292
inline TBaSystemSoundInfo::TTone::TTone()
williamr@2
   293
	: iFrequency(0), iDuration(0)
williamr@2
   294
	/** Default constructor. Sets up a TTone object with null frequency and duration. */
williamr@2
   295
	{}
williamr@2
   296
inline TBaSystemSoundInfo::TTone::TTone(TInt aFrequency,TTimeIntervalMicroSeconds32 aDuration)
williamr@2
   297
	: iFrequency(aFrequency), iDuration(aDuration)
williamr@2
   298
	/** Constructor which sets up a TTone object with specified frequency and duration.
williamr@2
   299
	
williamr@2
   300
	@param aFrequency The tone's frequency. 
williamr@2
   301
	@param aDuration The tone's duration. */
williamr@2
   302
	{}
williamr@2
   303
williamr@2
   304
inline TInt TBaSystemSoundInfo::FixedSequenceNumber() const
williamr@2
   305
	/** Gets the current sound's sequence.
williamr@2
   306
	
williamr@2
   307
	@return The current sound's sequence. */
williamr@2
   308
	{return iFixedSequence;}
williamr@2
   309
williamr@2
   310
inline TBaSystemSoundName TBaSystemSoundInfo::FileName() const
williamr@2
   311
	/** Gets the current sound's file.
williamr@2
   312
	
williamr@2
   313
	@return The current sound's file. */
williamr@2
   314
	{return iName;}
williamr@2
   315
williamr@2
   316
inline TBaSystemSoundInfo::TTone TBaSystemSoundInfo::Tone() const
williamr@2
   317
	/** Gets the current system sound's tone.
williamr@2
   318
	
williamr@2
   319
	@return The current sound's tone. */
williamr@2
   320
	{return iTone;}
williamr@2
   321
williamr@2
   322
inline TBaSoundPriorityBase::TBaSoundPriorityBase()
williamr@2
   323
	{}
williamr@2
   324
inline TInt TBaSoundPriorityBase::Int() const
williamr@2
   325
	{return iPriority;}
williamr@2
   326
inline TInt TBaSoundPriorityBase::Priority() const
williamr@2
   327
	{return (TInt8)iPriority;}
williamr@2
   328
williamr@2
   329
inline TBaSoundPriorityDecoder::TBaSoundPriorityDecoder(TInt aVal)
williamr@2
   330
	{iPriority=aVal;}
williamr@2
   331
williamr@2
   332
#endif