epoc32/include/bassnd.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
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
#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@4
    21
#include <mmf/common/mmfbase.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
williamr@2
    63
class TBaSystemSoundType
williamr@2
    64
/** 
williamr@2
    65
Provides a logical sound wrapper. A sound is specified logically using two 
williamr@2
    66
UIDs. The first UID specifies the sound's category which can be a file, tone 
williamr@2
    67
or sequence; the second, which is optional, specifies an instance of that 
williamr@2
    68
category. The pair of UIDs is encapsulated in a TBaSystemSoundType object.
williamr@2
    69
williamr@2
    70
Once a TBaSystemSoundType object is constructed, the sound player class CoeSoundPlayer 
williamr@2
    71
is used to play the sound. 
williamr@2
    72
@publishedAll
williamr@2
    73
@released
williamr@2
    74
*/
williamr@2
    75
	{
williamr@2
    76
public:
williamr@2
    77
	IMPORT_C TBaSystemSoundType();
williamr@2
    78
	IMPORT_C TBaSystemSoundType(TBaSystemSoundUid aMajor,TUid aMinor=KNullUid);
williamr@2
    79
public:
williamr@2
    80
	inline TBool IsNull() const;
williamr@2
    81
	IMPORT_C TBool operator==(const TBaSystemSoundType& aType) const;
williamr@2
    82
public:
williamr@2
    83
	/** Specifies a sound's category. */
williamr@2
    84
	TBaSystemSoundUid iMajor;
williamr@2
    85
	/** Specifies an instance of a sound's category. */
williamr@2
    86
	TUid iMinor;
williamr@2
    87
	};
williamr@2
    88
williamr@2
    89
williamr@2
    90
class TBaSystemSoundInfo
williamr@2
    91
/** 
williamr@2
    92
Provides functions that contain the information for a system sound. A sound 
williamr@2
    93
may be a file, a tone or a fixed sequence.
williamr@2
    94
williamr@2
    95
The characteristics of a physical sound that corresponds to a logical sound 
williamr@2
    96
are encapsulated in a TBaSystemSoundInfo object. You can get and set the physical 
williamr@2
    97
sound for a logical sound through the functions provided by the BaSystemSound 
williamr@2
    98
class. 
williamr@2
    99
@publishedAll
williamr@2
   100
@released
williamr@2
   101
*/
williamr@2
   102
	{
williamr@2
   103
public:
williamr@2
   104
	
williamr@2
   105
	class TTone
williamr@2
   106
/** 
williamr@2
   107
Provides functions to define a tone. Once defined, the tone can be encapsulated 
williamr@2
   108
using the TBaSystemSoundInfo class and subsequently played. 
williamr@2
   109
@publishedAll
williamr@2
   110
@released 
williamr@2
   111
williamr@2
   112
*/
williamr@2
   113
		{
williamr@2
   114
	public:
williamr@2
   115
	
williamr@2
   116
		inline TTone();
williamr@2
   117
		inline TTone(TInt aFrequency,TTimeIntervalMicroSeconds32 aDuration);
williamr@2
   118
	public:
williamr@2
   119
	
williamr@2
   120
		TBool IsNull() const;
williamr@2
   121
	public:
williamr@2
   122
williamr@2
   123
		void InternalizeL(RReadStream& aStream);
williamr@2
   124
williamr@2
   125
		void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   126
	public:
williamr@2
   127
	/** Frequency of the tone. */
williamr@2
   128
		TInt iFrequency;
williamr@2
   129
	/** Duration of the tone. */
williamr@2
   130
		TTimeIntervalMicroSeconds32 iDuration;
williamr@2
   131
		};
williamr@2
   132
public:
williamr@2
   133
	/** Specifies the category of the system sound. */
williamr@2
   134
	enum TSoundCategory
williamr@2
   135
		{
williamr@2
   136
		/** Specifies no system sound. */
williamr@2
   137
		ENull,
williamr@2
   138
williamr@2
   139
		/** Specifies a file as the system sound. */
williamr@2
   140
		EFile,
williamr@2
   141
williamr@2
   142
		/** Specifies a sequence as the system sound. */
williamr@2
   143
		ESequence,
williamr@2
   144
williamr@2
   145
		/** Specifies a tone as the system sound. */
williamr@2
   146
		ETone
williamr@2
   147
		};
williamr@2
   148
public:
williamr@2
   149
	IMPORT_C TBaSystemSoundInfo();
williamr@2
   150
	IMPORT_C TBaSystemSoundInfo(const TBaSystemSoundType& aType,const TBaSystemSoundName& aName,
williamr@2
   151
							TInt aVolume=KSystemSoundDefaultVolume,TInt aPriority=KSystemSoundDefaultPriority);
williamr@2
   152
	IMPORT_C TBaSystemSoundInfo(const TBaSystemSoundType& aType,TInt aFixedSequence,
williamr@2
   153
							TInt aVolume=KSystemSoundDefaultVolume,TInt aPriority=KSystemSoundDefaultPriority);
williamr@2
   154
	IMPORT_C TBaSystemSoundInfo(const TBaSystemSoundType& aType,TTone aTone,
williamr@2
   155
							TInt aVolume=KSystemSoundDefaultVolume,TInt aPriority=KSystemSoundDefaultPriority);
williamr@2
   156
public:
williamr@2
   157
	IMPORT_C TSoundCategory SoundCategory() const;
williamr@2
   158
	inline TInt FixedSequenceNumber() const;
williamr@2
   159
	inline TBaSystemSoundName FileName() const;
williamr@2
   160
	inline TTone Tone() const;
williamr@2
   161
	IMPORT_C void SetFixedSequenceNumber(TInt aNumber);
williamr@2
   162
	IMPORT_C void SetFileName(const TBaSystemSoundName& aFileName);
williamr@2
   163
	IMPORT_C void SetTone(const TTone& aTone);
williamr@2
   164
williamr@2
   165
	void InternalizeL(RReadStream& aStream);
williamr@2
   166
	void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   167
public:
williamr@2
   168
	TBaSystemSoundType iType;
williamr@2
   169
	TInt iVolume;
williamr@2
   170
	TInt iPriority;
williamr@2
   171
private:
williamr@2
   172
	TBaSystemSoundName iName;
williamr@2
   173
	TInt iFixedSequence;
williamr@2
   174
	TTone iTone;
williamr@2
   175
	};
