genesis-3d_engine/Engine/addons/soundsystem/SoundSystemOpenSL.h
zhongdaohuan 6e8fbca745 genesis-3d engine version 1.3.
match the genesis editor version 1.3.0.653.
2014-05-05 14:50:33 +08:00

97 lines
2.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include "SoundSystem.h"
#include <vector>
#include <map>
#include <string>
struct SLObjectItf_;
typedef const struct SLObjectItf_ * const * SLObjectItf;
struct SLEngineItf_;
typedef const struct SLEngineItf_ * const * SLEngineItf;
struct SLPlayItf_;
typedef const struct SLPlayItf_ * const * SLPlayItf;
struct SLSeekItf_;
typedef const struct SLSeekItf_ * const * SLSeekItf;
struct SLEnvironmentalReverbItf_;
typedef const struct SLEnvironmentalReverbItf_ * const * SLEnvironmentalReverbItf;
struct SLVolumeItf_;
typedef const struct SLVolumeItf_ * const * SLVolumeItf;
struct SLPlaybackRateItf_;
typedef const struct SLPlaybackRateItf_ * const * SLPlaybackRateItf;
struct SLPitchItf_;
typedef const struct SLPitchItf_ * const * SLPitchItf;
struct SLMuteSoloItf_;
typedef const struct SLMuteSoloItf_ * const * SLMuteSoloItf;
namespace Sound
{
struct SoundData //保存可播放的音乐结构体
{
SLObjectItf mPlayerObj;
SLPlayItf mPlayItf;
SLSeekItf mSeekItf;
SLVolumeItf mVolumeItf;
SLMuteSoloItf mMuteSoloItf;
SLPitchItf mPitchItf;
SLPlaybackRateItf mPlayRateItf;
bool mIsLoaded;
SoundData():
mPlayerObj(0),
mPlayItf(0),
mSeekItf(0),
mVolumeItf(0),
mMuteSoloItf(0),
mPitchItf(0),
mPlayRateItf(0),
mIsLoaded(false)
{}
};
class SoundSystemOpenSL : public SoundSystem
{
__DeclareSubClass(SoundSystemOpenSL, Sound::SoundSystem);
public:
private:
typedef std::multimap< int, SoundData > SoundDataMap;
private:
SLObjectItf mEngineObject;
SLObjectItf mOutputMixObject;
SLObjectItf mListenerObject;
SLEngineItf mEngineItf;
SLEnvironmentalReverbItf mEnvItf;
SoundDataMap mSoundAssetMap;
public:
SoundSystemOpenSL(){}
virtual ~SoundSystemOpenSL(){}
public:
void LoadSound( const Util::String& fileName, SoundData& soundData);
virtual bool InitSoundSystem();
virtual void ReleaseSoundSystem();
virtual bool CreateSoundBuffer(const char* nameOrData, SizeT dataSize, SoundBuffer **soundBuffer, GENESISOUND_MODE mode, GENESIS_FILE_FORMAT fileFormat);
virtual bool createDSPByType(ALuint type, GPtr<SoundSystemDSP>& dsp); // create a filter
virtual bool PlaySound(SoundBuffer* soundBuffer, SoundSystemSource **ssSource, bool paused);
virtual bool ReleaseSingleSource(SoundSystemSource *source);
virtual bool ReleaseSingleBuffer(SoundBuffer *buffer);
virtual bool SetListenerAttrs(int listener,//该参数暂时无用留作以后开发多listener功能时使用
const Math::vector& position,
const Math::vector& velocity,
const Math::vector& up,
const Math::vector& forward);
virtual void SetBufferInfo(SoundBuffer::BufferInfo &bf){}
};
}