oggstream.h

来自「这是整套横扫千军3D版游戏的源码」· C头文件 代码 · 共 49 行

H
49
字号
#ifndef OGGSTREAM_H
#define OGGSTREAM_H

#include "StdAfx.h"

#include <AL/al.h>
#include <ogg/ogg.h>
#include <vorbis/vorbisfile.h>

#include <string>

// 512KB buffer
#define BUFFER_SIZE (4096 * 128)

class COggStream {
	public:
		COggStream();

		void play(const std::string& path, const float3& pos, float volume);
		void release();
		void display();
		bool playback();
		bool playing();
		void stop();
		bool updateBuffers();
		void update();

    protected:
		bool stream(ALuint buffer);
		void empty();
		void check();
		std::string errorString(int code);

	private:
		FILE* oggFile;
		OggVorbis_File oggStream;
		vorbis_info* vorbisInfo;
		vorbis_comment* vorbisComment;

		ALuint buffers[2];
		ALuint source;
		ALenum format;

		bool stopped;
};


#endif

⌨️ 快捷键说明

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