williamr@2
   176
williamr@2
   177
williamr@2
   178
/** 
williamr@2
   179
API class to retrieve and modify the system sounds settings.
williamr@2
   180
williamr@2
   181
Note that SystemSoundFile() is now deprecated and will be removed in a future
williamr@2
   182
release. The filename it returns is no longer valid but is kept for backwards 
williamr@2
   183
compatibility. The system sounds settings are no longer stored in a data file.
williamr@2
   184
 
williamr@2
   185
@see BaSystemSound::SystemSoundFile
williamr@2
   186
@see KSystemSoundRepositoryUID
williamr@2
   187
@publishedAll
williamr@2
   188
@released
williamr@2
   189
*/
williamr@2
   190
class BaSystemSound
williamr@2
   191
	{
williamr@2
   192
public:
williamr@2
   193
	IMPORT_C static TInt GetSound(RFs& aFsSession,const TBaSystemSoundType& aType,TBaSystemSoundInfo& aInfo);
williamr@2
   194
	IMPORT_C static void SetSoundL(RFs& aFsSession,const TBaSystemSoundInfo& aInfo);
williamr@2
   195
    IMPORT_C static TFileName SystemSoundFile(); // Deprecated
williamr@2
   196
private:
williamr@2
   197
	TBaSystemSoundName static DefaultSound(TBaSystemSoundUid aSSUid);
williamr@2
   198
	};
williamr@2
   199
williamr@2
   200
williamr@2
   201
class CBaSystemSoundArray: public CBase
williamr@2
   202
/**
williamr@2
   203
 * An array to contain the set of system sounds for a TBaSystemSoundUid
williamr@2
   204
@publishedAll
williamr@2
   205
@released
williamr@2
   206
 */	
williamr@2
   207
 	{
williamr@2
   208
public:
williamr@2
   209
	CBaSystemSoundArray();
williamr@2
   210
	~CBaSystemSoundArray();
williamr@2
   211
public:
williamr@2
   212
	IMPORT_C static CBaSystemSoundArray* NewL();
williamr@2
   213
	IMPORT_C static CBaSystemSoundArray* NewLC();
williamr@2
   214
	IMPORT_C void RestoreL(RFs& aFsSession,TBaSystemSoundUid aSSUid);
williamr@2
   215
	IMPORT_C TInt Count() ;
williamr@2
   216
	IMPORT_C TBaSystemSoundInfo At(TInt aIndex);
williamr@2
   217
williamr@2
   218
private:
williamr@2
   219
	TBaSystemSoundUid iUid;
williamr@2
   220
	CArrayFixFlat<TBaSystemSoundInfo> iSystemSounds;
williamr@2
   221
	};
williamr@2
   222
williamr@2
   223
williamr@2
   224
class TBaSoundPriorityBase
williamr@2
   225
/**
williamr@2
   226
Utility class to bundle up priority, priority preference and device specific data
williamr@2
   227
Only intended to be used in conjunction with TBaSystemSoundInfo::iPriority
williamr@2
   228
williamr@2
   229
Layout of class is
williamr@2
   230
bits 31 -> 16:	Device specific priority preference data
williamr@2
   231
bits 15 -> 8:	Standard Epoc TMdaPriorityPreference setting
williamr@2
   232
bits 7 -> 0:		Priority value stored as a TInt8.  Maximum range possible is -256 -> +255
williamr@2
   233
					Note that MediaSvr currently defines a narrower range than this
williamr@2
   234
@publishedAll
williamr@2
   235
@released
williamr@2
   236
*/	
williamr@2
   237
	{
williamr@2
   238
public:
williamr@2
   239
	inline TInt Int() const;
williamr@2
   240
	inline TInt Priority() const;
williamr@2
   241
	IMPORT_C TMdaPriorityPreference PriorityPreference() const;
williamr@2
   242
protected:
williamr@2
   243
	inline TBaSoundPriorityBase();
williamr@2
   244
	void Set(TInt aPriority,TMdaPriorityPreference aPriorityPreference=EMdaPriorityPreferenceTimeAndQuality);
williamr@2
   245
protected:
williamr@2
   246
	TInt iPriority;
williamr@2
   247
	};
williamr@2
   248
williamr@2
   249
williamr@4
   250
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@4
   251
#include <bassnduid.h>
williamr@4
   252
#endif
williamr@4
   253
williamr@2
   254
class TBaSoundPriorityEncoder : public TBaSoundPriorityBase
williamr@2
   255
/**
williamr@2
   256
Encode TBaSystemSoundInfo::iPriority before persisting a sound preference
williamr@2
   257
@publishedAll
williamr@2
   258
@released
williamr@2
   259
*/
williamr@2
   260
	{
williamr@2
   261
public:
williamr@2
   262
	IMPORT_C TBaSoundPriorityEncoder(TInt aPriority,TMdaPriorityPreference aPriorityPreference=EMdaPriorityPreferenceTimeAndQuality);
williamr@2
   263
	};
williamr@2
   264
williamr@2
   265
williamr@2
   266
williamr@2
   267
inline TBool TBaSystemSoundType::IsNull() const
williamr@2
   268
	/** Tests whether the sound's category and instance are null.
williamr@2
   269
	
williamr@2
   270
	@return ETrue if the sound's category and instance are null, EFalse otherwise. */
williamr@2
   271
	{return iMajor==KNullUid && iMinor==KNullUid;}
williamr@2
   272
williamr@2
   273
williamr@2
   274
inline TBaSystemSoundInfo::TTone::TTone()
williamr@2
   275
	: iFrequency(0), iDuration(0)
williamr@2
   276
	/** Default constructor. Sets up a TTone object with null frequency and duration. */
williamr@2
   277
	{}
williamr@2
   278
inline TBaSystemSoundInfo::TTone::TTone(TInt aFrequency,TTimeIntervalMicroSeconds32 aDuration)
williamr@2
   279
	: iFrequency(aFrequency), iDuration(aDuration)
williamr@2
   280
	/** Constructor which sets up a TTone object with specified frequency and duration.
williamr@2
   281
	
williamr@2
   282
	@param aFrequency The tone's frequency. 
williamr@2
   283
	@param aDuration The tone's duration. */
williamr@2
   284
	{}
williamr@2
   285
williamr@2
   286
inline TInt TBaSystemSoundInfo::FixedSequenceNumber() const
williamr@2
   287
	/** Gets the current sound's sequence.
williamr@2
   288
	
williamr@2
   289
	@return The current sound's sequence. */
williamr@2
   290
	{return iFixedSequence;}
williamr@2
   291
williamr@2
   292
inline TBaSystemSoundName TBaSystemSoundInfo::FileName() const
williamr@2
   293
	/** Gets the current sound's file.
williamr@2
   294
	
williamr@2
   295
	@return The current sound's file. */
williamr@2
   296
	{return iName;}
williamr@2
   297
williamr@2
   298
inline TBaSystemSoundInfo::TTone TBaSystemSoundInfo::Tone() const
williamr@2
   299
	/** Gets the current system sound's tone.
williamr@2
   300
	
williamr@2
   301
	@return The current sound's tone. */
williamr@2
   302
	{return iTone;}
williamr@2
   303
williamr@2
   304
inline TBaSoundPriorityBase::TBaSoundPriorityBase()
williamr@2
   305
	{}
williamr@2
   306
inline TInt TBaSoundPriorityBase::Int() const
williamr@2
   307
	{return iPriority;}
williamr@2
   308
inline TInt TBaSoundPriorityBase::Priority() const
williamr@2
   309
	{return (TInt8)iPriority;}
williamr@2
   310
williamr@2
   311
williamr@2
   312
#endif