📄 soundmanager.h
字号:
/*
========================================================================
Name : SoundManager.h
Author :
Copyright :
Description : Manages multiple sound files.
License :
========================================================================
*/
#ifndef SOUNDMANAGER_H
#define SOUNDMANAGER_H
// Volume-Level
#define VOLUME_OFF 0
#define VOLUME_HIGH 1
#define VOLUME_LOW 2
#include <aknutils.h>
#include "playeradapter.h" // Sound files
#include "CommonFunctions.h"
/**
* Number of sounds to be managed by this class.
* This has to be set according to the number of sounds you want to use,
* otherwise this class won't work! (uses a fixed array for minimum overhead).
*/
#define MAX_SOUNDS 2
#define DELETE_AND_NULL(p) {delete p; p = NULL;}
/**
* Takes care of loading, playing and coordinating the sounds.
*/
class CSoundManager : public CBase
{
public:
/// Constructors
CSoundManager();
/// Destructor
virtual ~CSoundManager();
/**
* Loads a soundfile into the specified position. Please note that this class
* uses a fixed array, so the number of used sound files has to specified in the
* header file.
*/
void LoadSoundFileL(RFs& aFs, const TDesC& aSoundFileName, TInt aSoundNumber);
/**
* Stops all sound files and then plays the specified sound file. (this is done
* because it's not possible to play more than one sound file at once).
*/
void PlayL(TInt aSoundNumber);
/**
* Stops the specified sound file.
*/
void Stop(TInt aSoundNumber);
/**
* Set the volume of all sound files.
*/
void SetVolume(const TInt aSoundLevel);
private:
/**
* Array containing the sounds.
*/
CPlayerAdapter *iSounds[MAX_SOUNDS];
/**
* Stores if sounds are activated.
*/
TBool iSoundOn;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -