soundcontext.h

来自「一个symbian 冒险游戏代码」· C头文件 代码 · 共 66 行

H
66
字号
#ifndef _SOUNDCONTEXT_H
#define _SOUNDCONTEXT_H


#include "stdint.h"
#include <lang/Array.h>
#include <lang/String.h>


class SoundContext
{
public:
	enum 
	{ 
		MAX_SAMPLES = 128
	};

	enum ChannelType
	{
		CHANNEL_AMBIENT,
		CHANNEL_OTHER,
		CHANNEL_COUNT
	};

	enum SoundFlags
	{
		SOUND_LOOP	= 1
	};

	class Sample
	{
	public:
		lang::Array<int8_t>	data;
		lang::String		name;
		int					flags;
	};

	class Channel
	{
	public:
		Sample*		sample;
		int			pos;

		Channel() : sample(0), pos(0) {}
	};

	SoundContext();

	void	addSample( const char* filename, int flags=0 );
	void	playSound( const char* basename, int channel );
	void	stopSound( const char* basename );
	void	mix( int16_t* out, int size );

	const Channel&	getChannel( int i ) const	{return m_channels[i];}

protected:
	Sample		m_samplelist[MAX_SAMPLES];
	int			m_samples;
	Channel		m_channels[CHANNEL_COUNT];

	Sample*	findSample( const char* basename );
};


#endif // _SOUNDCONTEXT_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?