Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
18
Engine/SoundLib/Common.h
Normal file
18
Engine/SoundLib/Common.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef __COMMON_H__
|
||||
#define __COMMON_H__
|
||||
|
||||
#pragma warning(disable:4786)
|
||||
#pragma warning(disable:4251)
|
||||
#pragma warning(disable:4503)
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <math.h>
|
||||
#include <process.h>
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
#endif //__COMMON_H__
|
||||
88
Engine/SoundLib/DefineSound.h
Normal file
88
Engine/SoundLib/DefineSound.h
Normal file
@@ -0,0 +1,88 @@
|
||||
#ifndef DEFINESOUND_H__
|
||||
#define DEFINESOUND_H__
|
||||
|
||||
#include "Common.h"
|
||||
#include <math.h>
|
||||
#include <dsound.h>
|
||||
|
||||
//====================================
|
||||
// Sound Property
|
||||
//====================================
|
||||
#define VOLUME_MIN 0.0f
|
||||
//#define VOLUME_MIN 0.0001f
|
||||
#define VOLUME_MAX 1.0f
|
||||
#define PAN_LEFT -1.0f
|
||||
#define PAN_CENTER 0.0f
|
||||
#define PAN_RIGHT 1.0f
|
||||
#define PITCH_ORIGINAL 1.0f
|
||||
#define MODE_NORMAL 0x00000000
|
||||
#define MODE_HEADRELATIVE 0x00000001
|
||||
#define MODE_DISABLE 0x00000002
|
||||
|
||||
//====================================
|
||||
// Sound SampleRate
|
||||
//====================================
|
||||
#define SOUND_SAMPLE_11k 11025
|
||||
#define SOUND_SAMPLE_22k 22050
|
||||
#define SOUND_SAMPLE_44k 44100
|
||||
|
||||
//====================================
|
||||
// 3DSound Algorithm
|
||||
//====================================
|
||||
#define SOUND_ALGORITHM_NO DS3DALG_NO_VIRTUALIZATION
|
||||
#define SOUND_ALGORITHM_FULL DS3DALG_HRTF_FULL
|
||||
#define SOUND_ALGORITHM_LIGHT DS3DALG_HRTF_LIGHT
|
||||
|
||||
//====================================
|
||||
// Sound Creation Flag
|
||||
//====================================
|
||||
#define SOUND_FLAG_3D DSBCAPS_CTRL3D|DSBCAPS_GETCURRENTPOSITION2|DSBCAPS_CTRLVOLUME|DSBCAPS_MUTE3DATMAXDISTANCE
|
||||
#define SOUND_FLAG_2D DSBCAPS_CTRLVOLUME|DSBCAPS_GETCURRENTPOSITION2
|
||||
|
||||
//====================================
|
||||
// Macro
|
||||
//====================================
|
||||
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
|
||||
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
|
||||
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
|
||||
|
||||
//====================================
|
||||
// Util Function
|
||||
//====================================
|
||||
static int LinearToLogVol(double fLevel)
|
||||
{
|
||||
// Clamp the value
|
||||
if(fLevel <= 0.0f)
|
||||
return DSBVOLUME_MIN;
|
||||
else if(fLevel >= 1.0f)
|
||||
return 0;
|
||||
return (long) (-2000.0 * log10(1.0f / fLevel));
|
||||
}
|
||||
|
||||
static float LogToLinearVol(int iLevel)
|
||||
{
|
||||
// Clamp the value
|
||||
if(iLevel <= -9600)
|
||||
return 0.0f;
|
||||
else if(iLevel >= 0)
|
||||
return 1.0f;
|
||||
return pow((float)10, (float)(double(iLevel + 2000) / 2000.0f)) / 10.0f;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T Clamp(T var, T min, T max )
|
||||
{
|
||||
if( var < min ) var = min;
|
||||
if( var > max ) var = max;
|
||||
return var;
|
||||
}
|
||||
|
||||
template<class _Ty>
|
||||
struct ptr_less : std::binary_function<_Ty, _Ty, bool>
|
||||
{
|
||||
bool operator()(const _Ty& _X, const _Ty& _Y) const
|
||||
{ return (*_X < *_Y); }
|
||||
};
|
||||
|
||||
|
||||
#endif //DEFINESOUND_H__
|
||||
276
Engine/SoundLib/EAXBuffer.cpp
Normal file
276
Engine/SoundLib/EAXBuffer.cpp
Normal file
@@ -0,0 +1,276 @@
|
||||
// CEAXBuffer.cpp: implementation of the CCEAXBuffer class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "DefineSound.h"
|
||||
#include "EAXBuffer.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
CEAXBuffer::CEAXBuffer()
|
||||
{
|
||||
m_pPropertySet = 0;
|
||||
m_Props.lDirect = EAXBUFFER_DEFAULTDIRECT;
|
||||
m_Props.lDirectHF = EAXBUFFER_DEFAULTDIRECTHF;
|
||||
m_Props.lRoom = EAXBUFFER_DEFAULTROOM;
|
||||
m_Props.lRoomHF = EAXBUFFER_DEFAULTROOMHF;
|
||||
m_Props.flRoomRolloffFactor = EAXBUFFER_DEFAULTROOMROLLOFFFACTOR;
|
||||
m_Props.lObstruction = EAXBUFFER_DEFAULTOBSTRUCTION;
|
||||
m_Props.flObstructionLFRatio = EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO;
|
||||
m_Props.lOcclusion = EAXBUFFER_DEFAULTOCCLUSION;
|
||||
m_Props.flOcclusionLFRatio = EAXBUFFER_DEFAULTOCCLUSIONLFRATIO;
|
||||
m_Props.flOcclusionRoomRatio = EAXBUFFER_DEFAULTOCCLUSIONROOMRATIO;
|
||||
m_Props.lOutsideVolumeHF = EAXBUFFER_DEFAULTOUTSIDEVOLUMEHF;
|
||||
m_Props.flAirAbsorptionFactor = EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR;
|
||||
m_Props.dwFlags = EAXBUFFER_DEFAULTFLAGS;
|
||||
}
|
||||
|
||||
CEAXBuffer::~CEAXBuffer()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
bool CEAXBuffer::Create( IUnknown* pUnknown )
|
||||
{
|
||||
if(!pUnknown)
|
||||
return false;
|
||||
HRESULT hr = pUnknown->QueryInterface(IID_IKsPropertySet, (void**)&m_pPropertySet);
|
||||
if(FAILED(hr))
|
||||
return false;
|
||||
|
||||
DWORD nSupport = 0;
|
||||
hr = m_pPropertySet->QuerySupport(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_ALLPARAMETERS,
|
||||
&nSupport);
|
||||
if((nSupport != (KSPROPERTY_SUPPORT_GET |
|
||||
KSPROPERTY_SUPPORT_SET)))
|
||||
{
|
||||
SAFE_RELEASE(m_pPropertySet);
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_ALLPARAMETERS,
|
||||
0,
|
||||
0,
|
||||
(void*)(&m_Props),
|
||||
sizeof(EAXBUFFERPROPERTIES));
|
||||
if(FAILED(hr))
|
||||
{
|
||||
SAFE_RELEASE(m_pPropertySet);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEAXBuffer::Destroy()
|
||||
{
|
||||
SAFE_RELEASE(m_pPropertySet);
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetDirect(int iDirect)
|
||||
{
|
||||
m_Props.lDirect = iDirect;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_DIRECT,
|
||||
0,
|
||||
0,
|
||||
&iDirect,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetDirectHF(int iDirectHF)
|
||||
{
|
||||
m_Props.lDirectHF = iDirectHF;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_DIRECTHF,
|
||||
0,
|
||||
0,
|
||||
&iDirectHF,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetRoom(int iRoom)
|
||||
{
|
||||
m_Props.lRoom = iRoom;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_ROOM,
|
||||
0,
|
||||
0,
|
||||
&iRoom,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetRoomHF(int iRoomHF)
|
||||
{
|
||||
m_Props.lRoomHF = iRoomHF;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_ROOMHF,
|
||||
0,
|
||||
0,
|
||||
&iRoomHF,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetRoomRolloffFactor(float fRoomRolloffFactor)
|
||||
{
|
||||
m_Props.flRoomRolloffFactor = fRoomRolloffFactor;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR,
|
||||
0,
|
||||
0,
|
||||
&fRoomRolloffFactor,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetObstruction(int iObstruction)
|
||||
{
|
||||
m_Props.lObstruction = iObstruction;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_OBSTRUCTION,
|
||||
0,
|
||||
0,
|
||||
&iObstruction,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetObstructionLFRatio(float fObstructionLFRatio)
|
||||
{
|
||||
m_Props.flObstructionLFRatio = fObstructionLFRatio;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO,
|
||||
0,
|
||||
0,
|
||||
&fObstructionLFRatio,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetOcclusion(int iOcclusion)
|
||||
{
|
||||
m_Props.lOcclusion = iOcclusion;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSION,
|
||||
0,
|
||||
0,
|
||||
&iOcclusion,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetOcclusionLFRatio(float fOcclusionLFRatio)
|
||||
{
|
||||
m_Props.flOcclusionLFRatio = fOcclusionLFRatio;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO,
|
||||
0,
|
||||
0,
|
||||
&fOcclusionLFRatio,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetOcclusionRoomRatio(float fOcclusionRoomRatio)
|
||||
{
|
||||
m_Props.flOcclusionRoomRatio = fOcclusionRoomRatio;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO,
|
||||
0,
|
||||
0,
|
||||
&fOcclusionRoomRatio,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetOutsideVolumeHF(int iOutsideVolumeHF)
|
||||
{
|
||||
m_Props.lOutsideVolumeHF = iOutsideVolumeHF;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF,
|
||||
0,
|
||||
0,
|
||||
&iOutsideVolumeHF,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetAirAbsorptionFactor(float fAirAbsorptionFactor)
|
||||
{
|
||||
m_Props.flAirAbsorptionFactor = fAirAbsorptionFactor;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR,
|
||||
0,
|
||||
0,
|
||||
&fAirAbsorptionFactor,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetFlags(DWORD nFlags)
|
||||
{
|
||||
m_Props.dwFlags = nFlags;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_FLAGS,
|
||||
0,
|
||||
0,
|
||||
&nFlags,
|
||||
sizeof(DWORD));
|
||||
}
|
||||
|
||||
void CEAXBuffer::SetProperties(const EAXBUFFERPROPERTIES& props)
|
||||
{
|
||||
m_Props = props;
|
||||
if(!m_pPropertySet) return;
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_ALLPARAMETERS,
|
||||
0,
|
||||
0,
|
||||
(void*)(&props),
|
||||
sizeof(EAXBUFFERPROPERTIES));
|
||||
}
|
||||
|
||||
void CEAXBuffer::GetProperties(EAXBUFFERPROPERTIES& props)
|
||||
{
|
||||
/*
|
||||
DWORD nSize;
|
||||
if(m_pPropertySet)
|
||||
{
|
||||
m_pPropertySet->Get(
|
||||
DSPROPSETID_EAX20_BufferProperties,
|
||||
DSPROPERTY_EAXBUFFER_ALLPARAMETERS,
|
||||
0,
|
||||
0,
|
||||
&m_Props,
|
||||
sizeof(EAXBUFFERPROPERTIES),
|
||||
&nSize);
|
||||
}*/
|
||||
|
||||
props = m_Props;
|
||||
}
|
||||
44
Engine/SoundLib/EAXBuffer.h
Normal file
44
Engine/SoundLib/EAXBuffer.h
Normal file
@@ -0,0 +1,44 @@
|
||||
// EAXBuffer.h: interface for the CEAXBuffer class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_EAXBUFFER_H__6BCC188D_ED42_4499_B923_4B61AA73B318__INCLUDED_)
|
||||
#define AFX_EAXBUFFER_H__6BCC188D_ED42_4499_B923_4B61AA73B318__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "dsound.h"
|
||||
#include "eax.h"
|
||||
|
||||
class CEAXBuffer
|
||||
{
|
||||
private:
|
||||
IKsPropertySet* m_pPropertySet;
|
||||
EAXBUFFERPROPERTIES m_Props;
|
||||
|
||||
public:
|
||||
CEAXBuffer();
|
||||
virtual ~CEAXBuffer();
|
||||
|
||||
bool Create( IUnknown* pUnknown );
|
||||
void Destroy();
|
||||
void SetDirect(int iDirect);
|
||||
void SetDirectHF(int iDirectHF);
|
||||
void SetRoom(int iRoom);
|
||||
void SetRoomHF(int iRoomHF);
|
||||
void SetRoomRolloffFactor(float fRoomRolloffFactor);
|
||||
void SetObstruction(int iObstruction);
|
||||
void SetObstructionLFRatio(float fObstructionLFRatio);
|
||||
void SetOcclusion(int iOcclusion);
|
||||
void SetOcclusionLFRatio(float fOcclusionLFRatio);
|
||||
void SetOcclusionRoomRatio(float fOcclusionRoomRatio);
|
||||
void SetOutsideVolumeHF(int iOutsideVolumeHF);
|
||||
void SetAirAbsorptionFactor(float fAirAbsorptionFactor);
|
||||
void SetFlags(DWORD dwFlags);
|
||||
void SetProperties(const EAXBUFFERPROPERTIES& props);
|
||||
void GetProperties(EAXBUFFERPROPERTIES& props);
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_EAXBUFFER_H__6BCC188D_ED42_4499_B923_4B61AA73B318__INCLUDED_)
|
||||
348
Engine/SoundLib/EAXListener.cpp
Normal file
348
Engine/SoundLib/EAXListener.cpp
Normal file
@@ -0,0 +1,348 @@
|
||||
// CEAXListener.cpp: implementation of the CCEAXListener class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "DefineSound.h"
|
||||
#include "EAXListener.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
|
||||
CEAXListener::CEAXListener()
|
||||
{
|
||||
m_pPropertySet = 0;
|
||||
m_Props.lRoom = EAXLISTENER_DEFAULTROOM;
|
||||
m_Props.lRoomHF = EAXLISTENER_DEFAULTROOMHF;
|
||||
m_Props.flRoomRolloffFactor = EAXLISTENER_DEFAULTROOMROLLOFFFACTOR;
|
||||
m_Props.flDecayTime = EAXLISTENER_DEFAULTDECAYTIME;
|
||||
m_Props.flDecayHFRatio = EAXLISTENER_DEFAULTDECAYHFRATIO;
|
||||
m_Props.lReflections = EAXLISTENER_DEFAULTREFLECTIONS;
|
||||
m_Props.flReflectionsDelay = EAXLISTENER_DEFAULTREFLECTIONSDELAY;
|
||||
m_Props.lReverb = EAXLISTENER_DEFAULTREVERB;
|
||||
m_Props.flReverbDelay = EAXLISTENER_DEFAULTREVERBDELAY;
|
||||
m_Props.dwEnvironment = EAXLISTENER_DEFAULTENVIRONMENT;
|
||||
m_Props.flEnvironmentSize = EAXLISTENER_DEFAULTENVIRONMENTSIZE;
|
||||
m_Props.flEnvironmentDiffusion = EAXLISTENER_DEFAULTENVIRONMENTDIFFUSION;
|
||||
m_Props.flAirAbsorptionHF = EAXLISTENER_DEFAULTAIRABSORPTIONHF;
|
||||
m_Props.dwFlags = EAXLISTENER_DEFAULTFLAGS;
|
||||
}
|
||||
|
||||
|
||||
CEAXListener::~CEAXListener()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
bool CEAXListener::Create( IUnknown* pUnknown )
|
||||
{
|
||||
if(!pUnknown)
|
||||
return false;
|
||||
|
||||
HRESULT hr = pUnknown->QueryInterface(IID_IKsPropertySet, (void**)&m_pPropertySet);
|
||||
if(FAILED(hr))
|
||||
return false;
|
||||
|
||||
DWORD nSupport = 0;
|
||||
hr = m_pPropertySet->QuerySupport(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_ALLPARAMETERS,
|
||||
&nSupport);
|
||||
if((nSupport != (KSPROPERTY_SUPPORT_GET |
|
||||
KSPROPERTY_SUPPORT_SET)))
|
||||
{
|
||||
SAFE_RELEASE(m_pPropertySet);
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_ALLPARAMETERS,
|
||||
0,
|
||||
0,
|
||||
(void*)&m_Props,
|
||||
sizeof(EAXLISTENERPROPERTIES));
|
||||
if(FAILED(hr))
|
||||
{
|
||||
SAFE_RELEASE(m_pPropertySet);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CEAXListener::Destroy()
|
||||
{
|
||||
SAFE_RELEASE(m_pPropertySet);
|
||||
}
|
||||
|
||||
|
||||
void CEAXListener::SetRoom(int iRoom)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.lRoom = iRoom;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_ROOM,
|
||||
0,
|
||||
0,
|
||||
&iRoom,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
void CEAXListener::SetRoomHF(int iRoomHF)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.lRoomHF = iRoomHF;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_ROOMHF,
|
||||
0,
|
||||
0,
|
||||
&iRoomHF,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
void CEAXListener::SetRoomRolloffFactor(float fRoomRolloffFactor)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.flRoomRolloffFactor = fRoomRolloffFactor;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR,
|
||||
0,
|
||||
0,
|
||||
&fRoomRolloffFactor,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXListener::SetDecayTime(float fDecayTime)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.flDecayTime = fDecayTime;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_DECAYTIME,
|
||||
0,
|
||||
0,
|
||||
&fDecayTime,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXListener::SetDecayHFRatio(float fDecayHFRatio)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.flDecayHFRatio = fDecayHFRatio;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_DECAYHFRATIO,
|
||||
0,
|
||||
0,
|
||||
&fDecayHFRatio,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXListener::SetReflections(int iReflections)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.lReflections = iReflections;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_REFLECTIONS,
|
||||
0,
|
||||
0,
|
||||
&iReflections,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
void CEAXListener::SetReflectionsDelay(float fReflectionsDelay)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.flReflectionsDelay = fReflectionsDelay;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY,
|
||||
0,
|
||||
0,
|
||||
&fReflectionsDelay,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXListener::SetReverb(int iReverb)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.lReverb = iReverb;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_REVERB,
|
||||
0,
|
||||
0,
|
||||
&iReverb,
|
||||
sizeof(int));
|
||||
}
|
||||
|
||||
void CEAXListener::SetReverbDelay(float fReverbDelay)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.flReverbDelay = fReverbDelay;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_REVERBDELAY,
|
||||
0,
|
||||
0,
|
||||
&fReverbDelay,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXListener::SetEnvironment(DWORD nEnvironment)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.dwEnvironment = nEnvironment;
|
||||
|
||||
/*===========================
|
||||
EAX_ENVIRONMENT_GENERIC
|
||||
EAX_ENVIRONMENT_PADDEDCELL
|
||||
EAX_ENVIRONMENT_ROOM
|
||||
EAX_ENVIRONMENT_BATHROOM
|
||||
EAX_ENVIRONMENT_LIVINGROOM
|
||||
EAX_ENVIRONMENT_STONEROOM
|
||||
EAX_ENVIRONMENT_AUDITORIUM
|
||||
EAX_ENVIRONMENT_CONCERTHALL
|
||||
EAX_ENVIRONMENT_CAVE
|
||||
EAX_ENVIRONMENT_ARENA
|
||||
EAX_ENVIRONMENT_HANGAR
|
||||
EAX_ENVIRONMENT_CARPETEDHALLWAY
|
||||
EAX_ENVIRONMENT_HALLWAY
|
||||
EAX_ENVIRONMENT_STONECORRIDOR
|
||||
EAX_ENVIRONMENT_ALLEY
|
||||
EAX_ENVIRONMENT_FOREST
|
||||
EAX_ENVIRONMENT_CITY
|
||||
EAX_ENVIRONMENT_MOUNTAINS
|
||||
EAX_ENVIRONMENT_QUARRY
|
||||
EAX_ENVIRONMENT_PLAIN
|
||||
EAX_ENVIRONMENT_PARKINGLOT
|
||||
EAX_ENVIRONMENT_SEWERPIPE
|
||||
EAX_ENVIRONMENT_UNDERWATER
|
||||
EAX_ENVIRONMENT_DRUGGED
|
||||
EAX_ENVIRONMENT_DIZZY
|
||||
EAX_ENVIRONMENT_PSYCHOTIC
|
||||
=============================*/
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENT,
|
||||
0,
|
||||
0,
|
||||
&nEnvironment,
|
||||
sizeof(DWORD));
|
||||
}
|
||||
|
||||
void CEAXListener::SetEnvironmentSize(float fEnvironmentSize)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.flEnvironmentSize = fEnvironmentSize;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE,
|
||||
0,
|
||||
0,
|
||||
&fEnvironmentSize,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXListener::SetEnvironmentDiffusion(float fEnvironmentDiffusion)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.flEnvironmentDiffusion = fEnvironmentDiffusion;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION,
|
||||
0,
|
||||
0,
|
||||
&fEnvironmentDiffusion,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXListener::SetAirAbsorptionHF(float fAirAbsorptionHF)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.flAirAbsorptionHF = fAirAbsorptionHF;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF,
|
||||
0,
|
||||
0,
|
||||
&fAirAbsorptionHF,
|
||||
sizeof(float));
|
||||
}
|
||||
|
||||
void CEAXListener::SetFlags(DWORD nFlags)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props.dwFlags = nFlags;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_FLAGS,
|
||||
0,
|
||||
0,
|
||||
&nFlags,
|
||||
sizeof(DWORD));
|
||||
}
|
||||
|
||||
void CEAXListener::SetProperties(const EAXLISTENERPROPERTIES& props)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
m_Props = props;
|
||||
|
||||
m_pPropertySet->Set(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_ALLPARAMETERS,
|
||||
0,
|
||||
0,
|
||||
(void*)&props,
|
||||
sizeof(EAXLISTENERPROPERTIES));
|
||||
}
|
||||
|
||||
void CEAXListener::GetProperties(EAXLISTENERPROPERTIES& props)
|
||||
{
|
||||
if(!m_pPropertySet) return;
|
||||
|
||||
/*DWORD nSize;
|
||||
m_pPropertySet->Get(
|
||||
DSPROPSETID_EAX20_ListenerProperties,
|
||||
DSPROPERTY_EAXLISTENER_ALLPARAMETERS,
|
||||
0,
|
||||
0,
|
||||
&props,
|
||||
sizeof(EAXLISTENERPROPERTIES),
|
||||
&nSize);*/
|
||||
|
||||
props = m_Props;
|
||||
}
|
||||
45
Engine/SoundLib/EAXListener.h
Normal file
45
Engine/SoundLib/EAXListener.h
Normal file
@@ -0,0 +1,45 @@
|
||||
// EAXListener.h: interface for the CEAXListener class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_EAXLISTENER_H__2EAC4DBE_7D26_4C60_8206_B2034CAD2022__INCLUDED_)
|
||||
#define AFX_EAXLISTENER_H__2EAC4DBE_7D26_4C60_8206_B2034CAD2022__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "dsound.h"
|
||||
#include "eax.h"
|
||||
|
||||
class CEAXListener
|
||||
{
|
||||
protected:
|
||||
IKsPropertySet* m_pPropertySet;
|
||||
EAXLISTENERPROPERTIES m_Props;
|
||||
|
||||
public:
|
||||
CEAXListener();
|
||||
virtual ~CEAXListener();
|
||||
|
||||
bool Create( IUnknown* pUnknown );
|
||||
void Destroy();
|
||||
void SetRoom(int iRoom);
|
||||
void SetRoomHF(int iRoomHF);
|
||||
void SetRoomRolloffFactor(float fRoomRolloffFactor);
|
||||
void SetDecayTime(float fDecayTime);
|
||||
void SetDecayHFRatio(float fDecayHFRatio);
|
||||
void SetReflections(int iReflections);
|
||||
void SetReflectionsDelay(float fReflectionsDelay);
|
||||
void SetReverb(int iReverb);
|
||||
void SetReverbDelay(float fReverbDelay);
|
||||
void SetEnvironment(DWORD dwEnvironment);
|
||||
void SetEnvironmentSize(float fEnvironmentSize);
|
||||
void SetEnvironmentDiffusion(float fEnvironmentDiffusion);
|
||||
void SetAirAbsorptionHF(float fAirAbsorption);
|
||||
void SetFlags(DWORD dwFlags);
|
||||
void SetProperties(const EAXLISTENERPROPERTIES& props);
|
||||
void GetProperties(EAXLISTENERPROPERTIES& props);
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_EAXLISTENER_H__2EAC4DBE_7D26_4C60_8206_B2034CAD2022__INCLUDED_)
|
||||
183
Engine/SoundLib/Listener.cpp
Normal file
183
Engine/SoundLib/Listener.cpp
Normal file
@@ -0,0 +1,183 @@
|
||||
// Listener.cpp: implementation of the CListener class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "DefineSound.h"
|
||||
#include "SoundMgr.h"
|
||||
#include "Listener.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
CListener::CListener( LPDIRECTSOUND8 pDS ) : m_pListener(NULL), m_pDSBuffer(NULL)
|
||||
{
|
||||
Create( pDS );
|
||||
}
|
||||
|
||||
|
||||
CListener::~CListener()
|
||||
{
|
||||
Destory();
|
||||
}
|
||||
|
||||
|
||||
void CListener::Create( LPDIRECTSOUND8 pDS )
|
||||
{
|
||||
DSBUFFERDESC dsbdesc;
|
||||
LPDIRECTSOUNDBUFFER pDSBPrimary = NULL;
|
||||
|
||||
ZeroMemory( &dsbdesc, sizeof(DSBUFFERDESC) );
|
||||
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
|
||||
dsbdesc.dwFlags = DSBCAPS_CTRL3D | DSBCAPS_PRIMARYBUFFER;
|
||||
|
||||
if( FAILED(pDS->CreateSoundBuffer(&dsbdesc, &pDSBPrimary, NULL)) )
|
||||
{
|
||||
MessageBox( NULL, "FAILED(pDS->CreateSoundBuffer(&dsbdesc, &pDSBPrimary, NULL))",
|
||||
"CListener::Create", MB_OK );
|
||||
SAFE_RELEASE( pDSBPrimary );
|
||||
Destory();
|
||||
return;
|
||||
}
|
||||
|
||||
if( FAILED(pDSBPrimary->QueryInterface(IID_IDirectSound3DListener8,
|
||||
(VOID**)&m_pListener)) )
|
||||
{
|
||||
SAFE_RELEASE( pDSBPrimary );
|
||||
MessageBox( NULL, "FAILED(pDSBPrimary->QueryInterface",
|
||||
"CListener::Create", MB_OK );
|
||||
SAFE_RELEASE( pDSBPrimary );
|
||||
Destory();
|
||||
return;
|
||||
}
|
||||
|
||||
m_Prop.dwSize = sizeof(DS3DLISTENER);
|
||||
m_pListener->GetAllParameters( &m_Prop );
|
||||
SAFE_RELEASE( pDSBPrimary );
|
||||
|
||||
//=============================
|
||||
// EAX Listener
|
||||
//=============================
|
||||
if( CSoundMgr::_GetInstance()->GetInitProp()->m_bUseEAX == false ) return;
|
||||
|
||||
WAVEFORMATEX wf;
|
||||
memset(&wf, 0, sizeof(WAVEFORMATEX));
|
||||
wf.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wf.nChannels = 1;
|
||||
wf.nSamplesPerSec = 22050;
|
||||
wf.nBlockAlign = 2;
|
||||
wf.nAvgBytesPerSec = wf.nSamplesPerSec * wf.nBlockAlign;
|
||||
wf.wBitsPerSample = 16;
|
||||
|
||||
DSBUFFERDESC desc;
|
||||
ZeroMemory(&desc, sizeof(desc));
|
||||
desc.dwSize = sizeof(desc);
|
||||
desc.dwFlags = DSBCAPS_LOCHARDWARE | DSBCAPS_CTRL3D;
|
||||
desc.lpwfxFormat = &wf;
|
||||
desc.dwBufferBytes = 1024;
|
||||
|
||||
LPDIRECTSOUNDBUFFER pDSBuffer = NULL;
|
||||
if( FAILED(pDS->CreateSoundBuffer(&desc, &pDSBuffer, NULL)) )
|
||||
{
|
||||
MessageBox( NULL, "Not Use EAX!", "Fail!", MB_OK );
|
||||
return;
|
||||
}
|
||||
|
||||
if( FAILED(pDSBuffer->QueryInterface(IID_IDirectSoundBuffer8, (void**)&m_pDSBuffer)) )
|
||||
{
|
||||
MessageBox( NULL, "FAILED(pDSBuffer->QueryInterface",
|
||||
"CListener::Create", MB_OK );
|
||||
return;
|
||||
}
|
||||
|
||||
SAFE_RELEASE(pDSBuffer);
|
||||
|
||||
//Success
|
||||
m_EAXListener.Create( m_pDSBuffer );
|
||||
}
|
||||
|
||||
|
||||
void CListener::Destory()
|
||||
{
|
||||
SAFE_RELEASE( m_pDSBuffer );
|
||||
SAFE_RELEASE( m_pListener );
|
||||
}
|
||||
|
||||
|
||||
void CListener::Update()
|
||||
{
|
||||
m_pListener->SetAllParameters( &m_Prop, DS3D_IMMEDIATE );
|
||||
}
|
||||
|
||||
|
||||
void CListener::SetDistanceFactor( float fDistanceFactor )
|
||||
{
|
||||
m_Prop.flDistanceFactor = fDistanceFactor;
|
||||
}
|
||||
|
||||
|
||||
void CListener::SetDopplerFactor( float fDopplerFactor )
|
||||
{
|
||||
m_Prop.flDopplerFactor = fDopplerFactor;
|
||||
}
|
||||
|
||||
|
||||
void CListener::SetOrientation( D3DVECTOR& vFront, D3DVECTOR& vTop )
|
||||
{
|
||||
memcpy( &m_Prop.vOrientFront, &vFront, sizeof(D3DVECTOR) );
|
||||
memcpy( &m_Prop.vOrientTop, &vTop, sizeof(D3DVECTOR) );
|
||||
}
|
||||
|
||||
|
||||
void CListener::SetPosition( D3DVECTOR& vPos )
|
||||
{
|
||||
memcpy( &m_Prop.vPosition, &vPos, sizeof(D3DVECTOR) );
|
||||
}
|
||||
|
||||
|
||||
void CListener::SetRolloffFactor( float fRolloffFactor )
|
||||
{
|
||||
m_Prop.flRolloffFactor = fRolloffFactor;
|
||||
}
|
||||
|
||||
|
||||
void CListener::SetVelocity( D3DVECTOR& vVel )
|
||||
{
|
||||
memcpy( &m_Prop.vVelocity, &vVel, sizeof(D3DVECTOR) );
|
||||
}
|
||||
|
||||
|
||||
void CListener::GetDistanceFactor( float& fDistanceFactor )
|
||||
{
|
||||
fDistanceFactor = m_Prop.flDistanceFactor;
|
||||
}
|
||||
|
||||
|
||||
void CListener::GetDopplerFactor( float& fDopplerFactor )
|
||||
{
|
||||
fDopplerFactor = m_Prop.flDopplerFactor;
|
||||
}
|
||||
|
||||
|
||||
void CListener::GetOrientation( D3DVECTOR& vFront, D3DVECTOR& vTop )
|
||||
{
|
||||
memcpy( &vFront, &m_Prop.vOrientFront, sizeof(D3DVECTOR) );
|
||||
memcpy( &vTop, &m_Prop.vOrientTop, sizeof(D3DVECTOR) );
|
||||
}
|
||||
|
||||
|
||||
void CListener::GetPosition( D3DVECTOR& vPos )
|
||||
{
|
||||
memcpy( &vPos, &m_Prop.vPosition, sizeof(D3DVECTOR) );
|
||||
}
|
||||
|
||||
|
||||
void CListener::GetRolloffFactor( float& fRolloffFactor )
|
||||
{
|
||||
fRolloffFactor = m_Prop.flRolloffFactor;
|
||||
}
|
||||
|
||||
|
||||
void CListener::GetVelocity( D3DVECTOR& vVel )
|
||||
{
|
||||
memcpy( &vVel, &m_Prop.vVelocity, sizeof(D3DVECTOR) );
|
||||
}
|
||||
|
||||
|
||||
53
Engine/SoundLib/Listener.h
Normal file
53
Engine/SoundLib/Listener.h
Normal file
@@ -0,0 +1,53 @@
|
||||
// Listener.h: interface for the CListener class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_LISTENER_H__FE18A847_15A9_41C1_AD4D_E368D6D1A346__INCLUDED_)
|
||||
#define AFX_LISTENER_H__FE18A847_15A9_41C1_AD4D_E368D6D1A346__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include <dsound.h>
|
||||
#include "EAXListener.h"
|
||||
|
||||
class CListener
|
||||
{
|
||||
protected:
|
||||
LPDIRECTSOUND3DLISTENER8 m_pListener;
|
||||
LPDIRECTSOUNDBUFFER8 m_pDSBuffer;
|
||||
DS3DLISTENER m_Prop;
|
||||
CEAXListener m_EAXListener;
|
||||
|
||||
protected:
|
||||
void Create( LPDIRECTSOUND8 pDS );
|
||||
void Destory();
|
||||
|
||||
public:
|
||||
CListener( LPDIRECTSOUND8 pDS );
|
||||
virtual ~CListener();
|
||||
|
||||
void Update();
|
||||
CEAXListener* GetEAX() { return &m_EAXListener; };
|
||||
|
||||
void SetPosition(D3DVECTOR& vPos);
|
||||
void GetPosition(D3DVECTOR& vPos);
|
||||
|
||||
void SetVelocity(D3DVECTOR& vVel);
|
||||
void GetVelocity(D3DVECTOR& vVel);
|
||||
|
||||
void SetOrientation(D3DVECTOR& vFront, D3DVECTOR& vTop);
|
||||
void GetOrientation(D3DVECTOR& vFront, D3DVECTOR& vTop);
|
||||
|
||||
void SetDistanceFactor(float fDistanceFactor);
|
||||
void GetDistanceFactor(float& fDistanceFactor);
|
||||
|
||||
void SetDopplerFactor(float fDopplerFactor);
|
||||
void GetDopplerFactor(float& fDopplerFactor);
|
||||
|
||||
void SetRolloffFactor(float fRolloffFactor);
|
||||
void GetRolloffFactor(float& fRolloffFactor);
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_LISTENER_H__FE18A847_15A9_41C1_AD4D_E368D6D1A346__INCLUDED_)
|
||||
132
Engine/SoundLib/OggLoader.cpp
Normal file
132
Engine/SoundLib/OggLoader.cpp
Normal file
@@ -0,0 +1,132 @@
|
||||
// OggLoader.cpp: implementation of the COggLoader class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "OggLoader.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
COggLoader::COggLoader() : m_dwBufferSize(0),
|
||||
m_dwNumSamples(0),
|
||||
m_pVorbisInfo(NULL),
|
||||
m_bEOF(false),
|
||||
m_bOpen(false),
|
||||
m_pFP(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
COggLoader::~COggLoader()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
bool COggLoader::Open( char* strFileName )
|
||||
{
|
||||
if(m_bOpen) return false;
|
||||
|
||||
if( (m_pFP = fopen( strFileName, "rb" )) == NULL)
|
||||
return false;
|
||||
|
||||
m_bOpen = true;
|
||||
if (ov_open(m_pFP, &m_VorbisFile, NULL, 0) < 0)
|
||||
{
|
||||
char buf[MAX_PATH] = {0};
|
||||
sprintf( buf, "해당파일을 열수가 없습니다. : %s \n COggLoader::Open", strFileName );
|
||||
MessageBox( NULL, buf, "사운드에러", MB_OK );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !GetStreamInfo() )
|
||||
{
|
||||
char buf[MAX_PATH] = {0};
|
||||
sprintf( buf, "해당파일의 스트림정보를 얻어올수 없습니다. : %s \n COggLoader::Open", strFileName );
|
||||
MessageBox( NULL, buf, "사운드에러", MB_OK );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool COggLoader::Close()
|
||||
{
|
||||
if(!m_bOpen) return false;
|
||||
|
||||
if( ov_clear(&m_VorbisFile) < 0 )
|
||||
return false;
|
||||
|
||||
if( m_pFP ) fclose( m_pFP );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool COggLoader::Read( BYTE* pBuffer, DWORD dwSizeToRead, DWORD* pdwSizeRead )
|
||||
{
|
||||
if(!m_bOpen) return false;
|
||||
|
||||
char* pCurBuffer = (char*)pBuffer;
|
||||
DWORD dwBytesRead = 0;
|
||||
int iSection = 0;
|
||||
while( (dwBytesRead < dwSizeToRead) && !m_bEOF )
|
||||
{
|
||||
int iRet = ov_read(&m_VorbisFile, pCurBuffer, dwSizeToRead - dwBytesRead, 0, 2, 1, &iSection);
|
||||
if (iRet == 0 || iSection != 0)
|
||||
{
|
||||
m_bEOF = true;
|
||||
}
|
||||
else if (iRet < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
dwBytesRead += iRet;
|
||||
pCurBuffer += iRet;
|
||||
}
|
||||
|
||||
*pdwSizeRead = dwBytesRead;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool COggLoader::Reset()
|
||||
{
|
||||
if(!m_bOpen)
|
||||
return false;
|
||||
|
||||
m_bEOF = false;
|
||||
ov_pcm_seek(&m_VorbisFile, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
DWORD COggLoader::GetSize()
|
||||
{
|
||||
return m_dwNumSamples * m_WaveFormatEx.nChannels * m_WaveFormatEx.wBitsPerSample / 8;
|
||||
}
|
||||
|
||||
|
||||
bool COggLoader::GetStreamInfo()
|
||||
{
|
||||
// Get vorbis file information
|
||||
m_pVorbisInfo = ov_info(&m_VorbisFile,-1);
|
||||
|
||||
if( !m_pVorbisInfo ) return false;
|
||||
|
||||
// Get the number of PCM samples in this file
|
||||
m_dwNumSamples = (long)ov_pcm_total(&m_VorbisFile,-1);
|
||||
|
||||
// set up the WaveFormatEx structure
|
||||
m_WaveFormatEx.wFormatTag = WAVE_FORMAT_PCM;
|
||||
m_WaveFormatEx.nChannels = m_pVorbisInfo->channels;
|
||||
m_WaveFormatEx.nSamplesPerSec = m_pVorbisInfo->rate;
|
||||
m_WaveFormatEx.wBitsPerSample = 16;
|
||||
m_WaveFormatEx.nBlockAlign = m_WaveFormatEx.nChannels * m_WaveFormatEx.wBitsPerSample / 8;
|
||||
m_WaveFormatEx.nAvgBytesPerSec = m_WaveFormatEx.nSamplesPerSec * m_WaveFormatEx.nBlockAlign;
|
||||
m_WaveFormatEx.cbSize = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
45
Engine/SoundLib/OggLoader.h
Normal file
45
Engine/SoundLib/OggLoader.h
Normal file
@@ -0,0 +1,45 @@
|
||||
// OggLoader.h: interface for the COggLoader class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_OGGLOADER_H__EDD0A382_ACBB_4E9B_974E_02D96D520340__INCLUDED_)
|
||||
#define AFX_OGGLOADER_H__EDD0A382_ACBB_4E9B_974E_02D96D520340__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "Common.h"
|
||||
#include <dsound.h>
|
||||
#include <vorbis/codec.h>
|
||||
#include <vorbis/vorbisfile.h>
|
||||
|
||||
class COggLoader
|
||||
{
|
||||
public:
|
||||
DWORD m_dwBufferSize;
|
||||
DWORD m_dwNumSamples;
|
||||
vorbis_info* m_pVorbisInfo;
|
||||
bool m_bEOF;
|
||||
bool m_bOpen;
|
||||
FILE* m_pFP;
|
||||
|
||||
WAVEFORMATEX m_WaveFormatEx;
|
||||
OggVorbis_File m_VorbisFile;
|
||||
|
||||
public:
|
||||
COggLoader();
|
||||
virtual ~COggLoader();
|
||||
|
||||
void Init();
|
||||
bool Open( char* strFileName);
|
||||
bool Close();
|
||||
bool Read( BYTE* pBuffer, DWORD dwSizeToRead, DWORD* pdwSizeRead );
|
||||
DWORD GetSize();
|
||||
bool Reset();
|
||||
WAVEFORMATEX* GetFormat() { return &m_WaveFormatEx; };
|
||||
bool IsEOF() { return m_bEOF; };
|
||||
bool GetStreamInfo();
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_OGGLOADER_H__EDD0A382_ACBB_4E9B_974E_02D96D520340__INCLUDED_)
|
||||
21
Engine/SoundLib/ReadMe.txt
Normal file
21
Engine/SoundLib/ReadMe.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
========================================================================
|
||||
정적 라이브러리 : SoundLib 프로젝트 개요
|
||||
========================================================================
|
||||
|
||||
응용 프로그램 마법사에서 이 SoundLib 라이브러리 프로젝트를 만들었습니다.
|
||||
프로젝트에 대해 소스 파일은 만들어지지 않았습니다.
|
||||
|
||||
|
||||
SoundLib.vcproj
|
||||
응용 프로그램 마법사를 사용하여 생성한 VC++ 프로젝트의 기본 프로젝트 파일입니다.
|
||||
해당 파일을 생성한 Visual C++의 버전 정보를 비롯하여
|
||||
응용 프로그램 마법사에서 선택한 플랫폼, 구성 및
|
||||
프로젝트 기능에 대한 정보가 들어 있습니다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
기타 참고:
|
||||
|
||||
응용 프로그램 마법사에서 사용하는 "TODO:" 주석은 사용자가 추가하거나 사용자 지정해야 하는
|
||||
소스 코드 부분을 나타냅니다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
367
Engine/SoundLib/Sound.cpp
Normal file
367
Engine/SoundLib/Sound.cpp
Normal file
@@ -0,0 +1,367 @@
|
||||
// Sound.cpp: implementation of the CSound class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "WaveLoader.h"
|
||||
#include "Sound.h"
|
||||
#include "SoundMgr.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
CSound::CSound() : m_ppDSBuffer( NULL ),
|
||||
m_pWaveFile( NULL ),
|
||||
m_dwNumBuffers( 0 ),
|
||||
m_dwDSBufferSize( 0 ),
|
||||
m_bSound3D( false ),
|
||||
m_bLoop( false ),
|
||||
m_fVolume( VOLUME_MAX ),
|
||||
m_dwLastPlayTime( 0 ),
|
||||
m_dwLatestPlayIndex( 0 ),
|
||||
m_iPreserveScore( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CSound::~CSound()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
HRESULT CSound::RestoreBuffer( LPDIRECTSOUNDBUFFER pDSB, bool* pbWasRestored )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if( pDSB == NULL )
|
||||
return CO_E_NOTINITIALIZED;
|
||||
if( pbWasRestored )
|
||||
*pbWasRestored = FALSE;
|
||||
|
||||
DWORD dwStatus;
|
||||
if( FAILED( hr = pDSB->GetStatus( &dwStatus ) ) )
|
||||
return E_FAIL;
|
||||
|
||||
if( dwStatus & DSBSTATUS_BUFFERLOST )
|
||||
{
|
||||
do
|
||||
{
|
||||
hr = pDSB->Restore();
|
||||
if( hr == DSERR_BUFFERLOST )
|
||||
Sleep( 10 );
|
||||
}
|
||||
while( ( hr = pDSB->Restore() ) == DSERR_BUFFERLOST );
|
||||
|
||||
if( pbWasRestored != NULL )
|
||||
*pbWasRestored = TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LPDIRECTSOUNDBUFFER CSound::GetFreeBuffer()
|
||||
{
|
||||
if( m_ppDSBuffer == NULL )
|
||||
return FALSE;
|
||||
|
||||
DWORD i=0;
|
||||
for( ; i<m_dwNumBuffers; i++ )
|
||||
{
|
||||
if( m_ppDSBuffer[i] )
|
||||
{
|
||||
DWORD dwStatus = 0;
|
||||
m_ppDSBuffer[i]->GetStatus( &dwStatus );
|
||||
if ( ( dwStatus & DSBSTATUS_PLAYING ) == 0 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( i != m_dwNumBuffers )
|
||||
{
|
||||
m_dwLatestPlayIndex = i;
|
||||
return m_ppDSBuffer[ i ];
|
||||
}
|
||||
else
|
||||
return m_ppDSBuffer[ rand() % m_dwNumBuffers ];
|
||||
}
|
||||
|
||||
|
||||
LPDIRECTSOUNDBUFFER CSound::GetBuffer( DWORD dwIndex )
|
||||
{
|
||||
if( m_ppDSBuffer == NULL )
|
||||
return NULL;
|
||||
if( dwIndex >= m_dwNumBuffers )
|
||||
return NULL;
|
||||
|
||||
return m_ppDSBuffer[dwIndex];
|
||||
}
|
||||
|
||||
|
||||
void CSound::Stop()
|
||||
{
|
||||
HRESULT hr = 0;
|
||||
|
||||
for( DWORD i=0; i<m_dwNumBuffers; i++ )
|
||||
hr |= m_ppDSBuffer[i]->Stop();
|
||||
|
||||
if( FAILED(hr) )
|
||||
MessageBox( NULL, "hr |= m_ppDSBuffer[i]->Stop()", "CSound::Stop", MB_OK );
|
||||
}
|
||||
|
||||
|
||||
void CSound::Reset()
|
||||
{
|
||||
HRESULT hr = 0;
|
||||
|
||||
for( DWORD i=0; i<m_dwNumBuffers; i++ )
|
||||
hr |= m_ppDSBuffer[i]->SetCurrentPosition( 0 );
|
||||
|
||||
if( FAILED(hr) )
|
||||
MessageBox( NULL, "hr |= m_ppDSBuffer[i]->SetCurrentPosition",
|
||||
"CSound::Stop", MB_OK );
|
||||
}
|
||||
|
||||
|
||||
bool CSound::IsPlaying()
|
||||
{
|
||||
bool bIsPlaying = false;
|
||||
|
||||
if( m_ppDSBuffer == NULL )
|
||||
return false;
|
||||
|
||||
for( DWORD i=0; i<m_dwNumBuffers; i++ )
|
||||
{
|
||||
if( m_ppDSBuffer[i] )
|
||||
{
|
||||
DWORD dwStatus = 0;
|
||||
m_ppDSBuffer[i]->GetStatus( &dwStatus );
|
||||
bIsPlaying |= ( ( dwStatus & DSBSTATUS_PLAYING ) != 0 );
|
||||
}
|
||||
}
|
||||
|
||||
return bIsPlaying;
|
||||
}
|
||||
|
||||
|
||||
bool CSound::Create( const char* strFileName, DWORD dwNumBuffers )
|
||||
{
|
||||
DWORD i;
|
||||
DWORD dwDSBufferSize = NULL;
|
||||
m_dwNumBuffers = dwNumBuffers;
|
||||
|
||||
LPDIRECTSOUND8 pDS = CSoundMgr::_GetInstance()->GetDirectSound();
|
||||
m_ppDSBuffer = new LPDIRECTSOUNDBUFFER8[dwNumBuffers];
|
||||
for( i = 0; i < dwNumBuffers; ++i )
|
||||
{
|
||||
m_ppDSBuffer[i] = 0;
|
||||
}
|
||||
m_pWaveFile = new CWaveLoader;
|
||||
|
||||
if( FAILED(m_pWaveFile->Open((LPSTR)strFileName, NULL, WAVEFILE_READ)) )
|
||||
{
|
||||
char buf[MAX_PATH] = {0};
|
||||
sprintf( buf, "해당 파일을 열수가 없습니다. : %s \n CSound::Create", strFileName );
|
||||
MessageBox( NULL, buf, "사운드에러", MB_OK );
|
||||
SAFE_DELETE(m_pWaveFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_dwDSBufferSize = m_pWaveFile->GetSize();
|
||||
|
||||
WAVEFORMATEX wfx;
|
||||
ZeroMemory( &wfx, sizeof(WAVEFORMATEX) );
|
||||
wfx.nChannels = m_pWaveFile->m_pwfx->nChannels;
|
||||
wfx.nSamplesPerSec = m_pWaveFile->m_pwfx->nSamplesPerSec;
|
||||
wfx.wBitsPerSample = m_pWaveFile->m_pwfx->wBitsPerSample;
|
||||
wfx.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wfx.nBlockAlign = wfx.wBitsPerSample / 8 * wfx.nChannels;
|
||||
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
|
||||
|
||||
if( m_bSound3D && wfx.nChannels != 1 )
|
||||
{
|
||||
MessageBox( NULL, "3DSound Only Acquire One Channel", "Sound::Create", MB_OK );
|
||||
wfx.nChannels = 1;
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
//Create Buffer
|
||||
DSBUFFERDESC dsbd;
|
||||
ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) );
|
||||
dsbd.dwSize = sizeof(DSBUFFERDESC);
|
||||
dsbd.dwFlags = DSBCAPS_CTRLVOLUME;
|
||||
if( m_bSound3D ) dsbd.dwFlags |= DSBCAPS_CTRL3D|DSBCAPS_MUTE3DATMAXDISTANCE;
|
||||
dsbd.dwBufferBytes = m_dwDSBufferSize;
|
||||
dsbd.guid3DAlgorithm = m_bSound3D ? CSoundMgr::_GetInstance()->GetInitProp()->m_guidSound3DAlgorithm : GUID_NULL;
|
||||
dsbd.lpwfxFormat = &wfx;
|
||||
|
||||
|
||||
//========================================
|
||||
LPDIRECTSOUNDBUFFER tempBuffer;
|
||||
if( FAILED(pDS->CreateSoundBuffer( &dsbd, &tempBuffer, NULL )) )
|
||||
{
|
||||
//MessageBox( NULL, "pDS->CreateSoundBuffer( &dsbd, &tempBuffer, NULL )", "CSound::Create", MB_OK );
|
||||
SAFE_RELEASE( tempBuffer );
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
if( FAILED(tempBuffer->QueryInterface( IID_IDirectSoundBuffer8, (LPVOID*)m_ppDSBuffer )) )
|
||||
{
|
||||
//MessageBox( NULL, "pDS->CreateSoundBuffer( &dsbd, &tempBuffer, NULL )", "CSound::Create", MB_OK );
|
||||
SAFE_RELEASE( tempBuffer );
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
SAFE_RELEASE(tempBuffer)
|
||||
|
||||
for( i = 1; i < dwNumBuffers; i++ )
|
||||
{
|
||||
if( FAILED(pDS->DuplicateSoundBuffer( m_ppDSBuffer[0], (LPDIRECTSOUNDBUFFER*)&m_ppDSBuffer[i])) )
|
||||
{
|
||||
//MessageBox( NULL, "pDS->DuplicateSoundBuffer( m_ppDSBuffer[0], &m_ppDSBuffer[i])",
|
||||
// "CSound::Create", MB_OK );
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
FillBuffer( m_ppDSBuffer[0] );
|
||||
//===============================================
|
||||
|
||||
|
||||
/*
|
||||
if( FAILED(pDS->CreateSoundBuffer( &dsbd, &m_ppDSBuffer[0], NULL )) )
|
||||
{
|
||||
//MessageBox( NULL, "pDS->CreateSoundBuffer( &dsbd, &m_ppDSBuffer[0], NULL )",
|
||||
// "CSound::Create", MB_OK );
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
for( i = 1; i < dwNumBuffers; i++ )
|
||||
{
|
||||
if( FAILED(pDS->DuplicateSoundBuffer( m_ppDSBuffer[0], &m_ppDSBuffer[i])) )
|
||||
{
|
||||
//MessageBox( NULL, "pDS->DuplicateSoundBuffer( m_ppDSBuffer[0], &m_ppDSBuffer[i])",
|
||||
// "CSound::Create", MB_OK );
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
FillBuffer( m_ppDSBuffer[0] );
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CSound::Destroy()
|
||||
{
|
||||
for( DWORD i = 0; i < m_dwNumBuffers; i++ )
|
||||
{
|
||||
SAFE_RELEASE( m_ppDSBuffer[i] );
|
||||
}
|
||||
|
||||
SAFE_DELETE_ARRAY( m_ppDSBuffer );
|
||||
SAFE_DELETE( m_pWaveFile );
|
||||
}
|
||||
|
||||
|
||||
void CSound::Play()
|
||||
{
|
||||
if( 0 == this )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_dwLastPlayTime = timeGetTime();
|
||||
|
||||
bool bRestored;
|
||||
LPDIRECTSOUNDBUFFER pDSB = GetFreeBuffer();
|
||||
|
||||
if( FAILED(RestoreBuffer(pDSB, &bRestored)) )
|
||||
{
|
||||
MessageBox(NULL, "FAILED(RestoreBuffer(pDSB, &bRestored))",
|
||||
"CSound::Play", MB_OK );
|
||||
return;
|
||||
}
|
||||
|
||||
if( bRestored )
|
||||
{
|
||||
FillBuffer( pDSB );
|
||||
}
|
||||
|
||||
SetVolume(pDSB, m_fVolume);
|
||||
|
||||
pDSB->Play(0,0, m_bLoop ? DSBPLAY_LOOPING:0 );
|
||||
}
|
||||
|
||||
|
||||
void CSound::FillBuffer( LPDIRECTSOUNDBUFFER pDSBuffer )
|
||||
{
|
||||
VOID* pDSLockedBuffer = NULL;
|
||||
DWORD dwDSLockedBufferSize = 0;
|
||||
DWORD dwWavDataRead = 0;
|
||||
|
||||
if( FAILED(RestoreBuffer( pDSBuffer, NULL)) )
|
||||
{
|
||||
MessageBox( NULL, "FAILED(RestoreBuffer( pDSBuffer, NULL))",
|
||||
"CSound::FillBuffer", MB_OK );
|
||||
return;
|
||||
}
|
||||
|
||||
if( FAILED(pDSBuffer->Lock(0, 0, &pDSLockedBuffer, &dwDSLockedBufferSize,
|
||||
NULL, NULL, DSBLOCK_ENTIREBUFFER ) ) )
|
||||
{
|
||||
MessageBox( NULL, "FAILED(pDSBuffer->Lock", "CSound::FillBuffer", MB_OK );
|
||||
return;
|
||||
}
|
||||
|
||||
m_pWaveFile->ResetFile();
|
||||
|
||||
if( FAILED(m_pWaveFile->Read((BYTE*)pDSLockedBuffer, dwDSLockedBufferSize, &dwWavDataRead)) )
|
||||
{
|
||||
MessageBox( NULL, "FAILED(m_pWaveFile->Read", "CSound::FillBuffer", MB_OK );
|
||||
return;
|
||||
}
|
||||
|
||||
if( dwWavDataRead == 0 )
|
||||
{
|
||||
MessageBox( NULL, "dwWavDataRead == 0", "CSound::FillBuffer", MB_OK );
|
||||
return;
|
||||
}
|
||||
|
||||
pDSBuffer->Unlock( pDSLockedBuffer, dwDSLockedBufferSize, NULL, 0 );
|
||||
}
|
||||
|
||||
void CSound::SetVolume(LPDIRECTSOUNDBUFFER pDSBuffer, float fVol )
|
||||
{
|
||||
if( !pDSBuffer ) return;
|
||||
|
||||
m_fVolume = Clamp( fVol, VOLUME_MIN, VOLUME_MAX );
|
||||
float fMasterVol = CSoundMgr::_GetInstance()->GetVolume();
|
||||
fMasterVol = Clamp( fMasterVol, VOLUME_MIN, VOLUME_MAX );
|
||||
int iVol = LinearToLogVol(m_fVolume * fMasterVol);
|
||||
|
||||
if(iVol < -10000)
|
||||
iVol = -10000;
|
||||
|
||||
if( FAILED(pDSBuffer->SetVolume(iVol)) )
|
||||
{
|
||||
MessageBox( NULL, "FAILED(pDSBuffer->SetVolume(iVol))",
|
||||
"CSound::SetVolume", MB_OK );
|
||||
}
|
||||
}
|
||||
|
||||
void CSound::SetVolume( float fVol )
|
||||
{
|
||||
if( !m_ppDSBuffer ) return;
|
||||
|
||||
m_fVolume = Clamp( fVol, VOLUME_MIN, VOLUME_MAX );
|
||||
}
|
||||
59
Engine/SoundLib/Sound.h
Normal file
59
Engine/SoundLib/Sound.h
Normal file
@@ -0,0 +1,59 @@
|
||||
// Sound.h: interface for the CSound class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_SOUND_H__C6C8A751_6637_4E39_9525_125C0632F1D0__INCLUDED_)
|
||||
#define AFX_SOUND_H__C6C8A751_6637_4E39_9525_125C0632F1D0__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include <dsound.h>
|
||||
#include "DefineSound.h"
|
||||
|
||||
class CWaveLoader;
|
||||
class CSoundMgr;
|
||||
|
||||
class CSound
|
||||
{
|
||||
friend class CSound3D;
|
||||
friend class CSoundMgr;
|
||||
|
||||
protected:
|
||||
LPDIRECTSOUNDBUFFER8* m_ppDSBuffer;
|
||||
CWaveLoader* m_pWaveFile;
|
||||
DWORD m_dwNumBuffers;
|
||||
DWORD m_dwDSBufferSize;
|
||||
bool m_bSound3D;
|
||||
bool m_bLoop;
|
||||
float m_fVolume;
|
||||
DWORD m_dwLastPlayTime;
|
||||
DWORD m_dwLatestPlayIndex;
|
||||
int m_iPreserveScore;
|
||||
|
||||
public:
|
||||
CSound();
|
||||
virtual ~CSound();
|
||||
|
||||
bool Create( const char* strFileName, DWORD dwNumBuffers );
|
||||
void Destroy();
|
||||
void Play();
|
||||
|
||||
inline void SetLooping( bool bLoop ) { m_bLoop = bLoop; }
|
||||
inline bool IsLooping() { return m_bLoop; }
|
||||
void SetVolume( float fVol );
|
||||
void SetVolume(LPDIRECTSOUNDBUFFER pDSBuffer, float fVol );
|
||||
inline void GetVolume( float& fVol ) { fVol = m_fVolume; }
|
||||
|
||||
HRESULT RestoreBuffer( LPDIRECTSOUNDBUFFER pDSB, bool* pbWasRestored );
|
||||
void FillBuffer( LPDIRECTSOUNDBUFFER pDSBuffer );
|
||||
LPDIRECTSOUNDBUFFER GetFreeBuffer();
|
||||
LPDIRECTSOUNDBUFFER GetBuffer( DWORD dwIndex );
|
||||
void Stop();
|
||||
void Reset();
|
||||
bool IsPlaying();
|
||||
inline DWORD GetAllBufferSize() { return (m_dwDSBufferSize*m_dwNumBuffers); }
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_SOUND_H__C6C8A751_6637_4E39_9525_125C0632F1D0__INCLUDED_)
|
||||
177
Engine/SoundLib/Sound3D.cpp
Normal file
177
Engine/SoundLib/Sound3D.cpp
Normal file
@@ -0,0 +1,177 @@
|
||||
// Sound3D.cpp: implementation of the CSound3D class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "DefineSound.h"
|
||||
#include "Sound.h"
|
||||
#include "Sound3D.h"
|
||||
#include "SoundMgr.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
CSound3D::CSound3D() : m_pSound( NULL ),
|
||||
m_ppDS3DBuffer( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CSound3D::~CSound3D()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
bool CSound3D::Create( const char* strFileName, DWORD dwNumBuffers )
|
||||
{
|
||||
m_pSound = new CSound;
|
||||
m_pSound->m_bSound3D = true;
|
||||
|
||||
if( !m_pSound->Create( strFileName, dwNumBuffers ) )
|
||||
{
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_ppDS3DBuffer = new LPDIRECTSOUND3DBUFFER8[dwNumBuffers];
|
||||
|
||||
for( DWORD i = 0; i < dwNumBuffers; i++ )
|
||||
{
|
||||
m_ppDS3DBuffer[i] = Get3DSoundBufferInterface( i );
|
||||
}
|
||||
|
||||
//=============================
|
||||
// Create EAX
|
||||
//=============================
|
||||
// if( CSoundMgr::_GetInstance()->GetInitProp()->m_bUseEAX )
|
||||
// m_EAXBuffer.Create( m_pDS3DBuffer );
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::Destroy()
|
||||
{
|
||||
for( DWORD i = 0; i < m_pSound->m_dwNumBuffers; i++ )
|
||||
{
|
||||
SAFE_RELEASE( m_ppDS3DBuffer[i] );
|
||||
SAFE_DELETE( m_ppDS3DBuffer[i] );
|
||||
}
|
||||
|
||||
SAFE_DELETE_ARRAY( m_ppDS3DBuffer ) ;
|
||||
SAFE_DELETE( m_pSound );
|
||||
}
|
||||
|
||||
|
||||
LPDIRECTSOUND3DBUFFER8 CSound3D::Get3DSoundBufferInterface( DWORD dwIndex )
|
||||
{
|
||||
LPDIRECTSOUND3DBUFFER8 pDS3DBuffer;
|
||||
HRESULT hr = m_pSound->m_ppDSBuffer[dwIndex]->QueryInterface( IID_IDirectSound3DBuffer8, (void**)&pDS3DBuffer );
|
||||
if( FAILED( hr ) )
|
||||
{
|
||||
MessageBox( NULL, "m_pSound->m_ppDSBuffer[dwIndex]->QueryInterface( IID_IDirectSound3DBuffer8, (void**)&pDS3DBuffer )",
|
||||
"CSound3D::Get3DSoundBufferInterface", MB_OK );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pDS3DBuffer;
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::SetConeAngles( DWORD dwInside, DWORD dwOutside )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->SetConeAngles( dwInside, dwOutside, DS3D_IMMEDIATE );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::SetConeOrientation( D3DVECTOR& vOrientation )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->SetConeOrientation( vOrientation.x,
|
||||
vOrientation.y, vOrientation.z, DS3D_IMMEDIATE );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::SetConeOutsideVolume( float fVolume )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->SetConeOutsideVolume( LinearToLogVol(fVolume), DS3D_IMMEDIATE );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::SetMaxDistance( float fMaxDist )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->SetMaxDistance( fMaxDist, DS3D_IMMEDIATE );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::SetMinDistance( float fMinDist )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->SetMinDistance( fMinDist, DS3D_IMMEDIATE );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::SetMode( DWORD dwMode )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->SetMode( dwMode, DS3D_IMMEDIATE );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::SetPosition( D3DVECTOR& vPos )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->SetPosition( vPos.x, vPos.y, vPos.z, DS3D_IMMEDIATE );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::SetVelocity( const D3DVECTOR& vVel )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->SetVelocity( vVel.x, vVel.y, vVel.z, DS3D_IMMEDIATE );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::GetConeAngles( DWORD& dwInside, DWORD& dwOutside )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->GetConeAngles( &dwInside, &dwOutside );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::GetConeOrientation( D3DVECTOR& vOrientation )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->GetConeOrientation( &vOrientation );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::GetConeOutsideVolume( float& fVolume )
|
||||
{
|
||||
LPLONG V = NULL ;
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->GetConeOutsideVolume( V );
|
||||
fVolume = LogToLinearVol( *V );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::GetMaxDistance( float& fMaxDist )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->GetMaxDistance( &fMaxDist );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::GetMinDistance( float& fMinDist )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->GetMinDistance( &fMinDist );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::GetMode( DWORD& dwMode )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->GetMode( &dwMode );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::GetPosition( D3DVECTOR& vPos )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->GetPosition( &vPos );
|
||||
}
|
||||
|
||||
|
||||
void CSound3D::GetVelocity( D3DVECTOR& vVel )
|
||||
{
|
||||
m_ppDS3DBuffer[m_pSound->m_dwLatestPlayIndex]->GetVelocity( &vVel );
|
||||
}
|
||||
|
||||
|
||||
74
Engine/SoundLib/Sound3D.h
Normal file
74
Engine/SoundLib/Sound3D.h
Normal file
@@ -0,0 +1,74 @@
|
||||
// Sound3D.h: interface for the CSound3D class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_SOUND3D_H__9100BA05_DC25_4ECD_A2A7_4E34F81982C6__INCLUDED_)
|
||||
#define AFX_SOUND3D_H__9100BA05_DC25_4ECD_A2A7_4E34F81982C6__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include <dsound.h>
|
||||
#include "EAXBuffer.h"
|
||||
|
||||
class CSound;
|
||||
class CWaveLoader;
|
||||
class CSoundMgr;
|
||||
|
||||
class CSound3D
|
||||
{
|
||||
protected:
|
||||
friend class CSoundMgr;
|
||||
CSound* m_pSound;
|
||||
LPDIRECTSOUND3DBUFFER8* m_ppDS3DBuffer;
|
||||
//CEAXBuffer m_EAXBuffer;
|
||||
|
||||
protected:
|
||||
LPDIRECTSOUND3DBUFFER8 Get3DSoundBufferInterface( DWORD dwIndex );
|
||||
|
||||
public:
|
||||
CSound3D();
|
||||
virtual ~CSound3D();
|
||||
|
||||
bool Create( const char* strFileName, DWORD dwNumBuffers );
|
||||
void Destroy();
|
||||
void Play() { m_pSound->Play(); };
|
||||
void Stop() { m_pSound->Stop(); };
|
||||
void Reset() { m_pSound->Reset(); };
|
||||
bool IsPlaying() { return m_pSound->IsPlaying(); };
|
||||
inline DWORD GetAllBufferSize() { return m_pSound->GetAllBufferSize(); };
|
||||
LPDIRECTSOUNDBUFFER GetFreeBuffer() { return m_pSound->GetFreeBuffer(); };
|
||||
LPDIRECTSOUNDBUFFER GetBuffer( DWORD dwIndex ) { return m_pSound->GetBuffer( dwIndex ); };
|
||||
inline void SetVolume( float fVol ) { m_pSound->SetVolume(fVol); };
|
||||
void GetVolume( float& fVol ) { m_pSound->GetVolume(fVol); };
|
||||
inline void SetLooping( bool bLoop ) { m_pSound->SetLooping(bLoop); };
|
||||
inline bool IsLooping() { return m_pSound->IsLooping(); };
|
||||
|
||||
//3D Property
|
||||
void SetPosition(D3DVECTOR& vPos);
|
||||
void GetPosition(D3DVECTOR& vPos);
|
||||
|
||||
void SetVelocity(const D3DVECTOR& vVel);
|
||||
void GetVelocity(D3DVECTOR& vVel);
|
||||
|
||||
void SetMaxDistance(float fMaxDist );
|
||||
void GetMaxDistance(float& fMaxDist);
|
||||
|
||||
void SetMinDistance(float fMinDist);
|
||||
void GetMinDistance(float& fMinDist);
|
||||
|
||||
void SetConeAngles(DWORD dwInside, DWORD dwOutside);
|
||||
void GetConeAngles(DWORD& dwInside, DWORD& dwOutside);
|
||||
|
||||
void SetConeOrientation(D3DVECTOR& vOrientation);
|
||||
void GetConeOrientation(D3DVECTOR& vOrientation);
|
||||
|
||||
void SetConeOutsideVolume(float fVolume);
|
||||
void GetConeOutsideVolume(float& fVolume);
|
||||
|
||||
void SetMode(DWORD dwMode);
|
||||
void GetMode(DWORD& dwMode);
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_SOUND3D_H__9100BA05_DC25_4ECD_A2A7_4E34F81982C6__INCLUDED_)
|
||||
321
Engine/SoundLib/SoundLib.vcproj
Normal file
321
Engine/SoundLib/SoundLib.vcproj
Normal file
@@ -0,0 +1,321 @@
|
||||
<?xml version="1.0" encoding="ks_c_5601-1987"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="SoundLib"
|
||||
ProjectGUID="{00A76BEC-6D9A-4CAC-9E79-EDA8E5A9B9C4}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../Library/$(ConfigurationName)"
|
||||
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="./vorbis_sdk/include;../../MemoryManager"
|
||||
AdditionalUsingDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/SoundLib.lib"
|
||||
AdditionalLibraryDirectories=""$(ProjectDir)vorbis_sdk\lib""/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../Library/$(ConfigurationName)"
|
||||
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="./vorbis_sdk/include;../../MemoryManager"
|
||||
AdditionalUsingDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/SoundLib.lib"
|
||||
AdditionalLibraryDirectories=""$(ProjectDir)vorbis_sdk\lib""/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release_NoGD|Win32"
|
||||
OutputDirectory="../../Library/$(ConfigurationName)"
|
||||
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="./vorbis_sdk/include;../../MemoryManager"
|
||||
AdditionalUsingDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/SoundLib.lib"
|
||||
AdditionalLibraryDirectories=""$(ProjectDir)vorbis_sdk\lib""/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release_MY|Win32"
|
||||
OutputDirectory="../../Library/$(ConfigurationName)"
|
||||
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="./vorbis_sdk/include;../../MemoryManager"
|
||||
AdditionalUsingDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/SoundLib.lib"
|
||||
AdditionalLibraryDirectories=""$(ProjectDir)vorbis_sdk\lib""/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug_MY|Win32"
|
||||
OutputDirectory="../../Library/$(ConfigurationName)"
|
||||
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="./vorbis_sdk/include;../../MemoryManager"
|
||||
AdditionalUsingDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/SoundLib.lib"
|
||||
AdditionalLibraryDirectories=""$(ProjectDir)vorbis_sdk\lib""/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="소스 파일"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\EAXBuffer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\EAXListener.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Listener.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OggLoader.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Sound.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Sound3D.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SoundMgr.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\StreamingSound.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\StreamingSound3D.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\WaveLoader.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="헤더 파일"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath=".\Common.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DefineSound.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\eax.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\EAXBuffer.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\EAXListener.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Listener.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OggLoader.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Sound.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Sound3D.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SoundMgr.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SoundMgrInit.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\StreamingSound.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\StreamingSound3D.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\WaveLoader.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="리소스 파일"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
226
Engine/SoundLib/SoundLib.vcxproj
Normal file
226
Engine/SoundLib/SoundLib.vcxproj
Normal file
@@ -0,0 +1,226 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug_MY|Win32">
|
||||
<Configuration>Debug_MY</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release_MY|Win32">
|
||||
<Configuration>Release_MY</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release_NoGD|Win32">
|
||||
<Configuration>Release_NoGD</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{00A76BEC-6D9A-4CAC-9E79-EDA8E5A9B9C4}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../Library/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../Library/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">../../Library/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">../../Library/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">../../Library/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>./vorbis_sdk/include;../../MemoryManager;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)SoundLib.lib</OutputFile>
|
||||
<AdditionalLibraryDirectories>
|
||||
</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>./vorbis_sdk/include;../../MemoryManager;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)SoundLib.lib</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)vorbis_sdk\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>./vorbis_sdk/include;../../MemoryManager;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)SoundLib.lib</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)vorbis_sdk\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>./vorbis_sdk/include;../../MemoryManager;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)SoundLib.lib</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)vorbis_sdk\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>./vorbis_sdk/include;../../MemoryManager;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)SoundLib.lib</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)vorbis_sdk\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EAXBuffer.cpp" />
|
||||
<ClCompile Include="EAXListener.cpp" />
|
||||
<ClCompile Include="Listener.cpp" />
|
||||
<ClCompile Include="OggLoader.cpp" />
|
||||
<ClCompile Include="Sound.cpp" />
|
||||
<ClCompile Include="Sound3D.cpp" />
|
||||
<ClCompile Include="SoundMgr.cpp" />
|
||||
<ClCompile Include="StreamingSound.cpp" />
|
||||
<ClCompile Include="StreamingSound3D.cpp" />
|
||||
<ClCompile Include="WaveLoader.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Common.h" />
|
||||
<ClInclude Include="DefineSound.h" />
|
||||
<ClInclude Include="eax.h" />
|
||||
<ClInclude Include="EAXBuffer.h" />
|
||||
<ClInclude Include="EAXListener.h" />
|
||||
<ClInclude Include="Listener.h" />
|
||||
<ClInclude Include="OggLoader.h" />
|
||||
<ClInclude Include="Sound.h" />
|
||||
<ClInclude Include="Sound3D.h" />
|
||||
<ClInclude Include="SoundMgr.h" />
|
||||
<ClInclude Include="SoundMgrInit.h" />
|
||||
<ClInclude Include="StreamingSound.h" />
|
||||
<ClInclude Include="StreamingSound3D.h" />
|
||||
<ClInclude Include="WaveLoader.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\MemoryManager\MemoryManager.vcxproj">
|
||||
<Project>{b6bdd524-1dde-4a65-aed7-9ee4bc86a05d}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
96
Engine/SoundLib/SoundLib.vcxproj.filters
Normal file
96
Engine/SoundLib/SoundLib.vcxproj.filters
Normal file
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="소스 파일">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="헤더 파일">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="리소스 파일">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EAXBuffer.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EAXListener.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Listener.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OggLoader.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Sound.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Sound3D.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SoundMgr.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StreamingSound.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StreamingSound3D.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WaveLoader.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Common.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DefineSound.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="eax.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EAXBuffer.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EAXListener.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Listener.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OggLoader.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Sound.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Sound3D.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SoundMgr.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SoundMgrInit.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StreamingSound.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StreamingSound3D.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WaveLoader.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
566
Engine/SoundLib/SoundMgr.cpp
Normal file
566
Engine/SoundLib/SoundMgr.cpp
Normal file
@@ -0,0 +1,566 @@
|
||||
// SoundMgr.cpp: implementation of the CSoundMgr class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "SoundMgr.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
CSoundMgr* CSoundMgr::ms_pSoundMgr = NULL;
|
||||
|
||||
CSoundMgr* CSoundMgr::_GetInstance()
|
||||
{
|
||||
if( ms_pSoundMgr == NULL )
|
||||
{
|
||||
ms_pSoundMgr = new CSoundMgr();
|
||||
}
|
||||
|
||||
return ms_pSoundMgr;
|
||||
}
|
||||
|
||||
DWORD WINAPI _TimeEventThread( LPVOID lp )
|
||||
{
|
||||
CSoundMgr::_GetInstance()->ThreadFunc();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CSoundMgr::Init( SoundMgrInit& Init )
|
||||
{
|
||||
//============================
|
||||
// Initialize variables
|
||||
//============================
|
||||
m_bInit = false;
|
||||
m_pDS = NULL;
|
||||
m_pListener = NULL;
|
||||
m_hTimeEventThread = NULL;
|
||||
m_hDestroyEvent = NULL;
|
||||
m_dwTimeEventID = NULL;
|
||||
m_fMasterVolume = VOLUME_MAX;
|
||||
|
||||
memcpy( &m_InitProp, &Init, sizeof(SoundMgrInit) );
|
||||
if( m_InitProp.m_hWnd == 0 )
|
||||
{
|
||||
MessageBox(NULL, "Not Init hWnd!!", "CSoundMgr::Init", MB_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
//============================
|
||||
// Create DirectSound
|
||||
//============================
|
||||
if( FAILED(DirectSoundCreate8(NULL, &m_pDS, NULL)) )
|
||||
{
|
||||
MessageBox(NULL, "Failed to initialize DirectSound. \n CSoundMgr::Init",
|
||||
"DirectSound Device Error", MB_OK);
|
||||
SAFE_RELEASE( m_pDS );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( FAILED(m_pDS->SetCooperativeLevel(m_InitProp.m_hWnd, /*DSSCL_PRIORITY*/ DSSCL_EXCLUSIVE)) )
|
||||
{
|
||||
MessageBox(NULL, "Failed to set the DirectSound cooperative levels. \n CSoundMgr::Init",
|
||||
"DirectSound Device Error", MB_OK);
|
||||
SAFE_RELEASE( m_pDS );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !SetPrimaryBufferFormat(m_InitProp.m_dwPrimaryChannels,
|
||||
m_InitProp.m_dwPrimaryFrequency, m_InitProp.m_dwPrimaryBitRate) )
|
||||
{
|
||||
MessageBox( NULL, "Failed to create DirectSound buffer. \n CSoundMgr::Init",
|
||||
"DirectSound Device Error", MB_OK );
|
||||
SAFE_RELEASE( m_pDS );
|
||||
return false;
|
||||
}
|
||||
|
||||
//==============================
|
||||
// Get Caps
|
||||
//==============================
|
||||
ZeroMemory( &m_Caps, sizeof(DSCAPS) );
|
||||
m_Caps.dwSize = sizeof(DSCAPS);
|
||||
if( FAILED(m_pDS->GetCaps(&m_Caps)) )
|
||||
{
|
||||
MessageBox( NULL, "Failed to initialize sound driver. \n CSoundMgr::Init",
|
||||
"DirectSound Device Error", MB_OK );
|
||||
}
|
||||
|
||||
//==============================
|
||||
// Create Listener
|
||||
//==============================
|
||||
m_pListener = new CListener( m_pDS );
|
||||
|
||||
//==============================
|
||||
// Create thread
|
||||
//==============================
|
||||
m_hTimeEventThread = CreateThread( NULL, 0, _TimeEventThread, NULL, 0, &m_dwTimeEventID );
|
||||
|
||||
//==============================
|
||||
// Init CriticalSection
|
||||
//==============================
|
||||
ZeroMemory(&m_csSoundUpdate, sizeof(CRITICAL_SECTION));
|
||||
InitializeCriticalSection(&m_csSoundUpdate);
|
||||
|
||||
//Ãʱâȼº°ø
|
||||
m_bInit = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CSoundMgr::SetPrimaryBufferFormat(DWORD dwPrimaryChannels, DWORD dwPrimaryFreq, DWORD dwPrimaryBitRate)
|
||||
{
|
||||
LPDIRECTSOUNDBUFFER pDSBPrimary = NULL;
|
||||
|
||||
// Get the primary buffer
|
||||
DSBUFFERDESC dsbd;
|
||||
ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) );
|
||||
dsbd.dwSize = sizeof(DSBUFFERDESC);
|
||||
dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
|
||||
dsbd.dwBufferBytes = 0;
|
||||
dsbd.lpwfxFormat = NULL;
|
||||
|
||||
if(FAILED(m_pDS->CreateSoundBuffer(&dsbd, &pDSBPrimary, NULL))) return false;
|
||||
|
||||
WAVEFORMATEX wfx;
|
||||
ZeroMemory( &wfx, sizeof(WAVEFORMATEX) );
|
||||
wfx.wFormatTag = (WORD) WAVE_FORMAT_PCM;
|
||||
wfx.nChannels = (WORD) dwPrimaryChannels;
|
||||
wfx.nSamplesPerSec = (DWORD) dwPrimaryFreq;
|
||||
wfx.wBitsPerSample = (WORD) dwPrimaryBitRate;
|
||||
wfx.nBlockAlign = (WORD) (wfx.wBitsPerSample / 8 * wfx.nChannels);
|
||||
wfx.nAvgBytesPerSec = (DWORD) (wfx.nSamplesPerSec * wfx.nBlockAlign);
|
||||
|
||||
if( FAILED(pDSBPrimary->SetFormat(&wfx)) )
|
||||
{
|
||||
SAFE_RELEASE( pDSBPrimary );
|
||||
return false;
|
||||
}
|
||||
|
||||
SAFE_RELEASE( pDSBPrimary );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CSoundMgr::ReleaseAllData()
|
||||
{
|
||||
m_hDestroyEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
m_bInit = false;
|
||||
WaitForSingleObject( m_hDestroyEvent, INFINITE );
|
||||
|
||||
SOUNDMAP::iterator iter_snd;
|
||||
SOUND3DMAP::iterator iter_snd3d;
|
||||
STREAMINGMAP::iterator iter_strm;
|
||||
STREAMING3DMAP::iterator iter_strm3d;
|
||||
|
||||
for( iter_snd = m_SoundMap.begin(); iter_snd != m_SoundMap.end(); iter_snd++ )
|
||||
{
|
||||
SAFE_DELETE( iter_snd->second );
|
||||
}
|
||||
|
||||
for( iter_snd3d = m_Sound3DMap.begin(); iter_snd3d != m_Sound3DMap.end(); iter_snd3d++ )
|
||||
{
|
||||
SAFE_DELETE( iter_snd3d->second );
|
||||
}
|
||||
|
||||
for( iter_strm = m_StreamingMap.begin(); iter_strm != m_StreamingMap.end(); iter_strm++ )
|
||||
{
|
||||
SAFE_DELETE( iter_strm->second );
|
||||
}
|
||||
|
||||
for( iter_strm3d = m_Streaming3DMap.begin(); iter_strm3d != m_Streaming3DMap.end(); iter_strm3d++ )
|
||||
{
|
||||
SAFE_DELETE( iter_strm3d->second );
|
||||
}
|
||||
|
||||
m_SoundMap.clear();
|
||||
m_Sound3DMap.clear();
|
||||
m_StreamingMap.clear();
|
||||
m_Streaming3DMap.clear();
|
||||
|
||||
CloseHandle( m_hDestroyEvent );
|
||||
CloseHandle( m_hTimeEventThread );
|
||||
DeleteCriticalSection( &m_csSoundUpdate );
|
||||
|
||||
SAFE_DELETE( m_pListener );
|
||||
SAFE_RELEASE( m_pDS );
|
||||
}
|
||||
|
||||
|
||||
bool CSoundMgr::GetSound( CSound*& pSound, char* strFileName, DWORD dwNumBuffers )
|
||||
{
|
||||
SimpleCircleBuffer(SOUND);
|
||||
SOUNDMAP::iterator iter;
|
||||
DWORD dwHashID = GetHashID(strFileName);
|
||||
iter = m_SoundMap.find( dwHashID );
|
||||
|
||||
if( iter != m_SoundMap.end() )
|
||||
{
|
||||
pSound = iter->second;
|
||||
pSound->SetVolume(1);
|
||||
pSound->m_iPreserveScore += 50;
|
||||
return true;
|
||||
}
|
||||
|
||||
pSound = NULL;
|
||||
pSound = new CSound();
|
||||
|
||||
if( pSound )
|
||||
{
|
||||
if( !pSound->Create( strFileName, dwNumBuffers ) )
|
||||
{
|
||||
SAFE_DELETE( pSound );
|
||||
return false;
|
||||
}
|
||||
|
||||
pSound->SetVolume(1);
|
||||
pSound->m_iPreserveScore += 50;
|
||||
m_SoundMap.insert( SOUNDMAP::iterator::value_type(dwHashID, pSound) );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CSoundMgr::GetSound3D( CSound3D*& pSound3D, const char* strFileName, DWORD dwNumBuffers )
|
||||
{
|
||||
SimpleCircleBuffer(SOUND3D);
|
||||
SOUND3DMAP::iterator iter;
|
||||
DWORD dwHashID = GetHashID(strFileName);
|
||||
iter = m_Sound3DMap.find( dwHashID );
|
||||
|
||||
if( iter != m_Sound3DMap.end() )
|
||||
{
|
||||
pSound3D = iter->second;
|
||||
pSound3D->SetVolume(1);
|
||||
pSound3D->m_pSound->m_iPreserveScore += 50;
|
||||
return true;
|
||||
}
|
||||
|
||||
pSound3D = NULL;
|
||||
pSound3D = new CSound3D();
|
||||
|
||||
if( pSound3D )
|
||||
{
|
||||
if( !pSound3D->Create( strFileName, dwNumBuffers ) )
|
||||
{
|
||||
SAFE_DELETE( pSound3D );
|
||||
return false;
|
||||
}
|
||||
|
||||
pSound3D->SetVolume(1);
|
||||
pSound3D->m_pSound->m_iPreserveScore += 50;
|
||||
m_Sound3DMap.insert( SOUND3DMAP::iterator::value_type(dwHashID, pSound3D) );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CSoundMgr::GetStreamingSound( CStreamingSound*& pStreamingSound, char* strFileName )
|
||||
{
|
||||
SimpleCircleBuffer(STREAM);
|
||||
STREAMINGMAP::iterator iter;
|
||||
DWORD dwHashID = GetHashID(strFileName);
|
||||
iter = m_StreamingMap.find( dwHashID );
|
||||
|
||||
if( iter != m_StreamingMap.end() )
|
||||
{
|
||||
pStreamingSound = iter->second;
|
||||
pStreamingSound->SetVolume(1);
|
||||
return;
|
||||
}
|
||||
|
||||
pStreamingSound = new CStreamingSound();
|
||||
|
||||
if( !pStreamingSound->Create( strFileName ) )
|
||||
{
|
||||
SAFE_DELETE(pStreamingSound);
|
||||
return;
|
||||
}
|
||||
|
||||
pStreamingSound->SetVolume(1);
|
||||
m_StreamingMap.insert( STREAMINGMAP::iterator::value_type(dwHashID, pStreamingSound) );
|
||||
}
|
||||
|
||||
|
||||
void CSoundMgr::GetStreamingSound3D( CStreamingSound3D*& pStreamingSound3D, char* strFileName )
|
||||
{
|
||||
SimpleCircleBuffer(STREAM3D);
|
||||
STREAMING3DMAP::iterator iter;
|
||||
DWORD dwHashID = GetHashID(strFileName);
|
||||
iter = m_Streaming3DMap.find( dwHashID );
|
||||
|
||||
if( iter != m_Streaming3DMap.end() )
|
||||
{
|
||||
pStreamingSound3D = iter->second;
|
||||
pStreamingSound3D->SetVolume(1);
|
||||
return;
|
||||
}
|
||||
|
||||
pStreamingSound3D = new CStreamingSound3D();
|
||||
if( !pStreamingSound3D->Create(strFileName) )
|
||||
{
|
||||
SAFE_DELETE(pStreamingSound3D);
|
||||
return;
|
||||
}
|
||||
|
||||
pStreamingSound3D->SetVolume(1);
|
||||
m_Streaming3DMap.insert( STREAMING3DMAP::iterator::value_type(dwHashID, pStreamingSound3D) );
|
||||
}
|
||||
|
||||
|
||||
void CSoundMgr::InsertStream( CStreamingSound* pStreamSound )
|
||||
{
|
||||
m_StreamProcess.push_back( pStreamSound );
|
||||
}
|
||||
|
||||
|
||||
void CSoundMgr::RemoveStream( CStreamingSound* pStreamSound )
|
||||
{
|
||||
m_StreamRemoval.push_back( pStreamSound );
|
||||
}
|
||||
|
||||
|
||||
void CSoundMgr::ServiceStreamingBuffers()
|
||||
{
|
||||
STREAMLIST::iterator itr;
|
||||
for(itr = m_StreamRemoval.begin(); itr != m_StreamRemoval.end(); itr++)
|
||||
{
|
||||
STREAMLIST::iterator itor = find(m_StreamProcess.begin(), m_StreamProcess.end(), *itr);
|
||||
if(itor != m_StreamProcess.end())
|
||||
m_StreamProcess.erase(itor);
|
||||
}
|
||||
|
||||
m_StreamRemoval.clear();
|
||||
|
||||
for(itr = m_StreamProcess.begin(); itr != m_StreamProcess.end(); itr++)
|
||||
{
|
||||
(*itr)->ServiceBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DWORD CSoundMgr::GetUseMemory()
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
SOUNDMAP::iterator iter_snd;
|
||||
SOUND3DMAP::iterator iter_snd3d;
|
||||
STREAMINGMAP::iterator iter_strm;
|
||||
STREAMING3DMAP::iterator iter_strm3d;
|
||||
|
||||
for( iter_snd = m_SoundMap.begin(); iter_snd != m_SoundMap.end(); iter_snd++ )
|
||||
{
|
||||
dwSize += iter_snd->second->GetAllBufferSize();
|
||||
}
|
||||
|
||||
for( iter_snd3d = m_Sound3DMap.begin(); iter_snd3d != m_Sound3DMap.end(); iter_snd3d++ )
|
||||
{
|
||||
dwSize += iter_snd3d->second->GetAllBufferSize();
|
||||
}
|
||||
|
||||
for( iter_strm = m_StreamingMap.begin(); iter_strm != m_StreamingMap.end(); iter_strm++ )
|
||||
{
|
||||
dwSize += iter_strm->second->GetBufferSize();
|
||||
}
|
||||
|
||||
for( iter_strm3d = m_Streaming3DMap.begin(); iter_strm3d != m_Streaming3DMap.end(); iter_strm3d++ )
|
||||
{
|
||||
dwSize += iter_strm3d->second->GetBufferSize();
|
||||
}
|
||||
|
||||
return dwSize;
|
||||
}
|
||||
|
||||
|
||||
void CSoundMgr::SimpleCircleBuffer( DWORD dwType )
|
||||
{
|
||||
switch( dwType )
|
||||
{
|
||||
case SOUND:
|
||||
{
|
||||
if( m_SoundMap.size() > m_InitProp.m_dwLimitSound )
|
||||
{
|
||||
SOUNDMAP::iterator iter_snd;
|
||||
// DWORD dwFlowTime;
|
||||
for( iter_snd = m_SoundMap.begin(); iter_snd != m_SoundMap.end(); )
|
||||
{
|
||||
if( !iter_snd->second->IsPlaying() )
|
||||
{
|
||||
--iter_snd->second->m_iPreserveScore;
|
||||
if( iter_snd->second->m_iPreserveScore < 0 )
|
||||
{
|
||||
SOUNDMAP::iterator iter_delete;
|
||||
iter_delete = iter_snd;
|
||||
++iter_snd;
|
||||
SAFE_DELETE( iter_delete->second );
|
||||
m_SoundMap.erase( iter_delete );
|
||||
if( m_SoundMap.size() <= m_InitProp.m_dwLimitSound ) break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
++iter_snd;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SOUND3D:
|
||||
{
|
||||
if( m_Sound3DMap.size() > m_InitProp.m_dwLimitSound3D )
|
||||
{
|
||||
SOUND3DMAP::iterator iter_snd3d;
|
||||
// DWORD dwFlowTime;
|
||||
for( iter_snd3d = m_Sound3DMap.begin(); iter_snd3d != m_Sound3DMap.end(); )
|
||||
{
|
||||
if( !iter_snd3d->second->IsPlaying() )
|
||||
{
|
||||
--iter_snd3d->second->m_pSound->m_iPreserveScore;
|
||||
if( iter_snd3d->second->m_pSound->m_iPreserveScore < 0 )
|
||||
{
|
||||
SOUND3DMAP::iterator iter_delete;
|
||||
iter_delete = iter_snd3d;
|
||||
++iter_snd3d;
|
||||
SAFE_DELETE( iter_delete->second );
|
||||
m_Sound3DMap.erase( iter_delete );
|
||||
if( m_Sound3DMap.size() <= m_InitProp.m_dwLimitSound3D ) break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
++iter_snd3d;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case STREAM:
|
||||
{
|
||||
if( m_StreamingMap.size() > m_InitProp.m_dwLimitStreaming )
|
||||
{
|
||||
STREAMINGMAP::iterator iter_strm;
|
||||
for( iter_strm = m_StreamingMap.begin(); iter_strm != m_StreamingMap.end(); )
|
||||
{
|
||||
if( !iter_strm->second->IsPlaying() )
|
||||
{
|
||||
STREAMINGMAP::iterator iter_delete;
|
||||
iter_delete = iter_strm;
|
||||
++iter_strm;
|
||||
SAFE_DELETE( iter_delete->second );
|
||||
m_StreamingMap.erase( iter_delete );
|
||||
if( m_StreamingMap.size() <= m_InitProp.m_dwLimitStreaming ) break;
|
||||
continue;
|
||||
}
|
||||
|
||||
++iter_strm;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case STREAM3D:
|
||||
{
|
||||
if( m_Streaming3DMap.size() > m_InitProp.m_dwLimitStreaming )
|
||||
{
|
||||
STREAMING3DMAP::iterator iter_strm3d;
|
||||
for( iter_strm3d = m_Streaming3DMap.begin(); iter_strm3d != m_Streaming3DMap.end(); )
|
||||
{
|
||||
if( !iter_strm3d->second->IsPlaying() )
|
||||
{
|
||||
STREAMING3DMAP::iterator iter_delete;
|
||||
iter_delete = iter_strm3d;
|
||||
++iter_strm3d;
|
||||
SAFE_DELETE( iter_delete->second );
|
||||
m_Streaming3DMap.erase( iter_delete );
|
||||
if( m_Streaming3DMap.size() <= m_InitProp.m_dwLimitStreaming ) break;
|
||||
continue;
|
||||
}
|
||||
|
||||
++iter_strm3d;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DSCAPS CSoundMgr::GetCaps()
|
||||
{
|
||||
return m_Caps;
|
||||
}
|
||||
|
||||
|
||||
void CSoundMgr::SetVolume( float fVol )
|
||||
{
|
||||
m_fMasterVolume = fVol;
|
||||
}
|
||||
|
||||
|
||||
float CSoundMgr::GetVolume()
|
||||
{
|
||||
return m_fMasterVolume;
|
||||
}
|
||||
|
||||
|
||||
void CSoundMgr::_Destroy()
|
||||
{
|
||||
if( ms_pSoundMgr )
|
||||
{
|
||||
ms_pSoundMgr->ReleaseAllData();
|
||||
}
|
||||
|
||||
SAFE_DELETE( ms_pSoundMgr );
|
||||
}
|
||||
|
||||
|
||||
void CSoundMgr::AllStopStreamingSound()
|
||||
{
|
||||
STREAMINGMAP::iterator iter;
|
||||
for( iter = m_StreamingMap.begin(); iter != m_StreamingMap.end(); iter++ )
|
||||
{
|
||||
iter->second->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
void CSoundMgr::AllStopStreamingSound3D()
|
||||
{
|
||||
STREAMING3DMAP::iterator iter;
|
||||
for( iter = m_Streaming3DMap.begin(); iter != m_Streaming3DMap.end(); iter++ )
|
||||
{
|
||||
iter->second->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
DWORD CSoundMgr::GetHashID( const char* strFileName )
|
||||
{
|
||||
DWORD id = 0;
|
||||
int iLength = (int)strlen(strFileName);
|
||||
|
||||
for(int i=0;i < iLength; ++i)
|
||||
{
|
||||
id += (( i + 1) * strFileName[i]);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
void CSoundMgr::ThreadFunc()
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
Sleep( 50 );
|
||||
|
||||
if( !m_bInit )
|
||||
{
|
||||
SetEvent( m_hDestroyEvent );
|
||||
break;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
EnterCriticalSection( &m_csSoundUpdate );
|
||||
//-----------------------------------------
|
||||
static int iServiceStreams = 0;
|
||||
if((iServiceStreams++) % 12 == 1) ServiceStreamingBuffers();
|
||||
m_pListener->Update();
|
||||
//-----------------------------------------
|
||||
LeaveCriticalSection( &m_csSoundUpdate );
|
||||
//-----------------------------------------
|
||||
}
|
||||
}
|
||||
99
Engine/SoundLib/SoundMgr.h
Normal file
99
Engine/SoundLib/SoundMgr.h
Normal file
@@ -0,0 +1,99 @@
|
||||
// SoundMgr.h: interface for the CSoundMgr class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_SOUNDMGR_H__5CBFAA8B_CAA9_47E7_8C9C_456C45247983__INCLUDED_)
|
||||
#define AFX_SOUNDMGR_H__5CBFAA8B_CAA9_47E7_8C9C_456C45247983__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include <dsound.h>
|
||||
#include "DefineSound.h"
|
||||
#include "Common.h"
|
||||
#include "Sound.h"
|
||||
#include "Sound3D.h"
|
||||
#include "StreamingSound.h"
|
||||
#include "StreamingSound3D.h"
|
||||
#include "Listener.h"
|
||||
#include "SoundMgrInit.h"
|
||||
using namespace std;
|
||||
|
||||
class CSoundMgr
|
||||
{
|
||||
enum eCIRCLEBUFTYPE
|
||||
{
|
||||
SOUND = 0,
|
||||
SOUND3D,
|
||||
STREAM,
|
||||
STREAM3D,
|
||||
};
|
||||
|
||||
private:
|
||||
typedef map<DWORD, CSound*> SOUNDMAP;
|
||||
typedef map<DWORD, CSound3D*> SOUND3DMAP;
|
||||
typedef map<DWORD, CStreamingSound*> STREAMINGMAP;
|
||||
typedef map<DWORD, CStreamingSound3D*> STREAMING3DMAP;
|
||||
typedef list<CStreamingSound*> STREAMLIST;
|
||||
typedef list<CStreamingSound3D*> STREAM3DLIST;
|
||||
|
||||
LPDIRECTSOUND8 m_pDS;
|
||||
static CSoundMgr* ms_pSoundMgr;
|
||||
bool m_bInit;
|
||||
SoundMgrInit m_InitProp;
|
||||
DSCAPS m_Caps;
|
||||
CListener* m_pListener;
|
||||
SOUNDMAP m_SoundMap;
|
||||
SOUND3DMAP m_Sound3DMap;
|
||||
STREAMINGMAP m_StreamingMap;
|
||||
STREAMING3DMAP m_Streaming3DMap;
|
||||
HANDLE m_hTimeEventThread;
|
||||
DWORD m_dwTimeEventID;
|
||||
STREAMLIST m_StreamProcess;
|
||||
STREAMLIST m_StreamRemoval;
|
||||
CRITICAL_SECTION m_csSoundUpdate;
|
||||
float m_fMasterVolume;
|
||||
|
||||
public:
|
||||
HANDLE m_hDestroyEvent;
|
||||
|
||||
private:
|
||||
bool SetPrimaryBufferFormat(DWORD dwPrimaryChannels,
|
||||
DWORD dwPrimaryFreq, DWORD dwPrimaryBitRate);
|
||||
void SimpleCircleBuffer( DWORD dwType );
|
||||
DWORD GetHashID( const char* strFileName );
|
||||
void ServiceStreamingBuffers();
|
||||
|
||||
public:
|
||||
inline LPDIRECTSOUND8 GetDirectSound() { return m_pDS; }
|
||||
inline CRITICAL_SECTION& GetUpdateCS() { return m_csSoundUpdate; }
|
||||
void InsertStream( CStreamingSound* pStreamSound );
|
||||
void RemoveStream( CStreamingSound* pStreamSound );
|
||||
void ThreadFunc();
|
||||
|
||||
public:
|
||||
CSoundMgr() {};
|
||||
virtual ~CSoundMgr() {};
|
||||
|
||||
bool Init( SoundMgrInit& Init );
|
||||
void ReleaseAllData();
|
||||
inline bool IsInitialized() { return m_bInit; }
|
||||
inline CListener* GetListener() { return m_pListener; }
|
||||
bool GetSound( CSound*& pSound, char* strFileName, DWORD dwNumBuffers=5 );
|
||||
bool GetSound3D( CSound3D*& pSound3D, const char* strFileName, DWORD dwNumBuffers=10 );
|
||||
void GetStreamingSound( CStreamingSound*& pStreamingSound, char* strFileName );
|
||||
void GetStreamingSound3D( CStreamingSound3D*& pStreamingSound3D, char* strFileName );
|
||||
void AllStopStreamingSound();
|
||||
void AllStopStreamingSound3D();
|
||||
DWORD GetUseMemory();
|
||||
DSCAPS GetCaps();
|
||||
void SetVolume( float fVol );
|
||||
float GetVolume();
|
||||
inline SoundMgrInit* GetInitProp() { return &m_InitProp; }
|
||||
|
||||
static CSoundMgr* _GetInstance();
|
||||
static void _Destroy();
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_SOUNDMGR_H__5CBFAA8B_CAA9_47E7_8C9C_456C45247983__INCLUDED_)
|
||||
38
Engine/SoundLib/SoundMgrInit.h
Normal file
38
Engine/SoundLib/SoundMgrInit.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef ___SOUNDMGRINIT_H___
|
||||
#define ___SOUNDMGRINIT_H___
|
||||
|
||||
#include <dsound.h>
|
||||
#include "DefineSound.h"
|
||||
|
||||
class SoundMgrInit
|
||||
{
|
||||
public:
|
||||
|
||||
HWND m_hWnd;
|
||||
bool m_bUseEAX;
|
||||
GUID m_guidSound3DAlgorithm;
|
||||
DWORD m_dwPrimaryFrequency;
|
||||
DWORD m_dwPrimaryChannels;
|
||||
DWORD m_dwPrimaryBitRate;
|
||||
DWORD m_dwLimitSound;
|
||||
DWORD m_dwLimitSound3D;
|
||||
DWORD m_dwLimitStreaming;
|
||||
|
||||
SoundMgrInit() { Clear(); };
|
||||
virtual ~SoundMgrInit() {};
|
||||
|
||||
void Clear()
|
||||
{
|
||||
m_hWnd = 0;
|
||||
m_bUseEAX = false;
|
||||
m_guidSound3DAlgorithm = SOUND_ALGORITHM_NO;
|
||||
m_dwPrimaryFrequency = SOUND_SAMPLE_22k;
|
||||
m_dwPrimaryChannels = 2;
|
||||
m_dwPrimaryBitRate = 16;
|
||||
m_dwLimitSound = 5;
|
||||
m_dwLimitSound3D = 20;
|
||||
m_dwLimitStreaming = 10;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //___SOUNDMGRINIT_H___
|
||||
362
Engine/SoundLib/StreamingSound.cpp
Normal file
362
Engine/SoundLib/StreamingSound.cpp
Normal file
@@ -0,0 +1,362 @@
|
||||
// StreamingSound.cpp: implementation of the CStreamingSound class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StreamingSound.h"
|
||||
#include "Sound.h"
|
||||
#include "WaveLoader.h"
|
||||
#include "OggLoader.h"
|
||||
#include "SoundMgr.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
|
||||
CStreamingSound::CStreamingSound() : m_pDSBuffer(NULL),
|
||||
m_pOggFile(NULL),
|
||||
m_dwDSBufferSize(0),
|
||||
m_dwDataCursor(0),
|
||||
m_dwBytesPlayed(0),
|
||||
m_dwLastReadPos(0),
|
||||
m_bPlaying(false),
|
||||
m_bRemoveStream(true),
|
||||
m_bLoop(false),
|
||||
m_bSound3D(false),
|
||||
m_fVolume(VOLUME_MAX)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CStreamingSound::~CStreamingSound()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound::Destroy()
|
||||
{
|
||||
EnterCriticalSection(&CSoundMgr::_GetInstance()->GetUpdateCS());
|
||||
CSoundMgr::_GetInstance()->RemoveStream(this);
|
||||
LeaveCriticalSection(&CSoundMgr::_GetInstance()->GetUpdateCS());
|
||||
|
||||
SAFE_RELEASE( m_pDSBuffer );
|
||||
SAFE_DELETE( m_pOggFile );
|
||||
}
|
||||
|
||||
|
||||
HRESULT CStreamingSound::Reset()
|
||||
{
|
||||
m_dwDataCursor = 0;
|
||||
m_dwBytesPlayed = 0;
|
||||
m_dwLastReadPos = 0;
|
||||
m_bRemoveStream = false;
|
||||
|
||||
m_pOggFile->Reset();
|
||||
|
||||
return m_pDSBuffer->SetCurrentPosition( 0L );
|
||||
}
|
||||
|
||||
|
||||
bool CStreamingSound::Create( char* strFileName )
|
||||
{
|
||||
LPDIRECTSOUND8 pDS = CSoundMgr::_GetInstance()->GetDirectSound();
|
||||
|
||||
m_pOggFile = new COggLoader();
|
||||
if( !m_pOggFile->Open( strFileName ) )
|
||||
{
|
||||
// char buf[MAX_PATH] = {0};
|
||||
// sprintf( buf, "해당파일을 열수가 없습니다. %s \n CStreamingSound::Create", strFileName );
|
||||
// MessageBox( NULL, buf, "사운드에러", MB_OK );
|
||||
|
||||
return false;
|
||||
}
|
||||
m_dwDSBufferSize = m_pOggFile->m_WaveFormatEx.nAvgBytesPerSec*3; //3초 버퍼생성
|
||||
|
||||
if( m_bSound3D && m_pOggFile->GetFormat()->nChannels > 1 )
|
||||
{
|
||||
MessageBox( NULL, "3DSound Only Acquire One Channel", "CStreamingSound::Create", MB_OK );
|
||||
SAFE_DELETE(m_pOggFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
DSBUFFERDESC dsbd;
|
||||
ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) );
|
||||
dsbd.dwSize = sizeof(DSBUFFERDESC);
|
||||
dsbd.dwFlags = DSBCAPS_CTRLVOLUME|DSBCAPS_GETCURRENTPOSITION2;
|
||||
if( m_bSound3D ) dsbd.dwFlags |= DSBCAPS_CTRL3D|DSBCAPS_MUTE3DATMAXDISTANCE;
|
||||
dsbd.dwBufferBytes = m_dwDSBufferSize;
|
||||
dsbd.guid3DAlgorithm = m_bSound3D ?
|
||||
CSoundMgr::_GetInstance()->GetInitProp()->m_guidSound3DAlgorithm:GUID_NULL;
|
||||
dsbd.lpwfxFormat = &m_pOggFile->m_WaveFormatEx;
|
||||
|
||||
|
||||
LPDIRECTSOUNDBUFFER tempBuffer;
|
||||
if( FAILED(pDS->CreateSoundBuffer( &dsbd, &tempBuffer, NULL )) )
|
||||
{
|
||||
SAFE_RELEASE(tempBuffer);
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
if( FAILED(tempBuffer->QueryInterface( IID_IDirectSoundBuffer8, (LPVOID*)&m_pDSBuffer )) )
|
||||
{
|
||||
SAFE_RELEASE(tempBuffer);
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
tempBuffer->Release();
|
||||
|
||||
/*
|
||||
if( FAILED(pDS->CreateSoundBuffer(&dsbd, &m_pDSBuffer, NULL) ))
|
||||
{
|
||||
//MessageBox( NULL, "CreateSoundBuffer", "streaming", MB_OK );
|
||||
SAFE_RELEASE( m_pDSBuffer );
|
||||
SAFE_DELETE( m_pOggFile );
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
FillBuffer();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound::Play()
|
||||
{
|
||||
if( m_bPlaying ) return;
|
||||
|
||||
EnterCriticalSection(&CSoundMgr::_GetInstance()->GetUpdateCS());
|
||||
m_bRemoveStream = false;
|
||||
CSoundMgr::_GetInstance()->InsertStream(this);
|
||||
LeaveCriticalSection(&CSoundMgr::_GetInstance()->GetUpdateCS());
|
||||
|
||||
if( FAILED(m_pDSBuffer->Play(0,0,DSBPLAY_LOOPING)) )
|
||||
{
|
||||
// MessageBox( NULL, "m_pDSBuffer->Play(0,0,0)", "Play()", MB_OK );
|
||||
m_bPlaying = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_bPlaying = true;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CStreamingSound::RestoreBuffer( LPDIRECTSOUNDBUFFER pDSB, BOOL* pbWasRestored )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if( pDSB == NULL )
|
||||
return CO_E_NOTINITIALIZED;
|
||||
if( pbWasRestored )
|
||||
*pbWasRestored = FALSE;
|
||||
|
||||
DWORD dwStatus;
|
||||
if( FAILED( hr = pDSB->GetStatus( &dwStatus ) ) )
|
||||
return E_FAIL;
|
||||
|
||||
if( dwStatus & DSBSTATUS_BUFFERLOST )
|
||||
{
|
||||
do
|
||||
{
|
||||
hr = pDSB->Restore();
|
||||
if( hr == DSERR_BUFFERLOST )
|
||||
Sleep( 10 );
|
||||
}
|
||||
while( ( hr = pDSB->Restore() ) == DSERR_BUFFERLOST );
|
||||
|
||||
if( pbWasRestored != NULL )
|
||||
*pbWasRestored = TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound::ServiceBuffer()
|
||||
{
|
||||
if(m_bRemoveStream)
|
||||
{
|
||||
if(!m_pDSBuffer || !m_pOggFile)
|
||||
return;
|
||||
|
||||
m_bRemoveStream = false;
|
||||
CSoundMgr::_GetInstance()->RemoveStream(this);
|
||||
m_pOggFile->Reset();
|
||||
Reset();
|
||||
FillBuffer();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(!m_pDSBuffer || !m_pOggFile)
|
||||
return;
|
||||
|
||||
DWORD dwReadCursor;
|
||||
DWORD dwWriteCursor;
|
||||
if( FAILED(m_pDSBuffer->GetCurrentPosition(&dwReadCursor, &dwWriteCursor)) )
|
||||
{
|
||||
// edith 2009.09.16 사운드 오류를 발생하는 유저가 있어서 강제로 리턴하기
|
||||
// MessageBox( NULL, "FAILED(m_pDSBuffer->GetCurrentPosition(&dwReadCursor, &dwWriteCursor))",
|
||||
// "ServiceBuffer()", MB_OK );
|
||||
return;
|
||||
}
|
||||
|
||||
if(dwReadCursor > m_dwLastReadPos)
|
||||
m_dwBytesPlayed += dwReadCursor - m_dwLastReadPos;
|
||||
else
|
||||
m_dwBytesPlayed += (m_dwDSBufferSize - m_dwLastReadPos) + dwReadCursor;
|
||||
|
||||
if(m_dwBytesPlayed >= m_pOggFile->GetSize())
|
||||
{
|
||||
if( m_bLoop )
|
||||
{
|
||||
m_dwBytesPlayed -= m_pOggFile->GetSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
Stop();
|
||||
m_bPlaying = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DWORD dwDataToCopy;
|
||||
if(m_dwDataCursor < dwReadCursor)
|
||||
dwDataToCopy = dwReadCursor - m_dwDataCursor;
|
||||
else
|
||||
dwDataToCopy = (m_dwDSBufferSize - m_dwDataCursor) + dwReadCursor;
|
||||
|
||||
if(dwDataToCopy > (m_dwDSBufferSize / 2))
|
||||
dwDataToCopy = m_dwDSBufferSize / 2;
|
||||
|
||||
LPVOID pPtr1;
|
||||
DWORD dwBytes1;
|
||||
LPVOID pPtr2;
|
||||
DWORD dwBytes2;
|
||||
if( FAILED(m_pDSBuffer->Lock(m_dwDataCursor, dwDataToCopy,
|
||||
&pPtr1, &dwBytes1, &pPtr2, &dwBytes2, 0)) )
|
||||
{
|
||||
// edith 2009.09.16 사운드 오류를 발생하는 유저가 있어서 강제로 리턴하기
|
||||
// MessageBox( NULL, "m_pDSBuffer->Lock(m_dwDataCursor, dwDataToCopy, &pPtr1, &dwBytes1, &pPtr2, &dwBytes2, 0)",
|
||||
// "ServiceBuffer()", MB_OK );
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_pOggFile->IsEOF())
|
||||
{
|
||||
memset(pPtr1, GetSilenceData(), dwBytes1);
|
||||
if(pPtr2) memset(pPtr2, GetSilenceData(), dwBytes2);
|
||||
m_dwDataCursor += (dwBytes1 + dwBytes2);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD dwBytesRead = 0;
|
||||
if( FAILED(m_pOggFile->Read((BYTE*)pPtr1, dwBytes1, &dwBytesRead)) )
|
||||
{
|
||||
// edith 2009.09.16 사운드 오류를 발생하는 유저가 있어서 강제로 리턴하기
|
||||
// MessageBox( NULL, "m_pWaveFile->Read((BYTE*)pPtr1, dwBytes1, &dwBytesRead)",
|
||||
// "ServiceBuffer()", MB_OK );
|
||||
|
||||
m_pDSBuffer->Unlock(pPtr1, dwBytes1, pPtr2, dwBytes2);
|
||||
return;
|
||||
}
|
||||
|
||||
m_dwDataCursor += dwBytesRead;
|
||||
|
||||
if(pPtr2 && (dwBytes1 == dwBytesRead))
|
||||
{
|
||||
if( FAILED(m_pOggFile->Read((BYTE*)pPtr2, dwBytes2, &dwBytesRead)) )
|
||||
{
|
||||
// edith 2009.09.16 사운드 오류를 발생하는 유저가 있어서 강제로 리턴하기
|
||||
// MessageBox( NULL, "m_pWaveFile->Read((BYTE*)pPtr2, dwBytes2, &dwBytesRead)",
|
||||
// "ServiceBuffer()", MB_OK );
|
||||
|
||||
m_pDSBuffer->Unlock(pPtr1, dwBytes1, pPtr2, dwBytes2);
|
||||
return;
|
||||
}
|
||||
m_dwDataCursor += dwBytesRead;
|
||||
}
|
||||
}
|
||||
|
||||
m_pDSBuffer->Unlock(pPtr1, dwBytes1, pPtr2, dwBytes2);
|
||||
|
||||
if( m_bLoop && m_pOggFile->IsEOF())
|
||||
m_pOggFile->Reset();
|
||||
|
||||
m_dwDataCursor %= m_dwDSBufferSize;
|
||||
m_dwLastReadPos = dwReadCursor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CStreamingSound::Stop()
|
||||
{
|
||||
if(!m_pDSBuffer)
|
||||
return;
|
||||
|
||||
m_pDSBuffer->Stop();
|
||||
m_bRemoveStream = true;
|
||||
m_bPlaying = false;
|
||||
}
|
||||
|
||||
|
||||
BYTE CStreamingSound::GetSilenceData()
|
||||
{
|
||||
if(m_pOggFile->m_WaveFormatEx.wBitsPerSample == 8)
|
||||
return 0x80;
|
||||
else if(m_pOggFile->m_WaveFormatEx.wBitsPerSample == 16)
|
||||
return 0x00;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound::FillBuffer()
|
||||
{
|
||||
// Lock the buffer
|
||||
void* pData;
|
||||
DWORD dwBytes;
|
||||
if( FAILED(m_pDSBuffer->Lock(0, 0, &pData, &dwBytes, NULL, NULL, DSBLOCK_ENTIREBUFFER)) )
|
||||
MessageBox( NULL, "m_pDSBuffer->Lock(0, 0, &pData, &nBytes, NULL, NULL, DSBLOCK_ENTIREBUFFER)",
|
||||
"FillBuffer", MB_OK );
|
||||
|
||||
// Fill the entire buffer with audio data from source
|
||||
DWORD dwBytesToRead;
|
||||
DWORD dwBytesRead;
|
||||
|
||||
dwBytesToRead = dwBytes;
|
||||
|
||||
if( FAILED(m_pOggFile->Read((BYTE*)pData, dwBytesToRead, &dwBytesRead)) )
|
||||
MessageBox( NULL, "m_pWaveFile->Read((BYTE*)pData, dwBytesToRead, &dwBytesRead)",
|
||||
"FillBuffer", MB_OK );
|
||||
|
||||
m_dwDataCursor += dwBytesRead;
|
||||
m_dwDataCursor %= dwBytes;
|
||||
|
||||
if(dwBytesRead < dwBytes)
|
||||
memset(((BYTE*)pData) + dwBytesRead, GetSilenceData(), dwBytes - dwBytesRead);
|
||||
|
||||
if( FAILED(m_pDSBuffer->Unlock(pData, dwBytes, NULL, 0)) )
|
||||
MessageBox( NULL, "m_pDSBuffer->Unlock(pData, nBytes, NULL, 0)", "FillBuffer", MB_OK );
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound::SetVolume( float fVol )
|
||||
{
|
||||
m_fVolume = Clamp( fVol, VOLUME_MIN, VOLUME_MAX );
|
||||
float fMasterVol = CSoundMgr::_GetInstance()->GetVolume();
|
||||
fMasterVol = Clamp( fMasterVol, VOLUME_MIN, VOLUME_MAX );
|
||||
int iVol = LinearToLogVol(m_fVolume * fMasterVol);
|
||||
|
||||
if(iVol < -10000)
|
||||
iVol = -10000;
|
||||
|
||||
|
||||
if( m_pDSBuffer )
|
||||
{
|
||||
if( FAILED(m_pDSBuffer->SetVolume(iVol)) )
|
||||
MessageBox( NULL, "FAILED(m_pDSBuffer->SetVolume(iVol))",
|
||||
"CStreamingSound::SetVolume", MB_OK );
|
||||
}
|
||||
}
|
||||
59
Engine/SoundLib/StreamingSound.h
Normal file
59
Engine/SoundLib/StreamingSound.h
Normal file
@@ -0,0 +1,59 @@
|
||||
// StreamingSound.h: interface for the CStreamingSound class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_STREAMINGSOUND_H__C14F203D_5328_480B_937C_55F88F36E678__INCLUDED_)
|
||||
#define AFX_STREAMINGSOUND_H__C14F203D_5328_480B_937C_55F88F36E678__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include <dsound.h>
|
||||
#include "DefineSound.h"
|
||||
|
||||
class CSound;
|
||||
class COggLoader;
|
||||
|
||||
class CStreamingSound
|
||||
{
|
||||
protected:
|
||||
friend class CStreamingSound3D;
|
||||
|
||||
LPDIRECTSOUNDBUFFER8 m_pDSBuffer;
|
||||
COggLoader* m_pOggFile;
|
||||
DWORD m_dwDSBufferSize;
|
||||
DWORD m_dwDataCursor;
|
||||
DWORD m_dwBytesPlayed;
|
||||
DWORD m_dwLastReadPos;
|
||||
bool m_bPlaying;
|
||||
bool m_bRemoveStream;
|
||||
bool m_bLoop;
|
||||
bool m_bSound3D;
|
||||
float m_fVolume;
|
||||
|
||||
public:
|
||||
CStreamingSound();
|
||||
virtual ~CStreamingSound();
|
||||
|
||||
protected:
|
||||
BYTE GetSilenceData();
|
||||
void FillBuffer();
|
||||
HRESULT RestoreBuffer( LPDIRECTSOUNDBUFFER pDSB, BOOL* pbWasRestored );
|
||||
|
||||
public:
|
||||
bool Create( char* strFileName );
|
||||
void Destroy();
|
||||
void ServiceBuffer();
|
||||
void Play();
|
||||
void Stop();
|
||||
HRESULT Reset();
|
||||
inline bool IsPlaying() { return m_bPlaying; }
|
||||
inline DWORD GetBufferSize() { return m_dwDSBufferSize; }
|
||||
inline void SetLooping( bool bLoop ) { m_bLoop = bLoop; }
|
||||
inline bool IsLooping() { return m_bLoop; }
|
||||
void SetVolume( float fVol );
|
||||
inline void GetVolume( float& fVol ) { fVol = m_fVolume; }
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_STREAMINGSOUND_H__C14F203D_5328_480B_937C_55F88F36E678__INCLUDED_)
|
||||
155
Engine/SoundLib/StreamingSound3D.cpp
Normal file
155
Engine/SoundLib/StreamingSound3D.cpp
Normal file
@@ -0,0 +1,155 @@
|
||||
// StreamingSound3D.cpp: implementation of the CStreamingSound3D class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "DefineSound.h"
|
||||
#include "StreamingSound.h"
|
||||
#include "StreamingSound3D.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CStreamingSound3D::CStreamingSound3D() : m_pStreamingSound(NULL),
|
||||
m_pDS3DBuffer(NULL)
|
||||
{
|
||||
ZeroMemory( &m_Prop, sizeof(DS3DBUFFER) );
|
||||
}
|
||||
|
||||
CStreamingSound3D::~CStreamingSound3D()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
bool CStreamingSound3D::Create( char* strFileName )
|
||||
{
|
||||
m_pStreamingSound = new CStreamingSound;
|
||||
m_pStreamingSound->m_bSound3D = true;
|
||||
if( !m_pStreamingSound->Create( strFileName ) )
|
||||
{
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_pStreamingSound->m_pDSBuffer->QueryInterface( IID_IDirectSound3DBuffer8, (VOID**) &m_pDS3DBuffer );
|
||||
m_Prop.dwSize = sizeof(DS3DBUFFER);
|
||||
m_pDS3DBuffer->GetAllParameters( &m_Prop );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::Destroy()
|
||||
{
|
||||
SAFE_RELEASE( m_pDS3DBuffer );
|
||||
SAFE_DELETE( m_pStreamingSound );
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::SetConeAngles( DWORD dwInside, DWORD dwOutside )
|
||||
{
|
||||
m_pDS3DBuffer->SetConeAngles( dwInside, dwOutside, DS3D_IMMEDIATE );
|
||||
m_Prop.dwInsideConeAngle = dwInside;
|
||||
m_Prop.dwOutsideConeAngle = dwOutside;
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::SetConeOrientation( D3DVECTOR& vOrientation )
|
||||
{
|
||||
m_pDS3DBuffer->SetConeOrientation( vOrientation.x,
|
||||
vOrientation.y,
|
||||
vOrientation.z, DS3D_IMMEDIATE );
|
||||
memcpy( &m_Prop.vConeOrientation, &vOrientation, sizeof(D3DVECTOR) );
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::SetConeOutsideVolume( float fVolume )
|
||||
{
|
||||
m_pDS3DBuffer->SetConeOutsideVolume( LinearToLogVol(fVolume), DS3D_IMMEDIATE );
|
||||
m_Prop.lConeOutsideVolume = LinearToLogVol(fVolume);
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::SetMaxDistance( float fMaxDist )
|
||||
{
|
||||
m_pDS3DBuffer->SetMaxDistance( fMaxDist, DS3D_IMMEDIATE );
|
||||
m_Prop.flMaxDistance = fMaxDist;
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::SetMinDistance( float fMinDist )
|
||||
{
|
||||
m_pDS3DBuffer->SetMinDistance( fMinDist, DS3D_IMMEDIATE );
|
||||
m_Prop.flMinDistance = fMinDist;
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::SetMode( DWORD dwMode )
|
||||
{
|
||||
m_pDS3DBuffer->SetMode( dwMode, DS3D_IMMEDIATE );
|
||||
m_Prop.dwMode = dwMode;
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::SetPosition( D3DVECTOR& vPos )
|
||||
{
|
||||
m_pDS3DBuffer->SetPosition( vPos.x, vPos.y, vPos.z, DS3D_IMMEDIATE );
|
||||
memcpy( &m_Prop.vPosition, &vPos, sizeof(D3DVECTOR) );
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::SetVelocity( const D3DVECTOR& vVel )
|
||||
{
|
||||
m_pDS3DBuffer->SetVelocity( vVel.x, vVel.y, vVel.z, DS3D_IMMEDIATE );
|
||||
memcpy( &m_Prop.vVelocity, &vVel, sizeof(D3DVECTOR) );
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::GetConeAngles( DWORD& dwInside, DWORD& dwOutside )
|
||||
{
|
||||
dwInside = m_Prop.dwInsideConeAngle;
|
||||
dwOutside = m_Prop.dwOutsideConeAngle;
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::GetConeOrientation( D3DVECTOR& vOrientation )
|
||||
{
|
||||
memcpy( &vOrientation, &m_Prop.vConeOrientation, sizeof(D3DVECTOR) );
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::GetConeOutsideVolume( float& fVolume )
|
||||
{
|
||||
fVolume = LogToLinearVol( m_Prop.lConeOutsideVolume );
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::GetMaxDistance( float& fMaxDist )
|
||||
{
|
||||
fMaxDist = m_Prop.flMaxDistance;
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::GetMinDistance( float& fMinDist )
|
||||
{
|
||||
fMinDist = m_Prop.flMinDistance;
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::GetMode( DWORD& dwMode )
|
||||
{
|
||||
dwMode = m_Prop.dwMode;
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::GetPosition( D3DVECTOR& vPos )
|
||||
{
|
||||
memcpy( &vPos, &m_Prop.vPosition, sizeof(D3DVECTOR) );
|
||||
}
|
||||
|
||||
|
||||
void CStreamingSound3D::GetVelocity( D3DVECTOR& vVel )
|
||||
{
|
||||
memcpy( &vVel, &m_Prop.vVelocity, sizeof(D3DVECTOR) );
|
||||
}
|
||||
67
Engine/SoundLib/StreamingSound3D.h
Normal file
67
Engine/SoundLib/StreamingSound3D.h
Normal file
@@ -0,0 +1,67 @@
|
||||
// StreamingSound3D.h: interface for the CStreamingSound3D class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_STREAMINGSOUND3D_H__2504463D_A560_4075_AD7C_14975B160E69__INCLUDED_)
|
||||
#define AFX_STREAMINGSOUND3D_H__2504463D_A560_4075_AD7C_14975B160E69__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include <dsound.h>
|
||||
|
||||
class CStreamingSound;
|
||||
class COggLoader;
|
||||
|
||||
class CStreamingSound3D
|
||||
{
|
||||
protected:
|
||||
CStreamingSound* m_pStreamingSound;
|
||||
LPDIRECTSOUND3DBUFFER8 m_pDS3DBuffer;
|
||||
DS3DBUFFER m_Prop;
|
||||
|
||||
public:
|
||||
CStreamingSound3D();
|
||||
virtual ~CStreamingSound3D();
|
||||
|
||||
bool Create( char* strFileName );
|
||||
void Destroy();
|
||||
void ServiceBuffer() { m_pStreamingSound->ServiceBuffer(); };
|
||||
void Play() { m_pStreamingSound->Play(); };
|
||||
void Stop() { m_pStreamingSound->Stop(); };
|
||||
HRESULT Reset() { return m_pStreamingSound->Reset(); };
|
||||
bool IsPlaying() { return m_pStreamingSound->m_bPlaying; };
|
||||
DWORD GetBufferSize() { return m_pStreamingSound->m_dwDSBufferSize; };
|
||||
void SetLooping( bool bLoop ) { m_pStreamingSound->SetLooping(bLoop); };
|
||||
bool IsLooping() { return m_pStreamingSound->IsLooping(); };
|
||||
void SetVolume( float fVol ) { m_pStreamingSound->SetVolume(fVol); };
|
||||
void GetVolume( float& fVol ) { m_pStreamingSound->GetVolume(fVol); };
|
||||
|
||||
//3D Property
|
||||
void SetPosition(D3DVECTOR& vPos);
|
||||
void GetPosition(D3DVECTOR& vPos);
|
||||
|
||||
void SetVelocity(const D3DVECTOR& vVel);
|
||||
void GetVelocity(D3DVECTOR& vVel);
|
||||
|
||||
void SetMaxDistance(float fMaxDist);
|
||||
void GetMaxDistance(float& fMaxDist);
|
||||
|
||||
void SetMinDistance(float fMinDist);
|
||||
void GetMinDistance(float& fMinDist);
|
||||
|
||||
void SetConeAngles(DWORD dwInside, DWORD dwOutside);
|
||||
void GetConeAngles(DWORD& dwInside, DWORD& dwOutside);
|
||||
|
||||
void SetConeOrientation(D3DVECTOR& vOrientation);
|
||||
void GetConeOrientation(D3DVECTOR& vOrientation);
|
||||
|
||||
void SetConeOutsideVolume(float fVolume);
|
||||
void GetConeOutsideVolume(float& fVolume);
|
||||
|
||||
void SetMode(DWORD dwMode);
|
||||
void GetMode(DWORD& dwMode);
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_STREAMINGSOUND3D_H__2504463D_A560_4075_AD7C_14975B160E69__INCLUDED_)
|
||||
538
Engine/SoundLib/WaveLoader.cpp
Normal file
538
Engine/SoundLib/WaveLoader.cpp
Normal file
@@ -0,0 +1,538 @@
|
||||
// WaveLoader.cpp: implementation of the CWaveLoader class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "WaveLoader.h"
|
||||
#include "GMMemory.h"
|
||||
|
||||
CWaveLoader::CWaveLoader() : m_pwfx(NULL),
|
||||
m_hmmio(NULL),
|
||||
m_pResourceBuffer(NULL),
|
||||
m_dwSize(0),
|
||||
m_bIsReadingFromMemory(FALSE),
|
||||
m_bEOF(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CWaveLoader::~CWaveLoader()
|
||||
{
|
||||
Close();
|
||||
|
||||
if( !m_bIsReadingFromMemory )
|
||||
SAFE_DELETE_ARRAY( m_pwfx );
|
||||
}
|
||||
|
||||
|
||||
HRESULT CWaveLoader::Open( LPTSTR strFileName, WAVEFORMATEX* pwfx, DWORD dwFlags )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
m_dwFlags = dwFlags;
|
||||
m_bIsReadingFromMemory = FALSE;
|
||||
|
||||
if( m_dwFlags == WAVEFILE_READ )
|
||||
{
|
||||
if( strFileName == NULL )
|
||||
return E_INVALIDARG;
|
||||
SAFE_DELETE_ARRAY( m_pwfx );
|
||||
|
||||
m_hmmio = mmioOpen( strFileName, NULL, MMIO_ALLOCBUF | MMIO_READ );
|
||||
|
||||
if( NULL == m_hmmio )
|
||||
{
|
||||
HRSRC hResInfo;
|
||||
HGLOBAL hResData;
|
||||
DWORD dwSize;
|
||||
VOID* pvRes;
|
||||
|
||||
// Loading it as a file failed, so try it as a resource
|
||||
if( NULL == ( hResInfo = FindResource( NULL, strFileName, TEXT("WAVE") ) ) )
|
||||
{
|
||||
if( NULL == ( hResInfo = FindResource( NULL, strFileName, TEXT("WAV") ) ) )
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if( NULL == ( hResData = LoadResource( NULL, hResInfo ) ) )
|
||||
return E_FAIL;
|
||||
|
||||
if( 0 == ( dwSize = SizeofResource( NULL, hResInfo ) ) )
|
||||
return E_FAIL;
|
||||
|
||||
if( NULL == ( pvRes = LockResource( hResData ) ) )
|
||||
return E_FAIL;
|
||||
|
||||
m_pResourceBuffer = new CHAR[ dwSize ];
|
||||
memcpy( m_pResourceBuffer, pvRes, dwSize );
|
||||
|
||||
MMIOINFO mmioInfo;
|
||||
ZeroMemory( &mmioInfo, sizeof(mmioInfo) );
|
||||
mmioInfo.fccIOProc = FOURCC_MEM;
|
||||
mmioInfo.cchBuffer = dwSize;
|
||||
mmioInfo.pchBuffer = (CHAR*) m_pResourceBuffer;
|
||||
|
||||
m_hmmio = mmioOpen( NULL, &mmioInfo, MMIO_ALLOCBUF | MMIO_READ );
|
||||
}
|
||||
|
||||
if( FAILED( hr = ReadMMIO() ) )
|
||||
{
|
||||
// ReadMMIO will fail if its an not a wave file
|
||||
mmioClose( m_hmmio, 0 );
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if( FAILED( hr = ResetFile() ) )
|
||||
return E_FAIL;
|
||||
|
||||
// After the reset, the size of the wav file is m_ck.cksize so store it now
|
||||
m_dwSize = m_ck.cksize;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hmmio = mmioOpen( strFileName, NULL, MMIO_ALLOCBUF |
|
||||
MMIO_READWRITE |
|
||||
MMIO_CREATE );
|
||||
if( NULL == m_hmmio )
|
||||
return E_FAIL;
|
||||
|
||||
if( FAILED( hr = WriteMMIO( pwfx ) ) )
|
||||
{
|
||||
mmioClose( m_hmmio, 0 );
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if( FAILED( hr = ResetFile() ) )
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: CWaveLoader::OpenFromMemory()
|
||||
// Desc: copy data to CWaveLoader member variable from memory
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CWaveLoader::OpenFromMemory( BYTE* pbData, ULONG ulDataSize,
|
||||
WAVEFORMATEX* pwfx, DWORD dwFlags )
|
||||
{
|
||||
m_pwfx = pwfx;
|
||||
m_ulDataSize = ulDataSize;
|
||||
m_pbData = pbData;
|
||||
m_pbDataCur = m_pbData;
|
||||
m_bIsReadingFromMemory = TRUE;
|
||||
|
||||
if( dwFlags != WAVEFILE_READ )
|
||||
return E_NOTIMPL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: CWaveLoader::ReadMMIO()
|
||||
// Desc: Support function for reading from a multimedia I/O stream.
|
||||
// m_hmmio must be valid before calling. This function uses it to
|
||||
// update m_ckRiff, and m_pwfx.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CWaveLoader::ReadMMIO()
|
||||
{
|
||||
MMCKINFO ckIn; // chunk info. for general use.
|
||||
PCMWAVEFORMAT pcmWaveFormat; // Temp PCM structure to load in.
|
||||
|
||||
m_pwfx = NULL;
|
||||
|
||||
if( ( 0 != mmioDescend( m_hmmio, &m_ckRiff, NULL, 0 ) ) )
|
||||
return E_FAIL;
|
||||
|
||||
// Check to make sure this is a valid wave file
|
||||
if( (m_ckRiff.ckid != FOURCC_RIFF) ||
|
||||
(m_ckRiff.fccType != mmioFOURCC('W', 'A', 'V', 'E') ) )
|
||||
return E_FAIL;
|
||||
|
||||
// Search the input file for for the 'fmt ' chunk.
|
||||
ckIn.ckid = mmioFOURCC('f', 'm', 't', ' ');
|
||||
if( 0 != mmioDescend( m_hmmio, &ckIn, &m_ckRiff, MMIO_FINDCHUNK ) )
|
||||
return E_FAIL;
|
||||
|
||||
// Expect the 'fmt' chunk to be at least as large as <PCMWAVEFORMAT>;
|
||||
// if there are extra parameters at the end, we'll ignore them
|
||||
if( ckIn.cksize < (LONG) sizeof(PCMWAVEFORMAT) )
|
||||
return E_FAIL;
|
||||
|
||||
// Read the 'fmt ' chunk into <pcmWaveFormat>.
|
||||
if( mmioRead( m_hmmio, (HPSTR) &pcmWaveFormat,
|
||||
sizeof(pcmWaveFormat)) != sizeof(pcmWaveFormat) )
|
||||
return E_FAIL;
|
||||
|
||||
// Allocate the waveformatex, but if its not pcm format, read the next
|
||||
// word, and thats how many extra bytes to allocate.
|
||||
if( pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM )
|
||||
{
|
||||
m_pwfx = (WAVEFORMATEX*)new CHAR[ sizeof(WAVEFORMATEX) ];
|
||||
if( NULL == m_pwfx )
|
||||
return E_FAIL;
|
||||
|
||||
// Copy the bytes from the pcm structure to the waveformatex structure
|
||||
memcpy( m_pwfx, &pcmWaveFormat, sizeof(pcmWaveFormat) );
|
||||
m_pwfx->cbSize = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read in length of extra bytes.
|
||||
WORD cbExtraBytes = 0L;
|
||||
if( mmioRead( m_hmmio, (CHAR*)&cbExtraBytes, sizeof(WORD)) != sizeof(WORD) )
|
||||
return E_FAIL;
|
||||
|
||||
m_pwfx = (WAVEFORMATEX*)new CHAR[ sizeof(WAVEFORMATEX) + cbExtraBytes ];
|
||||
if( NULL == m_pwfx )
|
||||
return E_FAIL;
|
||||
|
||||
// Copy the bytes from the pcm structure to the waveformatex structure
|
||||
memcpy( m_pwfx, &pcmWaveFormat, sizeof(pcmWaveFormat) );
|
||||
m_pwfx->cbSize = cbExtraBytes;
|
||||
|
||||
// Now, read those extra bytes into the structure, if cbExtraAlloc != 0.
|
||||
if( mmioRead( m_hmmio, (CHAR*)(((BYTE*)&(m_pwfx->cbSize))+sizeof(WORD)),
|
||||
cbExtraBytes ) != cbExtraBytes )
|
||||
{
|
||||
SAFE_DELETE( m_pwfx );
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
// Ascend the input file out of the 'fmt ' chunk.
|
||||
if( 0 != mmioAscend( m_hmmio, &ckIn, 0 ) )
|
||||
{
|
||||
SAFE_DELETE( m_pwfx );
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: CWaveLoader::GetSize()
|
||||
// Desc: Retuns the size of the read access wave file
|
||||
//-----------------------------------------------------------------------------
|
||||
DWORD CWaveLoader::GetSize()
|
||||
{
|
||||
return m_dwSize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: CWaveLoader::ResetFile()
|
||||
// Desc: Resets the internal m_ck pointer so reading starts from the
|
||||
// beginning of the file again
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CWaveLoader::ResetFile()
|
||||
{
|
||||
if( m_bIsReadingFromMemory )
|
||||
{
|
||||
m_pbDataCur = m_pbData;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_hmmio == NULL )
|
||||
return CO_E_NOTINITIALIZED;
|
||||
|
||||
if( m_dwFlags == WAVEFILE_READ )
|
||||
{
|
||||
// Seek to the data
|
||||
if( -1 == mmioSeek( m_hmmio, m_ckRiff.dwDataOffset + sizeof(FOURCC),
|
||||
SEEK_SET ) )
|
||||
return E_FAIL;
|
||||
|
||||
// Search the input file for the 'data' chunk.
|
||||
m_ck.ckid = mmioFOURCC('d', 'a', 't', 'a');
|
||||
if( 0 != mmioDescend( m_hmmio, &m_ck, &m_ckRiff, MMIO_FINDCHUNK ) )
|
||||
return E_FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create the 'data' chunk that holds the waveform samples.
|
||||
m_ck.ckid = mmioFOURCC('d', 'a', 't', 'a');
|
||||
m_ck.cksize = 0;
|
||||
|
||||
if( 0 != mmioCreateChunk( m_hmmio, &m_ck, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
if( 0 != mmioGetInfo( m_hmmio, &m_mmioinfoOut, 0 ) )
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
m_bEOF = false;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: CWaveLoader::Read()
|
||||
// Desc: Reads section of data from a wave file into pBuffer and returns
|
||||
// how much read in pdwSizeRead, reading not more than dwSizeToRead.
|
||||
// This uses m_ck to determine where to start reading from. So
|
||||
// subsequent calls will be continue where the last left off unless
|
||||
// Reset() is called.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CWaveLoader::Read( BYTE* pBuffer, DWORD dwSizeToRead, DWORD* pdwSizeRead )
|
||||
{
|
||||
if( m_bIsReadingFromMemory )
|
||||
{
|
||||
if( m_pbDataCur == NULL )
|
||||
return CO_E_NOTINITIALIZED;
|
||||
if( pdwSizeRead != NULL )
|
||||
*pdwSizeRead = 0;
|
||||
|
||||
if( (BYTE*)(m_pbDataCur + dwSizeToRead) >
|
||||
(BYTE*)(m_pbData + m_ulDataSize) )
|
||||
{
|
||||
dwSizeToRead = m_ulDataSize - (DWORD)(m_pbDataCur - m_pbData);
|
||||
}
|
||||
|
||||
CopyMemory( pBuffer, m_pbDataCur, dwSizeToRead );
|
||||
|
||||
if( pdwSizeRead != NULL )
|
||||
*pdwSizeRead = dwSizeToRead;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
MMIOINFO mmioinfoIn; // current status of m_hmmio
|
||||
|
||||
if( m_hmmio == NULL )
|
||||
return CO_E_NOTINITIALIZED;
|
||||
if( pBuffer == NULL || pdwSizeRead == NULL )
|
||||
return E_INVALIDARG;
|
||||
|
||||
if( pdwSizeRead != NULL )
|
||||
*pdwSizeRead = 0;
|
||||
|
||||
if( 0 != mmioGetInfo( m_hmmio, &mmioinfoIn, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
UINT cbDataIn = dwSizeToRead;
|
||||
if( cbDataIn > m_ck.cksize )
|
||||
cbDataIn = m_ck.cksize;
|
||||
|
||||
m_ck.cksize -= cbDataIn;
|
||||
|
||||
for( DWORD cT = 0; cT < cbDataIn; cT++ )
|
||||
{
|
||||
// Copy the bytes from the io to the buffer.
|
||||
if( mmioinfoIn.pchNext == mmioinfoIn.pchEndRead )
|
||||
{
|
||||
if( 0 != mmioAdvance( m_hmmio, &mmioinfoIn, MMIO_READ ) )
|
||||
return E_FAIL;
|
||||
|
||||
if( mmioinfoIn.pchNext == mmioinfoIn.pchEndRead )
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Actual copy.
|
||||
*((BYTE*)pBuffer+cT) = *((BYTE*)mmioinfoIn.pchNext);
|
||||
mmioinfoIn.pchNext++;
|
||||
}
|
||||
|
||||
if( 0 != mmioSetInfo( m_hmmio, &mmioinfoIn, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
if( pdwSizeRead != NULL )
|
||||
*pdwSizeRead = cbDataIn;
|
||||
|
||||
// Check to see if we hit the end of the file
|
||||
if(m_ck.cksize == 0)
|
||||
m_bEOF = true;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: CWaveLoader::Close()
|
||||
// Desc: Closes the wave file
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CWaveLoader::Close()
|
||||
{
|
||||
if( m_dwFlags == WAVEFILE_READ )
|
||||
{
|
||||
mmioClose( m_hmmio, 0 );
|
||||
m_hmmio = NULL;
|
||||
SAFE_DELETE_ARRAY( m_pResourceBuffer );
|
||||
|
||||
m_bEOF = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mmioinfoOut.dwFlags |= MMIO_DIRTY;
|
||||
|
||||
if( m_hmmio == NULL )
|
||||
return CO_E_NOTINITIALIZED;
|
||||
|
||||
if( 0 != mmioSetInfo( m_hmmio, &m_mmioinfoOut, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
// Ascend the output file out of the 'data' chunk -- this will cause
|
||||
// the chunk size of the 'data' chunk to be written.
|
||||
if( 0 != mmioAscend( m_hmmio, &m_ck, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
// Do this here instead...
|
||||
if( 0 != mmioAscend( m_hmmio, &m_ckRiff, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
mmioSeek( m_hmmio, 0, SEEK_SET );
|
||||
|
||||
if( 0 != (INT)mmioDescend( m_hmmio, &m_ckRiff, NULL, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
m_ck.ckid = mmioFOURCC('f', 'a', 'c', 't');
|
||||
|
||||
if( 0 == mmioDescend( m_hmmio, &m_ck, &m_ckRiff, MMIO_FINDCHUNK ) )
|
||||
{
|
||||
DWORD dwSamples = 0;
|
||||
mmioWrite( m_hmmio, (HPSTR)&dwSamples, sizeof(DWORD) );
|
||||
mmioAscend( m_hmmio, &m_ck, 0 );
|
||||
}
|
||||
|
||||
// Ascend the output file out of the 'RIFF' chunk -- this will cause
|
||||
// the chunk size of the 'RIFF' chunk to be written.
|
||||
if( 0 != mmioAscend( m_hmmio, &m_ckRiff, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
mmioClose( m_hmmio, 0 );
|
||||
m_hmmio = NULL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: CWaveLoader::WriteMMIO()
|
||||
// Desc: Support function for reading from a multimedia I/O stream
|
||||
// pwfxDest is the WAVEFORMATEX for this new wave file.
|
||||
// m_hmmio must be valid before calling. This function uses it to
|
||||
// update m_ckRiff, and m_ck.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CWaveLoader::WriteMMIO( WAVEFORMATEX *pwfxDest )
|
||||
{
|
||||
DWORD dwFactChunk; // Contains the actual fact chunk. Garbage until WaveCloseWriteFile.
|
||||
MMCKINFO ckOut1;
|
||||
|
||||
dwFactChunk = (DWORD)-1;
|
||||
|
||||
// Create the output file RIFF chunk of form type 'WAVE'.
|
||||
m_ckRiff.fccType = mmioFOURCC('W', 'A', 'V', 'E');
|
||||
m_ckRiff.cksize = 0;
|
||||
|
||||
if( 0 != mmioCreateChunk( m_hmmio, &m_ckRiff, MMIO_CREATERIFF ) )
|
||||
return E_FAIL;
|
||||
|
||||
// We are now descended into the 'RIFF' chunk we just created.
|
||||
// Now create the 'fmt ' chunk. Since we know the size of this chunk,
|
||||
// specify it in the MMCKINFO structure so MMIO doesn't have to seek
|
||||
// back and set the chunk size after ascending from the chunk.
|
||||
m_ck.ckid = mmioFOURCC('f', 'm', 't', ' ');
|
||||
m_ck.cksize = sizeof(PCMWAVEFORMAT);
|
||||
|
||||
if( 0 != mmioCreateChunk( m_hmmio, &m_ck, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
// Write the PCMWAVEFORMAT structure to the 'fmt ' chunk if its that type.
|
||||
if( pwfxDest->wFormatTag == WAVE_FORMAT_PCM )
|
||||
{
|
||||
if( mmioWrite( m_hmmio, (HPSTR) pwfxDest,
|
||||
sizeof(PCMWAVEFORMAT)) != sizeof(PCMWAVEFORMAT))
|
||||
return E_FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Write the variable length size.
|
||||
if( (UINT)mmioWrite( m_hmmio, (HPSTR) pwfxDest,
|
||||
sizeof(*pwfxDest) + pwfxDest->cbSize ) !=
|
||||
( sizeof(*pwfxDest) + pwfxDest->cbSize ) )
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Ascend out of the 'fmt ' chunk, back into the 'RIFF' chunk.
|
||||
if( 0 != mmioAscend( m_hmmio, &m_ck, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
// Now create the fact chunk, not required for PCM but nice to have. This is filled
|
||||
// in when the close routine is called.
|
||||
ckOut1.ckid = mmioFOURCC('f', 'a', 'c', 't');
|
||||
ckOut1.cksize = 0;
|
||||
|
||||
if( 0 != mmioCreateChunk( m_hmmio, &ckOut1, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
if( mmioWrite( m_hmmio, (HPSTR)&dwFactChunk, sizeof(dwFactChunk)) !=
|
||||
sizeof(dwFactChunk) )
|
||||
return E_FAIL;
|
||||
|
||||
// Now ascend out of the fact chunk...
|
||||
if( 0 != mmioAscend( m_hmmio, &ckOut1, 0 ) )
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: CWaveLoader::Write()
|
||||
// Desc: Writes data to the open wave file
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CWaveLoader::Write( UINT nSizeToWrite, BYTE* pbSrcData, UINT* pnSizeWrote )
|
||||
{
|
||||
UINT cT;
|
||||
|
||||
if( m_bIsReadingFromMemory )
|
||||
return E_NOTIMPL;
|
||||
if( m_hmmio == NULL )
|
||||
return CO_E_NOTINITIALIZED;
|
||||
if( pnSizeWrote == NULL || pbSrcData == NULL )
|
||||
return E_INVALIDARG;
|
||||
|
||||
*pnSizeWrote = 0;
|
||||
|
||||
for( cT = 0; cT < nSizeToWrite; cT++ )
|
||||
{
|
||||
if( m_mmioinfoOut.pchNext == m_mmioinfoOut.pchEndWrite )
|
||||
{
|
||||
m_mmioinfoOut.dwFlags |= MMIO_DIRTY;
|
||||
if( 0 != mmioAdvance( m_hmmio, &m_mmioinfoOut, MMIO_WRITE ) )
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
*((BYTE*)m_mmioinfoOut.pchNext) = *((BYTE*)pbSrcData+cT);
|
||||
(BYTE*)m_mmioinfoOut.pchNext++;
|
||||
|
||||
(*pnSizeWrote)++;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
57
Engine/SoundLib/WaveLoader.h
Normal file
57
Engine/SoundLib/WaveLoader.h
Normal file
@@ -0,0 +1,57 @@
|
||||
// WaveLoader.h: interface for the CWaveLoader class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_WAVELOADER_H__3687F4CA_E7BA_48A0_93A9_A32858B43DF2__INCLUDED_)
|
||||
#define AFX_WAVELOADER_H__3687F4CA_E7BA_48A0_93A9_A32858B43DF2__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include <dsound.h>
|
||||
#include "DefineSound.h"
|
||||
|
||||
#define WAVEFILE_READ 1
|
||||
#define WAVEFILE_WRITE 2
|
||||
|
||||
class CWaveLoader
|
||||
{
|
||||
public:
|
||||
WAVEFORMATEX* m_pwfx; // Pointer to WAVEFORMATEX structure
|
||||
HMMIO m_hmmio; // MM I/O handle for the WAVE
|
||||
CHAR* m_pResourceBuffer;
|
||||
DWORD m_dwSize; // The size of the wave file
|
||||
BOOL m_bIsReadingFromMemory;
|
||||
bool m_bEOF;
|
||||
|
||||
MMCKINFO m_ck; // Multimedia RIFF chunk
|
||||
MMCKINFO m_ckRiff; // Use in opening a WAVE file
|
||||
MMIOINFO m_mmioinfoOut;
|
||||
DWORD m_dwFlags;
|
||||
BYTE* m_pbData;
|
||||
BYTE* m_pbDataCur;
|
||||
ULONG m_ulDataSize;
|
||||
|
||||
protected:
|
||||
HRESULT ReadMMIO();
|
||||
HRESULT WriteMMIO( WAVEFORMATEX *pwfxDest );
|
||||
|
||||
public:
|
||||
CWaveLoader();
|
||||
~CWaveLoader();
|
||||
|
||||
bool IsEOF() { return m_bEOF; };
|
||||
HRESULT Open( LPTSTR strFileName, WAVEFORMATEX* pwfx, DWORD dwFlags );
|
||||
HRESULT OpenFromMemory( BYTE* pbData, ULONG ulDataSize, WAVEFORMATEX* pwfx, DWORD dwFlags );
|
||||
HRESULT Close();
|
||||
HRESULT Read( BYTE* pBuffer, DWORD dwSizeToRead, DWORD* pdwSizeRead );
|
||||
HRESULT Write( UINT nSizeToWrite, BYTE* pbData, UINT* pnSizeWrote );
|
||||
DWORD GetSize();
|
||||
HRESULT ResetFile();
|
||||
WAVEFORMATEX* GetFormat() { return m_pwfx; };
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_WAVELOADER_H__3687F4CA_E7BA_48A0_93A9_A32858B43DF2__INCLUDED_)
|
||||
457
Engine/SoundLib/eax.h
Normal file
457
Engine/SoundLib/eax.h
Normal file
@@ -0,0 +1,457 @@
|
||||
/******************************************************************
|
||||
*
|
||||
* EAX.H - DirectSound3D Environmental Audio Extensions version 2.0
|
||||
* Updated July 8, 1999
|
||||
*
|
||||
*******************************************************************
|
||||
*/
|
||||
|
||||
#ifndef EAX_H_INCLUDED
|
||||
#define EAX_H_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef OPENAL
|
||||
#include <dsound.h>
|
||||
/*
|
||||
* EAX Wrapper Interface (using Direct X 7) {4FF53B81-1CE0-11d3-AAB8-00A0C95949D5}
|
||||
*/
|
||||
DEFINE_GUID(CLSID_EAXDirectSound,
|
||||
0x4ff53b81,
|
||||
0x1ce0,
|
||||
0x11d3,
|
||||
0xaa, 0xb8, 0x0, 0xa0, 0xc9, 0x59, 0x49, 0xd5);
|
||||
|
||||
/*
|
||||
* EAX Wrapper Interface (using Direct X 8) {CA503B60-B176-11d4-A094-D0C0BF3A560C}
|
||||
*/
|
||||
DEFINE_GUID(CLSID_EAXDirectSound8,
|
||||
0xca503b60,
|
||||
0xb176,
|
||||
0x11d4,
|
||||
0xa0, 0x94, 0xd0, 0xc0, 0xbf, 0x3a, 0x56, 0xc);
|
||||
|
||||
#ifdef DIRECTSOUND_VERSION
|
||||
#if DIRECTSOUND_VERSION == 0x0800
|
||||
__declspec(dllimport) HRESULT WINAPI EAXDirectSoundCreate8(GUID*, LPDIRECTSOUND8*, IUnknown FAR *);
|
||||
typedef HRESULT (FAR PASCAL *LPEAXDIRECTSOUNDCREATE8)(GUID*, LPDIRECTSOUND8*, IUnknown FAR*);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
__declspec(dllimport) HRESULT WINAPI EAXDirectSoundCreate(GUID*, LPDIRECTSOUND*, IUnknown FAR *);
|
||||
typedef HRESULT (FAR PASCAL *LPEAXDIRECTSOUNDCREATE)(GUID*, LPDIRECTSOUND*, IUnknown FAR*);
|
||||
|
||||
#else
|
||||
#include <al.h>
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
#define GUID_DEFINED
|
||||
typedef struct _GUID
|
||||
{
|
||||
unsigned long Data1;
|
||||
unsigned short Data2;
|
||||
unsigned short Data3;
|
||||
unsigned char Data4[8];
|
||||
} GUID;
|
||||
#endif // !GUID_DEFINED
|
||||
|
||||
#ifndef DEFINE_GUID
|
||||
#ifndef INITGUID
|
||||
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
extern const GUID FAR name
|
||||
#else
|
||||
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
||||
#endif // INITGUID
|
||||
#endif // DEFINE_GUID
|
||||
|
||||
/*
|
||||
* EAX OpenAL Extension {4FF53B81-1CE0-11d3-AAB8-00A0C95949D5}
|
||||
*/
|
||||
typedef ALenum (*EAXSet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint);
|
||||
typedef ALenum (*EAXGet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint);
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
||||
/*
|
||||
* EAX 2.0 listener property set {0306A6A8-B224-11d2-99E5-0000E8D8C722}
|
||||
*/
|
||||
DEFINE_GUID(DSPROPSETID_EAX20_ListenerProperties,
|
||||
0x306a6a8,
|
||||
0xb224,
|
||||
0x11d2,
|
||||
0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22);
|
||||
|
||||
// For compatibility with future EAX versions:
|
||||
#define DSPROPSETID_EAX_ListenerProperties DSPROPSETID_EAX20_ListenerProperties
|
||||
#define DSPROPSETID_EAX_SourceProperties DSPROPSETID_EAX20_BufferProperties
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DSPROPERTY_EAXLISTENER_NONE,
|
||||
DSPROPERTY_EAXLISTENER_ALLPARAMETERS,
|
||||
DSPROPERTY_EAXLISTENER_ROOM,
|
||||
DSPROPERTY_EAXLISTENER_ROOMHF,
|
||||
DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR,
|
||||
DSPROPERTY_EAXLISTENER_DECAYTIME,
|
||||
DSPROPERTY_EAXLISTENER_DECAYHFRATIO,
|
||||
DSPROPERTY_EAXLISTENER_REFLECTIONS,
|
||||
DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY,
|
||||
DSPROPERTY_EAXLISTENER_REVERB,
|
||||
DSPROPERTY_EAXLISTENER_REVERBDELAY,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENT,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION,
|
||||
DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF,
|
||||
DSPROPERTY_EAXLISTENER_FLAGS
|
||||
} DSPROPERTY_EAX_LISTENERPROPERTY;
|
||||
|
||||
// OR these flags with property id
|
||||
#define DSPROPERTY_EAXLISTENER_IMMEDIATE 0x00000000 // changes take effect immediately
|
||||
#define DSPROPERTY_EAXLISTENER_DEFERRED 0x80000000 // changes take effect later
|
||||
#define DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXLISTENER_NONE | \
|
||||
DSPROPERTY_EAXLISTENER_IMMEDIATE)
|
||||
|
||||
// Use this structure for DSPROPERTY_EAXLISTENER_ALLPARAMETERS
|
||||
// - all levels are hundredths of decibels
|
||||
// - all times are in seconds
|
||||
// - the reference for high frequency controls is 5 kHz
|
||||
//
|
||||
// NOTE: This structure may change in future EAX versions.
|
||||
// It is recommended to initialize fields by name:
|
||||
// myListener.lRoom = -1000;
|
||||
// myListener.lRoomHF = -100;
|
||||
// ...
|
||||
// myListener.dwFlags = myFlags /* see EAXLISTENERFLAGS below */ ;
|
||||
// instead of:
|
||||
// myListener = { -1000, -100, ... , 0x00000009 };
|
||||
// If you want to save and load presets in binary form, you
|
||||
// should define your own structure to insure future compatibility.
|
||||
//
|
||||
typedef struct _EAXLISTENERPROPERTIES
|
||||
{
|
||||
long lRoom; // room effect level at low frequencies
|
||||
long lRoomHF; // room effect high-frequency level re. low frequency level
|
||||
float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
|
||||
float flDecayTime; // reverberation decay time at low frequencies
|
||||
float flDecayHFRatio; // high-frequency to low-frequency decay time ratio
|
||||
long lReflections; // early reflections level relative to room effect
|
||||
float flReflectionsDelay; // initial reflection delay time
|
||||
long lReverb; // late reverberation level relative to room effect
|
||||
float flReverbDelay; // late reverberation delay time relative to initial reflection
|
||||
unsigned long dwEnvironment; // sets all listener properties
|
||||
float flEnvironmentSize; // environment size in meters
|
||||
float flEnvironmentDiffusion; // environment diffusion
|
||||
float flAirAbsorptionHF; // change in level per meter at 5 kHz
|
||||
unsigned long dwFlags; // modifies the behavior of properties
|
||||
} EAXLISTENERPROPERTIES, *LPEAXLISTENERPROPERTIES;
|
||||
|
||||
// used by DSPROPERTY_EAXLISTENER_ENVIRONMENT
|
||||
enum
|
||||
{
|
||||
EAX_ENVIRONMENT_GENERIC,
|
||||
EAX_ENVIRONMENT_PADDEDCELL,
|
||||
EAX_ENVIRONMENT_ROOM,
|
||||
EAX_ENVIRONMENT_BATHROOM,
|
||||
EAX_ENVIRONMENT_LIVINGROOM,
|
||||
EAX_ENVIRONMENT_STONEROOM,
|
||||
EAX_ENVIRONMENT_AUDITORIUM,
|
||||
EAX_ENVIRONMENT_CONCERTHALL,
|
||||
EAX_ENVIRONMENT_CAVE,
|
||||
EAX_ENVIRONMENT_ARENA,
|
||||
EAX_ENVIRONMENT_HANGAR,
|
||||
EAX_ENVIRONMENT_CARPETEDHALLWAY,
|
||||
EAX_ENVIRONMENT_HALLWAY,
|
||||
EAX_ENVIRONMENT_STONECORRIDOR,
|
||||
EAX_ENVIRONMENT_ALLEY,
|
||||
EAX_ENVIRONMENT_FOREST,
|
||||
EAX_ENVIRONMENT_CITY,
|
||||
EAX_ENVIRONMENT_MOUNTAINS,
|
||||
EAX_ENVIRONMENT_QUARRY,
|
||||
EAX_ENVIRONMENT_PLAIN,
|
||||
EAX_ENVIRONMENT_PARKINGLOT,
|
||||
EAX_ENVIRONMENT_SEWERPIPE,
|
||||
EAX_ENVIRONMENT_UNDERWATER,
|
||||
EAX_ENVIRONMENT_DRUGGED,
|
||||
EAX_ENVIRONMENT_DIZZY,
|
||||
EAX_ENVIRONMENT_PSYCHOTIC,
|
||||
|
||||
EAX_ENVIRONMENT_COUNT
|
||||
};
|
||||
|
||||
// Used by DSPROPERTY_EAXLISTENER_FLAGS
|
||||
//
|
||||
// Note: The number and order of flags may change in future EAX versions.
|
||||
// It is recommended to use the flag defines as follows:
|
||||
// myFlags = EAXLISTENERFLAGS_DECAYTIMESCALE | EAXLISTENERFLAGS_REVERBSCALE;
|
||||
// instead of:
|
||||
// myFlags = 0x00000009;
|
||||
//
|
||||
// These flags determine what properties are affected by environment size.
|
||||
#define EAXLISTENERFLAGS_DECAYTIMESCALE 0x00000001 // reverberation decay time
|
||||
#define EAXLISTENERFLAGS_REFLECTIONSSCALE 0x00000002 // reflection level
|
||||
#define EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE 0x00000004 // initial reflection delay time
|
||||
#define EAXLISTENERFLAGS_REVERBSCALE 0x00000008 // reflections level
|
||||
#define EAXLISTENERFLAGS_REVERBDELAYSCALE 0x00000010 // late reverberation delay time
|
||||
|
||||
// This flag limits high-frequency decay time according to air absorption.
|
||||
#define EAXLISTENERFLAGS_DECAYHFLIMIT 0x00000020
|
||||
|
||||
#define EAXLISTENERFLAGS_RESERVED 0xFFFFFFC0 // reserved future use
|
||||
|
||||
// property ranges and defaults:
|
||||
|
||||
#define EAXLISTENER_MINROOM (-10000)
|
||||
#define EAXLISTENER_MAXROOM 0
|
||||
#define EAXLISTENER_DEFAULTROOM (-1000)
|
||||
|
||||
#define EAXLISTENER_MINROOMHF (-10000)
|
||||
#define EAXLISTENER_MAXROOMHF 0
|
||||
#define EAXLISTENER_DEFAULTROOMHF (-100)
|
||||
|
||||
#define EAXLISTENER_MINROOMROLLOFFFACTOR 0.0f
|
||||
#define EAXLISTENER_MAXROOMROLLOFFFACTOR 10.0f
|
||||
#define EAXLISTENER_DEFAULTROOMROLLOFFFACTOR 0.0f
|
||||
|
||||
#define EAXLISTENER_MINDECAYTIME 0.1f
|
||||
#define EAXLISTENER_MAXDECAYTIME 20.0f
|
||||
#define EAXLISTENER_DEFAULTDECAYTIME 1.49f
|
||||
|
||||
#define EAXLISTENER_MINDECAYHFRATIO 0.1f
|
||||
#define EAXLISTENER_MAXDECAYHFRATIO 2.0f
|
||||
#define EAXLISTENER_DEFAULTDECAYHFRATIO 0.83f
|
||||
|
||||
#define EAXLISTENER_MINREFLECTIONS (-10000)
|
||||
#define EAXLISTENER_MAXREFLECTIONS 1000
|
||||
#define EAXLISTENER_DEFAULTREFLECTIONS (-2602)
|
||||
|
||||
#define EAXLISTENER_MINREFLECTIONSDELAY 0.0f
|
||||
#define EAXLISTENER_MAXREFLECTIONSDELAY 0.3f
|
||||
#define EAXLISTENER_DEFAULTREFLECTIONSDELAY 0.007f
|
||||
|
||||
#define EAXLISTENER_MINREVERB (-10000)
|
||||
#define EAXLISTENER_MAXREVERB 2000
|
||||
#define EAXLISTENER_DEFAULTREVERB 200
|
||||
|
||||
#define EAXLISTENER_MINREVERBDELAY 0.0f
|
||||
#define EAXLISTENER_MAXREVERBDELAY 0.1f
|
||||
#define EAXLISTENER_DEFAULTREVERBDELAY 0.011f
|
||||
|
||||
#define EAXLISTENER_MINENVIRONMENT 0
|
||||
#define EAXLISTENER_MAXENVIRONMENT (EAX_ENVIRONMENT_COUNT-1)
|
||||
#define EAXLISTENER_DEFAULTENVIRONMENT EAX_ENVIRONMENT_GENERIC
|
||||
|
||||
#define EAXLISTENER_MINENVIRONMENTSIZE 1.0f
|
||||
#define EAXLISTENER_MAXENVIRONMENTSIZE 100.0f
|
||||
#define EAXLISTENER_DEFAULTENVIRONMENTSIZE 7.5f
|
||||
|
||||
#define EAXLISTENER_MINENVIRONMENTDIFFUSION 0.0f
|
||||
#define EAXLISTENER_MAXENVIRONMENTDIFFUSION 1.0f
|
||||
#define EAXLISTENER_DEFAULTENVIRONMENTDIFFUSION 1.0f
|
||||
|
||||
#define EAXLISTENER_MINAIRABSORPTIONHF (-100.0f)
|
||||
#define EAXLISTENER_MAXAIRABSORPTIONHF 0.0f
|
||||
#define EAXLISTENER_DEFAULTAIRABSORPTIONHF (-5.0f)
|
||||
|
||||
#define EAXLISTENER_DEFAULTFLAGS (EAXLISTENERFLAGS_DECAYTIMESCALE | \
|
||||
EAXLISTENERFLAGS_REFLECTIONSSCALE | \
|
||||
EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE | \
|
||||
EAXLISTENERFLAGS_REVERBSCALE | \
|
||||
EAXLISTENERFLAGS_REVERBDELAYSCALE | \
|
||||
EAXLISTENERFLAGS_DECAYHFLIMIT)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* EAX 2.0 buffer property set {0306A6A7-B224-11d2-99E5-0000E8D8C722}
|
||||
*/
|
||||
DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties,
|
||||
0x306a6a7,
|
||||
0xb224,
|
||||
0x11d2,
|
||||
0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22);
|
||||
|
||||
// For compatibility with future EAX versions:
|
||||
#define DSPROPSETID_EAX_BufferProperties DSPROPSETID_EAX20_BufferProperties
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DSPROPERTY_EAXBUFFER_NONE,
|
||||
DSPROPERTY_EAXBUFFER_ALLPARAMETERS,
|
||||
DSPROPERTY_EAXBUFFER_DIRECT,
|
||||
DSPROPERTY_EAXBUFFER_DIRECTHF,
|
||||
DSPROPERTY_EAXBUFFER_ROOM,
|
||||
DSPROPERTY_EAXBUFFER_ROOMHF,
|
||||
DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR,
|
||||
DSPROPERTY_EAXBUFFER_OBSTRUCTION,
|
||||
DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSION,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO,
|
||||
DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF,
|
||||
DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR,
|
||||
DSPROPERTY_EAXBUFFER_FLAGS
|
||||
} DSPROPERTY_EAX_BUFFERPROPERTY;
|
||||
|
||||
// OR these flags with property id
|
||||
#define DSPROPERTY_EAXBUFFER_IMMEDIATE 0x00000000 // changes take effect immediately
|
||||
#define DSPROPERTY_EAXBUFFER_DEFERRED 0x80000000 // changes take effect later
|
||||
#define DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXBUFFER_NONE | \
|
||||
DSPROPERTY_EAXBUFFER_IMMEDIATE)
|
||||
|
||||
// Use this structure for DSPROPERTY_EAXBUFFER_ALLPARAMETERS
|
||||
// - all levels are hundredths of decibels
|
||||
//
|
||||
// NOTE: This structure may change in future EAX versions.
|
||||
// It is recommended to initialize fields by name:
|
||||
// myBuffer.lDirect = 0;
|
||||
// myBuffer.lDirectHF = -200;
|
||||
// ...
|
||||
// myBuffer.dwFlags = myFlags /* see EAXBUFFERFLAGS below */ ;
|
||||
// instead of:
|
||||
// myBuffer = { 0, -200, ... , 0x00000003 };
|
||||
//
|
||||
typedef struct _EAXBUFFERPROPERTIES
|
||||
{
|
||||
long lDirect; // direct path level
|
||||
long lDirectHF; // direct path level at high frequencies
|
||||
long lRoom; // room effect level
|
||||
long lRoomHF; // room effect level at high frequencies
|
||||
float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
|
||||
long lObstruction; // main obstruction control (attenuation at high frequencies)
|
||||
float flObstructionLFRatio; // obstruction low-frequency level re. main control
|
||||
long lOcclusion; // main occlusion control (attenuation at high frequencies)
|
||||
float flOcclusionLFRatio; // occlusion low-frequency level re. main control
|
||||
float flOcclusionRoomRatio; // occlusion room effect level re. main control
|
||||
long lOutsideVolumeHF; // outside sound cone level at high frequencies
|
||||
float flAirAbsorptionFactor; // multiplies DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF
|
||||
unsigned long dwFlags; // modifies the behavior of properties
|
||||
} EAXBUFFERPROPERTIES, *LPEAXBUFFERPROPERTIES;
|
||||
|
||||
// Used by DSPROPERTY_EAXBUFFER_FLAGS
|
||||
// TRUE: value is computed automatically - property is an offset
|
||||
// FALSE: value is used directly
|
||||
//
|
||||
// Note: The number and order of flags may change in future EAX versions.
|
||||
// To insure future compatibility, use flag defines as follows:
|
||||
// myFlags = EAXBUFFERFLAGS_DIRECTHFAUTO | EAXBUFFERFLAGS_ROOMAUTO;
|
||||
// instead of:
|
||||
// myFlags = 0x00000003;
|
||||
//
|
||||
#define EAXBUFFERFLAGS_DIRECTHFAUTO 0x00000001 // affects DSPROPERTY_EAXBUFFER_DIRECTHF
|
||||
#define EAXBUFFERFLAGS_ROOMAUTO 0x00000002 // affects DSPROPERTY_EAXBUFFER_ROOM
|
||||
#define EAXBUFFERFLAGS_ROOMHFAUTO 0x00000004 // affects DSPROPERTY_EAXBUFFER_ROOMHF
|
||||
|
||||
#define EAXBUFFERFLAGS_RESERVED 0xFFFFFFF8 // reserved future use
|
||||
|
||||
// property ranges and defaults:
|
||||
|
||||
#define EAXBUFFER_MINDIRECT (-10000)
|
||||
#define EAXBUFFER_MAXDIRECT 1000
|
||||
#define EAXBUFFER_DEFAULTDIRECT 0
|
||||
|
||||
#define EAXBUFFER_MINDIRECTHF (-10000)
|
||||
#define EAXBUFFER_MAXDIRECTHF 0
|
||||
#define EAXBUFFER_DEFAULTDIRECTHF 0
|
||||
|
||||
#define EAXBUFFER_MINROOM (-10000)
|
||||
#define EAXBUFFER_MAXROOM 1000
|
||||
#define EAXBUFFER_DEFAULTROOM 0
|
||||
|
||||
#define EAXBUFFER_MINROOMHF (-10000)
|
||||
#define EAXBUFFER_MAXROOMHF 0
|
||||
#define EAXBUFFER_DEFAULTROOMHF 0
|
||||
|
||||
#define EAXBUFFER_MINROOMROLLOFFFACTOR 0.0f
|
||||
#define EAXBUFFER_MAXROOMROLLOFFFACTOR 10.f
|
||||
#define EAXBUFFER_DEFAULTROOMROLLOFFFACTOR 0.0f
|
||||
|
||||
#define EAXBUFFER_MINOBSTRUCTION (-10000)
|
||||
#define EAXBUFFER_MAXOBSTRUCTION 0
|
||||
#define EAXBUFFER_DEFAULTOBSTRUCTION 0
|
||||
|
||||
#define EAXBUFFER_MINOBSTRUCTIONLFRATIO 0.0f
|
||||
#define EAXBUFFER_MAXOBSTRUCTIONLFRATIO 1.0f
|
||||
#define EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO 0.0f
|
||||
|
||||
#define EAXBUFFER_MINOCCLUSION (-10000)
|
||||
#define EAXBUFFER_MAXOCCLUSION 0
|
||||
#define EAXBUFFER_DEFAULTOCCLUSION 0
|
||||
|
||||
#define EAXBUFFER_MINOCCLUSIONLFRATIO 0.0f
|
||||
#define EAXBUFFER_MAXOCCLUSIONLFRATIO 1.0f
|
||||
#define EAXBUFFER_DEFAULTOCCLUSIONLFRATIO 0.25f
|
||||
|
||||
#define EAXBUFFER_MINOCCLUSIONROOMRATIO 0.0f
|
||||
#define EAXBUFFER_MAXOCCLUSIONROOMRATIO 10.0f
|
||||
#define EAXBUFFER_DEFAULTOCCLUSIONROOMRATIO 0.5f
|
||||
|
||||
#define EAXBUFFER_MINOUTSIDEVOLUMEHF (-10000)
|
||||
#define EAXBUFFER_MAXOUTSIDEVOLUMEHF 0
|
||||
#define EAXBUFFER_DEFAULTOUTSIDEVOLUMEHF 0
|
||||
|
||||
#define EAXBUFFER_MINAIRABSORPTIONFACTOR 0.0f
|
||||
#define EAXBUFFER_MAXAIRABSORPTIONFACTOR 10.0f
|
||||
#define EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR 1.0f
|
||||
|
||||
#define EAXBUFFER_DEFAULTFLAGS (EAXBUFFERFLAGS_DIRECTHFAUTO | \
|
||||
EAXBUFFERFLAGS_ROOMAUTO | \
|
||||
EAXBUFFERFLAGS_ROOMHFAUTO)
|
||||
|
||||
// Material transmission presets
|
||||
// 3 values in this order:
|
||||
// 1: occlusion (or obstruction)
|
||||
// 2: occlusion LF Ratio (or obstruction LF Ratio)
|
||||
// 3: occlusion Room Ratio
|
||||
|
||||
// Single window material preset
|
||||
#define EAX_MATERIAL_SINGLEWINDOW (-2800)
|
||||
#define EAX_MATERIAL_SINGLEWINDOWLF 0.71f
|
||||
#define EAX_MATERIAL_SINGLEWINDOWROOMRATIO 0.43f
|
||||
|
||||
// Double window material preset
|
||||
#define EAX_MATERIAL_DOUBLEWINDOW (-5000)
|
||||
#define EAX_MATERIAL_DOUBLEWINDOWHF 0.40f
|
||||
#define EAX_MATERIAL_DOUBLEWINDOWROOMRATIO 0.24f
|
||||
|
||||
// Thin door material preset
|
||||
#define EAX_MATERIAL_THINDOOR (-1800)
|
||||
#define EAX_MATERIAL_THINDOORLF 0.66f
|
||||
#define EAX_MATERIAL_THINDOORROOMRATIO 0.66f
|
||||
|
||||
// Thick door material preset
|
||||
#define EAX_MATERIAL_THICKDOOR (-4400)
|
||||
#define EAX_MATERIAL_THICKDOORLF 0.64f
|
||||
#define EAX_MATERIAL_THICKDOORROOMRTATION 0.27f
|
||||
|
||||
// Wood wall material preset
|
||||
#define EAX_MATERIAL_WOODWALL (-4000)
|
||||
#define EAX_MATERIAL_WOODWALLLF 0.50f
|
||||
#define EAX_MATERIAL_WOODWALLROOMRATIO 0.30f
|
||||
|
||||
// Brick wall material preset
|
||||
#define EAX_MATERIAL_BRICKWALL (-5000)
|
||||
#define EAX_MATERIAL_BRICKWALLLF 0.60f
|
||||
#define EAX_MATERIAL_BRICKWALLROOMRATIO 0.24f
|
||||
|
||||
// Stone wall material preset
|
||||
#define EAX_MATERIAL_STONEWALL (-6000)
|
||||
#define EAX_MATERIAL_STONEWALLLF 0.68f
|
||||
#define EAX_MATERIAL_STONEWALLROOMRATIO 0.20f
|
||||
|
||||
// Curtain material preset
|
||||
#define EAX_MATERIAL_CURTAIN (-1200)
|
||||
#define EAX_MATERIAL_CURTAINLF 0.15f
|
||||
#define EAX_MATERIAL_CURTAINROOMRATIO 1.00f
|
||||
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
457
Engine/SoundLib/eax2.0_sdk/Include/eax.h
Normal file
457
Engine/SoundLib/eax2.0_sdk/Include/eax.h
Normal file
@@ -0,0 +1,457 @@
|
||||
/******************************************************************
|
||||
*
|
||||
* EAX.H - DirectSound3D Environmental Audio Extensions version 2.0
|
||||
* Updated July 8, 1999
|
||||
*
|
||||
*******************************************************************
|
||||
*/
|
||||
|
||||
#ifndef EAX_H_INCLUDED
|
||||
#define EAX_H_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef OPENAL
|
||||
#include <dsound.h>
|
||||
/*
|
||||
* EAX Wrapper Interface (using Direct X 7) {4FF53B81-1CE0-11d3-AAB8-00A0C95949D5}
|
||||
*/
|
||||
DEFINE_GUID(CLSID_EAXDirectSound,
|
||||
0x4ff53b81,
|
||||
0x1ce0,
|
||||
0x11d3,
|
||||
0xaa, 0xb8, 0x0, 0xa0, 0xc9, 0x59, 0x49, 0xd5);
|
||||
|
||||
/*
|
||||
* EAX Wrapper Interface (using Direct X 8) {CA503B60-B176-11d4-A094-D0C0BF3A560C}
|
||||
*/
|
||||
DEFINE_GUID(CLSID_EAXDirectSound8,
|
||||
0xca503b60,
|
||||
0xb176,
|
||||
0x11d4,
|
||||
0xa0, 0x94, 0xd0, 0xc0, 0xbf, 0x3a, 0x56, 0xc);
|
||||
|
||||
#ifdef DIRECTSOUND_VERSION
|
||||
#if DIRECTSOUND_VERSION == 0x0800
|
||||
__declspec(dllimport) HRESULT WINAPI EAXDirectSoundCreate8(GUID*, LPDIRECTSOUND8*, IUnknown FAR *);
|
||||
typedef HRESULT (FAR PASCAL *LPEAXDIRECTSOUNDCREATE8)(GUID*, LPDIRECTSOUND8*, IUnknown FAR*);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
__declspec(dllimport) HRESULT WINAPI EAXDirectSoundCreate(GUID*, LPDIRECTSOUND*, IUnknown FAR *);
|
||||
typedef HRESULT (FAR PASCAL *LPEAXDIRECTSOUNDCREATE)(GUID*, LPDIRECTSOUND*, IUnknown FAR*);
|
||||
|
||||
#else
|
||||
#include <al.h>
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
#define GUID_DEFINED
|
||||
typedef struct _GUID
|
||||
{
|
||||
unsigned long Data1;
|
||||
unsigned short Data2;
|
||||
unsigned short Data3;
|
||||
unsigned char Data4[8];
|
||||
} GUID;
|
||||
#endif // !GUID_DEFINED
|
||||
|
||||
#ifndef DEFINE_GUID
|
||||
#ifndef INITGUID
|
||||
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
extern const GUID FAR name
|
||||
#else
|
||||
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
||||
#endif // INITGUID
|
||||
#endif // DEFINE_GUID
|
||||
|
||||
/*
|
||||
* EAX OpenAL Extension {4FF53B81-1CE0-11d3-AAB8-00A0C95949D5}
|
||||
*/
|
||||
typedef ALenum (*EAXSet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint);
|
||||
typedef ALenum (*EAXGet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint);
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
||||
/*
|
||||
* EAX 2.0 listener property set {0306A6A8-B224-11d2-99E5-0000E8D8C722}
|
||||
*/
|
||||
DEFINE_GUID(DSPROPSETID_EAX20_ListenerProperties,
|
||||
0x306a6a8,
|
||||
0xb224,
|
||||
0x11d2,
|
||||
0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22);
|
||||
|
||||
// For compatibility with future EAX versions:
|
||||
#define DSPROPSETID_EAX_ListenerProperties DSPROPSETID_EAX20_ListenerProperties
|
||||
#define DSPROPSETID_EAX_SourceProperties DSPROPSETID_EAX20_BufferProperties
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DSPROPERTY_EAXLISTENER_NONE,
|
||||
DSPROPERTY_EAXLISTENER_ALLPARAMETERS,
|
||||
DSPROPERTY_EAXLISTENER_ROOM,
|
||||
DSPROPERTY_EAXLISTENER_ROOMHF,
|
||||
DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR,
|
||||
DSPROPERTY_EAXLISTENER_DECAYTIME,
|
||||
DSPROPERTY_EAXLISTENER_DECAYHFRATIO,
|
||||
DSPROPERTY_EAXLISTENER_REFLECTIONS,
|
||||
DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY,
|
||||
DSPROPERTY_EAXLISTENER_REVERB,
|
||||
DSPROPERTY_EAXLISTENER_REVERBDELAY,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENT,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION,
|
||||
DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF,
|
||||
DSPROPERTY_EAXLISTENER_FLAGS
|
||||
} DSPROPERTY_EAX_LISTENERPROPERTY;
|
||||
|
||||
// OR these flags with property id
|
||||
#define DSPROPERTY_EAXLISTENER_IMMEDIATE 0x00000000 // changes take effect immediately
|
||||
#define DSPROPERTY_EAXLISTENER_DEFERRED 0x80000000 // changes take effect later
|
||||
#define DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXLISTENER_NONE | \
|
||||
DSPROPERTY_EAXLISTENER_IMMEDIATE)
|
||||
|
||||
// Use this structure for DSPROPERTY_EAXLISTENER_ALLPARAMETERS
|
||||
// - all levels are hundredths of decibels
|
||||
// - all times are in seconds
|
||||
// - the reference for high frequency controls is 5 kHz
|
||||
//
|
||||
// NOTE: This structure may change in future EAX versions.
|
||||
// It is recommended to initialize fields by name:
|
||||
// myListener.lRoom = -1000;
|
||||
// myListener.lRoomHF = -100;
|
||||
// ...
|
||||
// myListener.dwFlags = myFlags /* see EAXLISTENERFLAGS below */ ;
|
||||
// instead of:
|
||||
// myListener = { -1000, -100, ... , 0x00000009 };
|
||||
// If you want to save and load presets in binary form, you
|
||||
// should define your own structure to insure future compatibility.
|
||||
//
|
||||
typedef struct _EAXLISTENERPROPERTIES
|
||||
{
|
||||
long lRoom; // room effect level at low frequencies
|
||||
long lRoomHF; // room effect high-frequency level re. low frequency level
|
||||
float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
|
||||
float flDecayTime; // reverberation decay time at low frequencies
|
||||
float flDecayHFRatio; // high-frequency to low-frequency decay time ratio
|
||||
long lReflections; // early reflections level relative to room effect
|
||||
float flReflectionsDelay; // initial reflection delay time
|
||||
long lReverb; // late reverberation level relative to room effect
|
||||
float flReverbDelay; // late reverberation delay time relative to initial reflection
|
||||
unsigned long dwEnvironment; // sets all listener properties
|
||||
float flEnvironmentSize; // environment size in meters
|
||||
float flEnvironmentDiffusion; // environment diffusion
|
||||
float flAirAbsorptionHF; // change in level per meter at 5 kHz
|
||||
unsigned long dwFlags; // modifies the behavior of properties
|
||||
} EAXLISTENERPROPERTIES, *LPEAXLISTENERPROPERTIES;
|
||||
|
||||
// used by DSPROPERTY_EAXLISTENER_ENVIRONMENT
|
||||
enum
|
||||
{
|
||||
EAX_ENVIRONMENT_GENERIC,
|
||||
EAX_ENVIRONMENT_PADDEDCELL,
|
||||
EAX_ENVIRONMENT_ROOM,
|
||||
EAX_ENVIRONMENT_BATHROOM,
|
||||
EAX_ENVIRONMENT_LIVINGROOM,
|
||||
EAX_ENVIRONMENT_STONEROOM,
|
||||
EAX_ENVIRONMENT_AUDITORIUM,
|
||||
EAX_ENVIRONMENT_CONCERTHALL,
|
||||
EAX_ENVIRONMENT_CAVE,
|
||||
EAX_ENVIRONMENT_ARENA,
|
||||
EAX_ENVIRONMENT_HANGAR,
|
||||
EAX_ENVIRONMENT_CARPETEDHALLWAY,
|
||||
EAX_ENVIRONMENT_HALLWAY,
|
||||
EAX_ENVIRONMENT_STONECORRIDOR,
|
||||
EAX_ENVIRONMENT_ALLEY,
|
||||
EAX_ENVIRONMENT_FOREST,
|
||||
EAX_ENVIRONMENT_CITY,
|
||||
EAX_ENVIRONMENT_MOUNTAINS,
|
||||
EAX_ENVIRONMENT_QUARRY,
|
||||
EAX_ENVIRONMENT_PLAIN,
|
||||
EAX_ENVIRONMENT_PARKINGLOT,
|
||||
EAX_ENVIRONMENT_SEWERPIPE,
|
||||
EAX_ENVIRONMENT_UNDERWATER,
|
||||
EAX_ENVIRONMENT_DRUGGED,
|
||||
EAX_ENVIRONMENT_DIZZY,
|
||||
EAX_ENVIRONMENT_PSYCHOTIC,
|
||||
|
||||
EAX_ENVIRONMENT_COUNT
|
||||
};
|
||||
|
||||
// Used by DSPROPERTY_EAXLISTENER_FLAGS
|
||||
//
|
||||
// Note: The number and order of flags may change in future EAX versions.
|
||||
// It is recommended to use the flag defines as follows:
|
||||
// myFlags = EAXLISTENERFLAGS_DECAYTIMESCALE | EAXLISTENERFLAGS_REVERBSCALE;
|
||||
// instead of:
|
||||
// myFlags = 0x00000009;
|
||||
//
|
||||
// These flags determine what properties are affected by environment size.
|
||||
#define EAXLISTENERFLAGS_DECAYTIMESCALE 0x00000001 // reverberation decay time
|
||||
#define EAXLISTENERFLAGS_REFLECTIONSSCALE 0x00000002 // reflection level
|
||||
#define EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE 0x00000004 // initial reflection delay time
|
||||
#define EAXLISTENERFLAGS_REVERBSCALE 0x00000008 // reflections level
|
||||
#define EAXLISTENERFLAGS_REVERBDELAYSCALE 0x00000010 // late reverberation delay time
|
||||
|
||||
// This flag limits high-frequency decay time according to air absorption.
|
||||
#define EAXLISTENERFLAGS_DECAYHFLIMIT 0x00000020
|
||||
|
||||
#define EAXLISTENERFLAGS_RESERVED 0xFFFFFFC0 // reserved future use
|
||||
|
||||
// property ranges and defaults:
|
||||
|
||||
#define EAXLISTENER_MINROOM (-10000)
|
||||
#define EAXLISTENER_MAXROOM 0
|
||||
#define EAXLISTENER_DEFAULTROOM (-1000)
|
||||
|
||||
#define EAXLISTENER_MINROOMHF (-10000)
|
||||
#define EAXLISTENER_MAXROOMHF 0
|
||||
#define EAXLISTENER_DEFAULTROOMHF (-100)
|
||||
|
||||
#define EAXLISTENER_MINROOMROLLOFFFACTOR 0.0f
|
||||
#define EAXLISTENER_MAXROOMROLLOFFFACTOR 10.0f
|
||||
#define EAXLISTENER_DEFAULTROOMROLLOFFFACTOR 0.0f
|
||||
|
||||
#define EAXLISTENER_MINDECAYTIME 0.1f
|
||||
#define EAXLISTENER_MAXDECAYTIME 20.0f
|
||||
#define EAXLISTENER_DEFAULTDECAYTIME 1.49f
|
||||
|
||||
#define EAXLISTENER_MINDECAYHFRATIO 0.1f
|
||||
#define EAXLISTENER_MAXDECAYHFRATIO 2.0f
|
||||
#define EAXLISTENER_DEFAULTDECAYHFRATIO 0.83f
|
||||
|
||||
#define EAXLISTENER_MINREFLECTIONS (-10000)
|
||||
#define EAXLISTENER_MAXREFLECTIONS 1000
|
||||
#define EAXLISTENER_DEFAULTREFLECTIONS (-2602)
|
||||
|
||||
#define EAXLISTENER_MINREFLECTIONSDELAY 0.0f
|
||||
#define EAXLISTENER_MAXREFLECTIONSDELAY 0.3f
|
||||
#define EAXLISTENER_DEFAULTREFLECTIONSDELAY 0.007f
|
||||
|
||||
#define EAXLISTENER_MINREVERB (-10000)
|
||||
#define EAXLISTENER_MAXREVERB 2000
|
||||
#define EAXLISTENER_DEFAULTREVERB 200
|
||||
|
||||
#define EAXLISTENER_MINREVERBDELAY 0.0f
|
||||
#define EAXLISTENER_MAXREVERBDELAY 0.1f
|
||||
#define EAXLISTENER_DEFAULTREVERBDELAY 0.011f
|
||||
|
||||
#define EAXLISTENER_MINENVIRONMENT 0
|
||||
#define EAXLISTENER_MAXENVIRONMENT (EAX_ENVIRONMENT_COUNT-1)
|
||||
#define EAXLISTENER_DEFAULTENVIRONMENT EAX_ENVIRONMENT_GENERIC
|
||||
|
||||
#define EAXLISTENER_MINENVIRONMENTSIZE 1.0f
|
||||
#define EAXLISTENER_MAXENVIRONMENTSIZE 100.0f
|
||||
#define EAXLISTENER_DEFAULTENVIRONMENTSIZE 7.5f
|
||||
|
||||
#define EAXLISTENER_MINENVIRONMENTDIFFUSION 0.0f
|
||||
#define EAXLISTENER_MAXENVIRONMENTDIFFUSION 1.0f
|
||||
#define EAXLISTENER_DEFAULTENVIRONMENTDIFFUSION 1.0f
|
||||
|
||||
#define EAXLISTENER_MINAIRABSORPTIONHF (-100.0f)
|
||||
#define EAXLISTENER_MAXAIRABSORPTIONHF 0.0f
|
||||
#define EAXLISTENER_DEFAULTAIRABSORPTIONHF (-5.0f)
|
||||
|
||||
#define EAXLISTENER_DEFAULTFLAGS (EAXLISTENERFLAGS_DECAYTIMESCALE | \
|
||||
EAXLISTENERFLAGS_REFLECTIONSSCALE | \
|
||||
EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE | \
|
||||
EAXLISTENERFLAGS_REVERBSCALE | \
|
||||
EAXLISTENERFLAGS_REVERBDELAYSCALE | \
|
||||
EAXLISTENERFLAGS_DECAYHFLIMIT)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* EAX 2.0 buffer property set {0306A6A7-B224-11d2-99E5-0000E8D8C722}
|
||||
*/
|
||||
DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties,
|
||||
0x306a6a7,
|
||||
0xb224,
|
||||
0x11d2,
|
||||
0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22);
|
||||
|
||||
// For compatibility with future EAX versions:
|
||||
#define DSPROPSETID_EAX_BufferProperties DSPROPSETID_EAX20_BufferProperties
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DSPROPERTY_EAXBUFFER_NONE,
|
||||
DSPROPERTY_EAXBUFFER_ALLPARAMETERS,
|
||||
DSPROPERTY_EAXBUFFER_DIRECT,
|
||||
DSPROPERTY_EAXBUFFER_DIRECTHF,
|
||||
DSPROPERTY_EAXBUFFER_ROOM,
|
||||
DSPROPERTY_EAXBUFFER_ROOMHF,
|
||||
DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR,
|
||||
DSPROPERTY_EAXBUFFER_OBSTRUCTION,
|
||||
DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSION,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO,
|
||||
DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF,
|
||||
DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR,
|
||||
DSPROPERTY_EAXBUFFER_FLAGS
|
||||
} DSPROPERTY_EAX_BUFFERPROPERTY;
|
||||
|
||||
// OR these flags with property id
|
||||
#define DSPROPERTY_EAXBUFFER_IMMEDIATE 0x00000000 // changes take effect immediately
|
||||
#define DSPROPERTY_EAXBUFFER_DEFERRED 0x80000000 // changes take effect later
|
||||
#define DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXBUFFER_NONE | \
|
||||
DSPROPERTY_EAXBUFFER_IMMEDIATE)
|
||||
|
||||
// Use this structure for DSPROPERTY_EAXBUFFER_ALLPARAMETERS
|
||||
// - all levels are hundredths of decibels
|
||||
//
|
||||
// NOTE: This structure may change in future EAX versions.
|
||||
// It is recommended to initialize fields by name:
|
||||
// myBuffer.lDirect = 0;
|
||||
// myBuffer.lDirectHF = -200;
|
||||
// ...
|
||||
// myBuffer.dwFlags = myFlags /* see EAXBUFFERFLAGS below */ ;
|
||||
// instead of:
|
||||
// myBuffer = { 0, -200, ... , 0x00000003 };
|
||||
//
|
||||
typedef struct _EAXBUFFERPROPERTIES
|
||||
{
|
||||
long lDirect; // direct path level
|
||||
long lDirectHF; // direct path level at high frequencies
|
||||
long lRoom; // room effect level
|
||||
long lRoomHF; // room effect level at high frequencies
|
||||
float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
|
||||
long lObstruction; // main obstruction control (attenuation at high frequencies)
|
||||
float flObstructionLFRatio; // obstruction low-frequency level re. main control
|
||||
long lOcclusion; // main occlusion control (attenuation at high frequencies)
|
||||
float flOcclusionLFRatio; // occlusion low-frequency level re. main control
|
||||
float flOcclusionRoomRatio; // occlusion room effect level re. main control
|
||||
long lOutsideVolumeHF; // outside sound cone level at high frequencies
|
||||
float flAirAbsorptionFactor; // multiplies DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF
|
||||
unsigned long dwFlags; // modifies the behavior of properties
|
||||
} EAXBUFFERPROPERTIES, *LPEAXBUFFERPROPERTIES;
|
||||
|
||||
// Used by DSPROPERTY_EAXBUFFER_FLAGS
|
||||
// TRUE: value is computed automatically - property is an offset
|
||||
// FALSE: value is used directly
|
||||
//
|
||||
// Note: The number and order of flags may change in future EAX versions.
|
||||
// To insure future compatibility, use flag defines as follows:
|
||||
// myFlags = EAXBUFFERFLAGS_DIRECTHFAUTO | EAXBUFFERFLAGS_ROOMAUTO;
|
||||
// instead of:
|
||||
// myFlags = 0x00000003;
|
||||
//
|
||||
#define EAXBUFFERFLAGS_DIRECTHFAUTO 0x00000001 // affects DSPROPERTY_EAXBUFFER_DIRECTHF
|
||||
#define EAXBUFFERFLAGS_ROOMAUTO 0x00000002 // affects DSPROPERTY_EAXBUFFER_ROOM
|
||||
#define EAXBUFFERFLAGS_ROOMHFAUTO 0x00000004 // affects DSPROPERTY_EAXBUFFER_ROOMHF
|
||||
|
||||
#define EAXBUFFERFLAGS_RESERVED 0xFFFFFFF8 // reserved future use
|
||||
|
||||
// property ranges and defaults:
|
||||
|
||||
#define EAXBUFFER_MINDIRECT (-10000)
|
||||
#define EAXBUFFER_MAXDIRECT 1000
|
||||
#define EAXBUFFER_DEFAULTDIRECT 0
|
||||
|
||||
#define EAXBUFFER_MINDIRECTHF (-10000)
|
||||
#define EAXBUFFER_MAXDIRECTHF 0
|
||||
#define EAXBUFFER_DEFAULTDIRECTHF 0
|
||||
|
||||
#define EAXBUFFER_MINROOM (-10000)
|
||||
#define EAXBUFFER_MAXROOM 1000
|
||||
#define EAXBUFFER_DEFAULTROOM 0
|
||||
|
||||
#define EAXBUFFER_MINROOMHF (-10000)
|
||||
#define EAXBUFFER_MAXROOMHF 0
|
||||
#define EAXBUFFER_DEFAULTROOMHF 0
|
||||
|
||||
#define EAXBUFFER_MINROOMROLLOFFFACTOR 0.0f
|
||||
#define EAXBUFFER_MAXROOMROLLOFFFACTOR 10.f
|
||||
#define EAXBUFFER_DEFAULTROOMROLLOFFFACTOR 0.0f
|
||||
|
||||
#define EAXBUFFER_MINOBSTRUCTION (-10000)
|
||||
#define EAXBUFFER_MAXOBSTRUCTION 0
|
||||
#define EAXBUFFER_DEFAULTOBSTRUCTION 0
|
||||
|
||||
#define EAXBUFFER_MINOBSTRUCTIONLFRATIO 0.0f
|
||||
#define EAXBUFFER_MAXOBSTRUCTIONLFRATIO 1.0f
|
||||
#define EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO 0.0f
|
||||
|
||||
#define EAXBUFFER_MINOCCLUSION (-10000)
|
||||
#define EAXBUFFER_MAXOCCLUSION 0
|
||||
#define EAXBUFFER_DEFAULTOCCLUSION 0
|
||||
|
||||
#define EAXBUFFER_MINOCCLUSIONLFRATIO 0.0f
|
||||
#define EAXBUFFER_MAXOCCLUSIONLFRATIO 1.0f
|
||||
#define EAXBUFFER_DEFAULTOCCLUSIONLFRATIO 0.25f
|
||||
|
||||
#define EAXBUFFER_MINOCCLUSIONROOMRATIO 0.0f
|
||||
#define EAXBUFFER_MAXOCCLUSIONROOMRATIO 10.0f
|
||||
#define EAXBUFFER_DEFAULTOCCLUSIONROOMRATIO 0.5f
|
||||
|
||||
#define EAXBUFFER_MINOUTSIDEVOLUMEHF (-10000)
|
||||
#define EAXBUFFER_MAXOUTSIDEVOLUMEHF 0
|
||||
#define EAXBUFFER_DEFAULTOUTSIDEVOLUMEHF 0
|
||||
|
||||
#define EAXBUFFER_MINAIRABSORPTIONFACTOR 0.0f
|
||||
#define EAXBUFFER_MAXAIRABSORPTIONFACTOR 10.0f
|
||||
#define EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR 1.0f
|
||||
|
||||
#define EAXBUFFER_DEFAULTFLAGS (EAXBUFFERFLAGS_DIRECTHFAUTO | \
|
||||
EAXBUFFERFLAGS_ROOMAUTO | \
|
||||
EAXBUFFERFLAGS_ROOMHFAUTO)
|
||||
|
||||
// Material transmission presets
|
||||
// 3 values in this order:
|
||||
// 1: occlusion (or obstruction)
|
||||
// 2: occlusion LF Ratio (or obstruction LF Ratio)
|
||||
// 3: occlusion Room Ratio
|
||||
|
||||
// Single window material preset
|
||||
#define EAX_MATERIAL_SINGLEWINDOW (-2800)
|
||||
#define EAX_MATERIAL_SINGLEWINDOWLF 0.71f
|
||||
#define EAX_MATERIAL_SINGLEWINDOWROOMRATIO 0.43f
|
||||
|
||||
// Double window material preset
|
||||
#define EAX_MATERIAL_DOUBLEWINDOW (-5000)
|
||||
#define EAX_MATERIAL_DOUBLEWINDOWHF 0.40f
|
||||
#define EAX_MATERIAL_DOUBLEWINDOWROOMRATIO 0.24f
|
||||
|
||||
// Thin door material preset
|
||||
#define EAX_MATERIAL_THINDOOR (-1800)
|
||||
#define EAX_MATERIAL_THINDOORLF 0.66f
|
||||
#define EAX_MATERIAL_THINDOORROOMRATIO 0.66f
|
||||
|
||||
// Thick door material preset
|
||||
#define EAX_MATERIAL_THICKDOOR (-4400)
|
||||
#define EAX_MATERIAL_THICKDOORLF 0.64f
|
||||
#define EAX_MATERIAL_THICKDOORROOMRTATION 0.27f
|
||||
|
||||
// Wood wall material preset
|
||||
#define EAX_MATERIAL_WOODWALL (-4000)
|
||||
#define EAX_MATERIAL_WOODWALLLF 0.50f
|
||||
#define EAX_MATERIAL_WOODWALLROOMRATIO 0.30f
|
||||
|
||||
// Brick wall material preset
|
||||
#define EAX_MATERIAL_BRICKWALL (-5000)
|
||||
#define EAX_MATERIAL_BRICKWALLLF 0.60f
|
||||
#define EAX_MATERIAL_BRICKWALLROOMRATIO 0.24f
|
||||
|
||||
// Stone wall material preset
|
||||
#define EAX_MATERIAL_STONEWALL (-6000)
|
||||
#define EAX_MATERIAL_STONEWALLLF 0.68f
|
||||
#define EAX_MATERIAL_STONEWALLROOMRATIO 0.20f
|
||||
|
||||
// Curtain material preset
|
||||
#define EAX_MATERIAL_CURTAIN (-1200)
|
||||
#define EAX_MATERIAL_CURTAINLF 0.15f
|
||||
#define EAX_MATERIAL_CURTAINROOMRATIO 1.00f
|
||||
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
231
Engine/SoundLib/eax2.0_sdk/Include/eaxac3.h
Normal file
231
Engine/SoundLib/eax2.0_sdk/Include/eaxac3.h
Normal file
@@ -0,0 +1,231 @@
|
||||
/************************************************************************************************
|
||||
/
|
||||
/ EAX-AC3 Open AL Extension Header file
|
||||
/
|
||||
/ Description : The EAX-AC3 extension to Open AL provides a way to playback Dolby Digital AC3
|
||||
/ files on systems equipped with a SB Live! card. The packaged AC3 data is output
|
||||
/ via the MMSYSTEM Wave device.
|
||||
/ If a SB Live! 5.1 card is installed then the AC3 data will be decoded by the
|
||||
/ audio card.
|
||||
/ If a legacy SB Live! card is installed then the AC3 data will be sent directly
|
||||
/ to the S/PDIF Out.
|
||||
/ The API supports multiple EAX-AC3 devices, and multiple AC3 streams. However
|
||||
/ the current implementation provides one EAX-AC3 device capable of playing
|
||||
/ one AC3 Stream at a time.
|
||||
/
|
||||
/ Programmer : Daniel Peacock Creative Labs, Inc February 2001
|
||||
/
|
||||
/************************************************************************************************/
|
||||
|
||||
#ifndef _EAXAC3_H_
|
||||
#define _EAXAC3_H_
|
||||
|
||||
// Do not define the symbol EAXAC3_EXPORTS in any projects that use the EAX-AC3 Open AL Extension
|
||||
#ifdef EAXAC3_EXPORTS
|
||||
#define EAXAC3_API __declspec(dllexport)
|
||||
#else
|
||||
#define EAXAC3_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _HRESULT_DEFINED
|
||||
#define _HRESULT_DEFINED
|
||||
typedef signed long HRESULT;
|
||||
#endif
|
||||
|
||||
enum POSFORMAT { MILLISECONDS, BYTES, AC3FRAMES };
|
||||
|
||||
enum SOURCE { AC3FILE, MEMORY };
|
||||
|
||||
// Success Codes
|
||||
#define EAXAC3_OK 0
|
||||
#define EAXAC3_ALREADYPLAYING 1
|
||||
#define EAXAC3_EOF 2
|
||||
|
||||
// Error Codes
|
||||
#define EAXAC3ERR_UNABLETOOPENEAXAC3DEVICE -1
|
||||
#define EAXAC3ERR_WAVEOUTPREPAREHEADERFAILURE -2
|
||||
#define EAXAC3ERR_OUTOFMEMORY -3
|
||||
#define EAXAC3ERR_FILENOTFOUND -4
|
||||
#define EAXAC3ERR_AC3FILETOBIG -5
|
||||
#define EAXAC3ERR_AC3FRAMENOTFOUND -6
|
||||
#define EAXAC3ERR_AC3NOTAT48KHZ -7
|
||||
#define EAXAC3ERR_INVALIDAC3FRAME -8
|
||||
#define EAXAC3ERR_AC3FILENOTOPEN -9
|
||||
#define EAXAC3ERR_BUFFERNOTMULTIPLEOFAC3FRAMESIZE -10
|
||||
#define EAXAC3ERR_WAVEOUTERROR -11
|
||||
#define EAXAC3ERR_FAILEDTOCREATEEVENT -12
|
||||
#define EAXAC3ERR_EAXAC3DEVICENOTOPEN -13
|
||||
#define EAXAC3ERR_AC3STREAMALREADYOPEN -14
|
||||
#define EAXAC3ERR_POSITIONOUTOFRANGE -15
|
||||
#define EAXAC3ERR_NOTATSTARTOFAC3FRAME -16
|
||||
#define EAXAC3ERR_AC3STREAMNOTOPEN -17
|
||||
#define EAXAC3ERR_SETPOSITIONONLYWORKSONAC3FILES -18
|
||||
#define EAXAC3ERR_WRITEDATAONLYWORKSWITHMEMORYSTREAMS -19
|
||||
#define EAXAC3ERR_INVALIDPARAMETER -20
|
||||
#define EAXAC3ERR_NOTENOUGHAC3DATAINAC3DATABUFFER -21
|
||||
#define EAXAC3ERR_NOTENOUGHDATA -22
|
||||
#define EAXAC3ERR_EAXAC3DEVICEALREADYOPEN -23
|
||||
#define EAXAC3ERR_EAXAC3DEVICENOTFOUND -24
|
||||
#define EAXAC3ERR_UNSUPPORTED -25
|
||||
#define EAXAC3ERR_FAILEDTOCREATEFNTABLE -26
|
||||
|
||||
#define DEFAULTEAXAC3DEVICE 0
|
||||
|
||||
#define ENTIREBUFFER 0
|
||||
#define FROMWRITECURSOR 1
|
||||
|
||||
#define LOOPING 1
|
||||
|
||||
#define ENDOFDATA 1
|
||||
|
||||
typedef unsigned int EAXAC3HANDLE;
|
||||
|
||||
typedef unsigned int AC3STREAM;
|
||||
|
||||
// Callback function
|
||||
typedef void (__stdcall *LPAC3CALLBACK)(AC3STREAM AC3Stream, int msg);
|
||||
|
||||
// Callback messages
|
||||
#define EAXAC3NEEDMOREDATA 0
|
||||
#define EAXAC3REACHEDEND 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int nNumOfAC3Frames;
|
||||
unsigned int nAC3FrameSize;
|
||||
unsigned int nSizeOfFile;
|
||||
unsigned int nDuration;
|
||||
unsigned int nFrequency;
|
||||
} AC3FILEINFO, *LPAC3FILEINFO;
|
||||
|
||||
#define UNKNOWN 1
|
||||
#define SPDIFPASSTHRU 2
|
||||
#define FULLDECODE 4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char szDeviceName[256];
|
||||
unsigned int uFlags;
|
||||
unsigned int uStreams;
|
||||
unsigned int uReserved;
|
||||
} EAXAC3DEVICEINFO, *LPEAXAC3DEVICEINFO;
|
||||
|
||||
// Function typedefs
|
||||
|
||||
typedef int (*LPEAXAC3QUERYNUMBEROFDEVICES) (void);
|
||||
typedef HRESULT (*LPEAXAC3QUERYFILE) (char *, LPAC3FILEINFO, int);
|
||||
typedef HRESULT (*LPEAXAC3QUERYMEMORY) (char *, int, LPAC3FILEINFO, int);
|
||||
typedef int (*LPEAXAC3QUERYNOOFFRAMESREQFORPLAYBACK) (AC3STREAM);
|
||||
typedef HRESULT (*LPEAXAC3OPENPLAYBACKDEVICE) (EAXAC3HANDLE);
|
||||
typedef HRESULT (*LPEAXAC3CLOSEPLAYBACKDEVICE) (EAXAC3HANDLE);
|
||||
typedef HRESULT (*LPEAXAC3QUERYDEVICECAPS) (EAXAC3HANDLE, LPEAXAC3DEVICEINFO, int);
|
||||
typedef HRESULT (*LPEAXAC3GETPOSITION) (AC3STREAM, enum POSFORMAT, int *);
|
||||
typedef HRESULT (*LPEAXAC3SETFILEPOSITION) (AC3STREAM, enum POSFORMAT, int);
|
||||
typedef HRESULT (*LPEAXAC3OPENSTREAM) (EAXAC3HANDLE, AC3STREAM *, LPAC3CALLBACK, char *, enum SOURCE);
|
||||
typedef HRESULT (*LPEAXAC3CLOSESTREAM) (AC3STREAM);
|
||||
typedef HRESULT (*LPEAXAC3PREPLAYSTREAM) (AC3STREAM);
|
||||
typedef HRESULT (*LPEAXAC3PLAYSTREAM) (AC3STREAM, int);
|
||||
typedef HRESULT (*LPEAXAC3STOPSTREAM) (AC3STREAM);
|
||||
typedef HRESULT (*LPEAXAC3PAUSESTREAM) (AC3STREAM);
|
||||
typedef HRESULT (*LPEAXAC3RESUMESTREAM) (AC3STREAM);
|
||||
typedef HRESULT (*LPEAXAC3LOCKBUFFER) (AC3STREAM, unsigned long, void **, unsigned long *, void **,
|
||||
unsigned long *, unsigned long);
|
||||
typedef HRESULT (*LPEAXAC3UNLOCKBUFFER) (AC3STREAM, void *, unsigned long, void *, unsigned long, int);
|
||||
typedef HRESULT (*LPEAXAC3SETPLAYBACKMODE) (EAXAC3HANDLE, unsigned int);
|
||||
typedef char * (*LPEAXAC3GETERRORSTRING) (HRESULT, char *, int);
|
||||
typedef HRESULT (*LPEAXAC3GETLASTERROR) (HRESULT *);
|
||||
|
||||
// Function table declaration
|
||||
typedef struct
|
||||
{
|
||||
LPEAXAC3QUERYNUMBEROFDEVICES EAXAC3QueryNumberOfDevices;
|
||||
LPEAXAC3QUERYFILE EAXAC3QueryFile;
|
||||
LPEAXAC3QUERYMEMORY EAXAC3QueryMemory;
|
||||
LPEAXAC3QUERYNOOFFRAMESREQFORPLAYBACK EAXAC3QueryNoOfFramesReqForPlayback;
|
||||
LPEAXAC3OPENPLAYBACKDEVICE EAXAC3OpenPlaybackDevice;
|
||||
LPEAXAC3CLOSEPLAYBACKDEVICE EAXAC3ClosePlaybackDevice;
|
||||
LPEAXAC3QUERYDEVICECAPS EAXAC3QueryDeviceCaps;
|
||||
LPEAXAC3GETPOSITION EAXAC3GetPosition;
|
||||
LPEAXAC3SETFILEPOSITION EAXAC3SetFilePosition;
|
||||
LPEAXAC3OPENSTREAM EAXAC3OpenStream;
|
||||
LPEAXAC3CLOSESTREAM EAXAC3CloseStream;
|
||||
LPEAXAC3PREPLAYSTREAM EAXAC3PrePlayStream;
|
||||
LPEAXAC3PLAYSTREAM EAXAC3PlayStream;
|
||||
LPEAXAC3STOPSTREAM EAXAC3StopStream;
|
||||
LPEAXAC3PAUSESTREAM EAXAC3PauseStream;
|
||||
LPEAXAC3RESUMESTREAM EAXAC3ResumeStream;
|
||||
LPEAXAC3LOCKBUFFER EAXAC3LockBuffer;
|
||||
LPEAXAC3UNLOCKBUFFER EAXAC3UnLockBuffer;
|
||||
LPEAXAC3SETPLAYBACKMODE EAXAC3SetPlaybackMode;
|
||||
LPEAXAC3GETERRORSTRING EAXAC3GetErrorString;
|
||||
LPEAXAC3GETLASTERROR EAXAC3GetLastError;
|
||||
} EAXAC3FNTABLE, *LPEAXAC3FNTABLE;
|
||||
|
||||
|
||||
#ifndef OPENAL
|
||||
typedef EAXAC3_API HRESULT (*LPEAXAC3GETFUNCTIONTABLE) (LPEAXAC3FNTABLE);
|
||||
#else
|
||||
typedef ALboolean (*LPALEAXAC3GETFUNCTIONTABLE) (LPEAXAC3FNTABLE);
|
||||
#endif
|
||||
|
||||
// Functions exposed in the DLL
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3GetFunctionTable(LPEAXAC3FNTABLE lpEAXAC3FnTable);
|
||||
|
||||
EAXAC3_API int EAXAC3QueryNumberOfDevices();
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3QueryFile(char *szAC3Filename, LPAC3FILEINFO lpAC3Caps, int nSizeOfAC3FileInfoStruct);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3QueryMemory(char *lpBuffer, int nSizeOfBuffer, LPAC3FILEINFO lpAC3FileInfo,
|
||||
int nSizeOfAC3FileInfoStruct);
|
||||
|
||||
EAXAC3_API int EAXAC3QueryNoOfFramesReqForPlayback(AC3STREAM AC3Stream);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3OpenPlaybackDevice(EAXAC3HANDLE EAXAC3Handle);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3ClosePlaybackDevice(EAXAC3HANDLE EAXAC3Handle);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3QueryDeviceCaps(EAXAC3HANDLE EAXAC3Handle, LPEAXAC3DEVICEINFO lpEAXAC3DeviceInfo,
|
||||
int nSizeOfAC3DeviceInfoStruct);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3GetPosition(AC3STREAM AC3Stream, enum POSFORMAT posFormat, int *lpAmount);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3SetFilePosition(AC3STREAM AC3Stream, enum POSFORMAT posFormat, int nAmount);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3OpenStream(EAXAC3HANDLE EAXAC3Handle, AC3STREAM *lpAC3Stream,
|
||||
LPAC3CALLBACK pAC3CallbackFn, char *szAC3Filename, enum SOURCE src);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3CloseStream(AC3STREAM AC3Stream);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3PrePlayStream(AC3STREAM AC3Stream);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3PlayStream(AC3STREAM AC3Stream, int nLooping);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3StopStream(AC3STREAM AC3Stream);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3PauseStream(AC3STREAM AC3Stream);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3ResumeStream(AC3STREAM AC3Stream);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3LockBuffer(AC3STREAM AC3Stream, unsigned long ulBytes, void **ppvPointer1,
|
||||
unsigned long *pdwBytes1, void **ppvPointer2, unsigned long *pdwBytes2,
|
||||
unsigned long ulFlags);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3UnLockBuffer(AC3STREAM AC3Stream, void *pvPointer1, unsigned long ulSize1,
|
||||
void *pvPointer2, unsigned long ulSize2, int nFinished);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3SetPlaybackMode(EAXAC3HANDLE EAXAC3Handle, unsigned int ulPlayMode);
|
||||
|
||||
EAXAC3_API char * EAXAC3GetErrorString(HRESULT hr, char *szErrorString, int nSizeOfErrorString);
|
||||
|
||||
EAXAC3_API HRESULT EAXAC3GetLastError(HRESULT *hr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
202
Engine/SoundLib/vorbis_sdk/include/ogg/ogg.h
Normal file
202
Engine/SoundLib/vorbis_sdk/include/ogg/ogg.h
Normal file
@@ -0,0 +1,202 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: toplevel libogg include
|
||||
last mod: $Id: ogg.h,v 1.19 2002/09/15 23:48:02 xiphmont Exp $
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _OGG_H
|
||||
#define _OGG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <ogg/os_types.h>
|
||||
|
||||
typedef struct {
|
||||
long endbyte;
|
||||
int endbit;
|
||||
|
||||
unsigned char *buffer;
|
||||
unsigned char *ptr;
|
||||
long storage;
|
||||
} oggpack_buffer;
|
||||
|
||||
/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
|
||||
|
||||
typedef struct {
|
||||
unsigned char *header;
|
||||
long header_len;
|
||||
unsigned char *body;
|
||||
long body_len;
|
||||
} ogg_page;
|
||||
|
||||
/* ogg_stream_state contains the current encode/decode state of a logical
|
||||
Ogg bitstream **********************************************************/
|
||||
|
||||
typedef struct {
|
||||
unsigned char *body_data; /* bytes from packet bodies */
|
||||
long body_storage; /* storage elements allocated */
|
||||
long body_fill; /* elements stored; fill mark */
|
||||
long body_returned; /* elements of fill returned */
|
||||
|
||||
|
||||
int *lacing_vals; /* The values that will go to the segment table */
|
||||
ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact
|
||||
this way, but it is simple coupled to the
|
||||
lacing fifo */
|
||||
long lacing_storage;
|
||||
long lacing_fill;
|
||||
long lacing_packet;
|
||||
long lacing_returned;
|
||||
|
||||
unsigned char header[282]; /* working space for header encode */
|
||||
int header_fill;
|
||||
|
||||
int e_o_s; /* set when we have buffered the last packet in the
|
||||
logical bitstream */
|
||||
int b_o_s; /* set after we've written the initial page
|
||||
of a logical bitstream */
|
||||
long serialno;
|
||||
long pageno;
|
||||
ogg_int64_t packetno; /* sequence number for decode; the framing
|
||||
knows where there's a hole in the data,
|
||||
but we need coupling so that the codec
|
||||
(which is in a seperate abstraction
|
||||
layer) also knows about the gap */
|
||||
ogg_int64_t granulepos;
|
||||
|
||||
} ogg_stream_state;
|
||||
|
||||
/* ogg_packet is used to encapsulate the data and metadata belonging
|
||||
to a single raw Ogg/Vorbis packet *************************************/
|
||||
|
||||
typedef struct {
|
||||
unsigned char *packet;
|
||||
long bytes;
|
||||
long b_o_s;
|
||||
long e_o_s;
|
||||
|
||||
ogg_int64_t granulepos;
|
||||
|
||||
ogg_int64_t packetno; /* sequence number for decode; the framing
|
||||
knows where there's a hole in the data,
|
||||
but we need coupling so that the codec
|
||||
(which is in a seperate abstraction
|
||||
layer) also knows about the gap */
|
||||
} ogg_packet;
|
||||
|
||||
typedef struct {
|
||||
unsigned char *data;
|
||||
int storage;
|
||||
int fill;
|
||||
int returned;
|
||||
|
||||
int unsynced;
|
||||
int headerbytes;
|
||||
int bodybytes;
|
||||
} ogg_sync_state;
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
|
||||
|
||||
extern void oggpack_writeinit(oggpack_buffer *b);
|
||||
extern void oggpack_writetrunc(oggpack_buffer *b,long bits);
|
||||
extern void oggpack_writealign(oggpack_buffer *b);
|
||||
extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
|
||||
extern void oggpack_reset(oggpack_buffer *b);
|
||||
extern void oggpack_writeclear(oggpack_buffer *b);
|
||||
extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
|
||||
extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
|
||||
extern long oggpack_look(oggpack_buffer *b,int bits);
|
||||
extern long oggpack_look1(oggpack_buffer *b);
|
||||
extern void oggpack_adv(oggpack_buffer *b,int bits);
|
||||
extern void oggpack_adv1(oggpack_buffer *b);
|
||||
extern long oggpack_read(oggpack_buffer *b,int bits);
|
||||
extern long oggpack_read1(oggpack_buffer *b);
|
||||
extern long oggpack_bytes(oggpack_buffer *b);
|
||||
extern long oggpack_bits(oggpack_buffer *b);
|
||||
extern unsigned char *oggpack_get_buffer(oggpack_buffer *b);
|
||||
|
||||
extern void oggpackB_writeinit(oggpack_buffer *b);
|
||||
extern void oggpackB_writetrunc(oggpack_buffer *b,long bits);
|
||||
extern void oggpackB_writealign(oggpack_buffer *b);
|
||||
extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits);
|
||||
extern void oggpackB_reset(oggpack_buffer *b);
|
||||
extern void oggpackB_writeclear(oggpack_buffer *b);
|
||||
extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
|
||||
extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits);
|
||||
extern long oggpackB_look(oggpack_buffer *b,int bits);
|
||||
extern long oggpackB_look1(oggpack_buffer *b);
|
||||
extern void oggpackB_adv(oggpack_buffer *b,int bits);
|
||||
extern void oggpackB_adv1(oggpack_buffer *b);
|
||||
extern long oggpackB_read(oggpack_buffer *b,int bits);
|
||||
extern long oggpackB_read1(oggpack_buffer *b);
|
||||
extern long oggpackB_bytes(oggpack_buffer *b);
|
||||
extern long oggpackB_bits(oggpack_buffer *b);
|
||||
extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: encoding **************************/
|
||||
|
||||
extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
|
||||
extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
|
||||
extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
|
||||
|
||||
extern int ogg_sync_init(ogg_sync_state *oy);
|
||||
extern int ogg_sync_clear(ogg_sync_state *oy);
|
||||
extern int ogg_sync_reset(ogg_sync_state *oy);
|
||||
extern int ogg_sync_destroy(ogg_sync_state *oy);
|
||||
|
||||
extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
|
||||
extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
|
||||
extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
|
||||
extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
|
||||
extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
|
||||
extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
|
||||
extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: general ***************************/
|
||||
|
||||
extern int ogg_stream_init(ogg_stream_state *os,int serialno);
|
||||
extern int ogg_stream_clear(ogg_stream_state *os);
|
||||
extern int ogg_stream_reset(ogg_stream_state *os);
|
||||
extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
|
||||
extern int ogg_stream_destroy(ogg_stream_state *os);
|
||||
extern int ogg_stream_eos(ogg_stream_state *os);
|
||||
|
||||
extern void ogg_page_checksum_set(ogg_page *og);
|
||||
|
||||
extern int ogg_page_version(ogg_page *og);
|
||||
extern int ogg_page_continued(ogg_page *og);
|
||||
extern int ogg_page_bos(ogg_page *og);
|
||||
extern int ogg_page_eos(ogg_page *og);
|
||||
extern ogg_int64_t ogg_page_granulepos(ogg_page *og);
|
||||
extern int ogg_page_serialno(ogg_page *og);
|
||||
extern long ogg_page_pageno(ogg_page *og);
|
||||
extern int ogg_page_packets(ogg_page *og);
|
||||
|
||||
extern void ogg_packet_clear(ogg_packet *op);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OGG_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
106
Engine/SoundLib/vorbis_sdk/include/ogg/os_types.h
Normal file
106
Engine/SoundLib/vorbis_sdk/include/ogg/os_types.h
Normal file
@@ -0,0 +1,106 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
||||
last mod: $Id: os_types.h,v 1.14 2003/09/02 05:09:14 xiphmont Exp $
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _OS_TYPES_H
|
||||
#define _OS_TYPES_H
|
||||
|
||||
/* make it easy on the folks that want to compile the libs with a
|
||||
different malloc than stdlib */
|
||||
#define _ogg_malloc malloc
|
||||
#define _ogg_calloc calloc
|
||||
#define _ogg_realloc realloc
|
||||
#define _ogg_free free
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
# ifndef __GNUC__
|
||||
/* MSVC/Borland */
|
||||
typedef __int64 ogg_int64_t;
|
||||
typedef __int32 ogg_int32_t;
|
||||
typedef unsigned __int32 ogg_uint32_t;
|
||||
typedef __int16 ogg_int16_t;
|
||||
typedef unsigned __int16 ogg_uint16_t;
|
||||
# else
|
||||
/* Cygwin */
|
||||
#include <_G_config.h>
|
||||
typedef _G_int64_t ogg_int64_t;
|
||||
typedef _G_int32_t ogg_int32_t;
|
||||
typedef _G_uint32_t ogg_uint32_t;
|
||||
typedef _G_int16_t ogg_int16_t;
|
||||
typedef _G_uint16_t ogg_uint16_t;
|
||||
# endif
|
||||
|
||||
#elif defined(__MACOS__)
|
||||
|
||||
# include <sys/types.h>
|
||||
typedef SInt16 ogg_int16_t;
|
||||
typedef UInt16 ogg_uint16_t;
|
||||
typedef SInt32 ogg_int32_t;
|
||||
typedef UInt32 ogg_uint32_t;
|
||||
typedef SInt64 ogg_int64_t;
|
||||
|
||||
#elif defined(__MACOSX__) /* MacOS X Framework build */
|
||||
|
||||
# include <sys/types.h>
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef u_int16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef u_int32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
|
||||
#elif defined(__BEOS__)
|
||||
|
||||
/* Be */
|
||||
# include <inttypes.h>
|
||||
typedef int16_t ogg_int16_t;
|
||||
typedef u_int16_t ogg_uint16_t;
|
||||
typedef int32_t ogg_int32_t;
|
||||
typedef u_int32_t ogg_uint32_t;
|
||||
typedef int64_t ogg_int64_t;
|
||||
|
||||
#elif defined (__EMX__)
|
||||
|
||||
/* OS/2 GCC */
|
||||
typedef short ogg_int16_t;
|
||||
typedef unsigned short ogg_uint16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
|
||||
#elif defined (DJGPP)
|
||||
|
||||
/* DJGPP */
|
||||
typedef short ogg_int16_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef long long ogg_int64_t;
|
||||
|
||||
#elif defined(R5900)
|
||||
|
||||
/* PS2 EE */
|
||||
typedef long ogg_int64_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned ogg_uint32_t;
|
||||
typedef short ogg_int16_t;
|
||||
|
||||
#else
|
||||
|
||||
# include <sys/types.h>
|
||||
# include <ogg/config_types.h>
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _OS_TYPES_H */
|
||||
240
Engine/SoundLib/vorbis_sdk/include/vorbis/codec.h
Normal file
240
Engine/SoundLib/vorbis_sdk/include/vorbis/codec.h
Normal file
@@ -0,0 +1,240 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
|
||||
* by the XIPHOPHORUS Company http://www.xiph.org/ *
|
||||
|
||||
********************************************************************
|
||||
|
||||
function: libvorbis codec headers
|
||||
last mod: $Id: codec.h,v 1.45 2003/09/05 22:34:46 giles Exp $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _vorbis_codec_h_
|
||||
#define _vorbis_codec_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
typedef struct vorbis_info{
|
||||
int version;
|
||||
int channels;
|
||||
long rate;
|
||||
|
||||
/* The below bitrate declarations are *hints*.
|
||||
Combinations of the three values carry the following implications:
|
||||
|
||||
all three set to the same value:
|
||||
implies a fixed rate bitstream
|
||||
only nominal set:
|
||||
implies a VBR stream that averages the nominal bitrate. No hard
|
||||
upper/lower limit
|
||||
upper and or lower set:
|
||||
implies a VBR bitstream that obeys the bitrate limits. nominal
|
||||
may also be set to give a nominal rate.
|
||||
none set:
|
||||
the coder does not care to speculate.
|
||||
*/
|
||||
|
||||
long bitrate_upper;
|
||||
long bitrate_nominal;
|
||||
long bitrate_lower;
|
||||
long bitrate_window;
|
||||
|
||||
void *codec_setup;
|
||||
} vorbis_info;
|
||||
|
||||
/* vorbis_dsp_state buffers the current vorbis audio
|
||||
analysis/synthesis state. The DSP state belongs to a specific
|
||||
logical bitstream ****************************************************/
|
||||
typedef struct vorbis_dsp_state{
|
||||
int analysisp;
|
||||
vorbis_info *vi;
|
||||
|
||||
float **pcm;
|
||||
float **pcmret;
|
||||
int pcm_storage;
|
||||
int pcm_current;
|
||||
int pcm_returned;
|
||||
|
||||
int preextrapolate;
|
||||
int eofflag;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
long centerW;
|
||||
|
||||
ogg_int64_t granulepos;
|
||||
ogg_int64_t sequence;
|
||||
|
||||
ogg_int64_t glue_bits;
|
||||
ogg_int64_t time_bits;
|
||||
ogg_int64_t floor_bits;
|
||||
ogg_int64_t res_bits;
|
||||
|
||||
void *backend_state;
|
||||
} vorbis_dsp_state;
|
||||
|
||||
typedef struct vorbis_block{
|
||||
/* necessary stream state for linking to the framing abstraction */
|
||||
float **pcm; /* this is a pointer into local storage */
|
||||
oggpack_buffer opb;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
int pcmend;
|
||||
int mode;
|
||||
|
||||
int eofflag;
|
||||
ogg_int64_t granulepos;
|
||||
ogg_int64_t sequence;
|
||||
vorbis_dsp_state *vd; /* For read-only access of configuration */
|
||||
|
||||
/* local storage to avoid remallocing; it's up to the mapping to
|
||||
structure it */
|
||||
void *localstore;
|
||||
long localtop;
|
||||
long localalloc;
|
||||
long totaluse;
|
||||
struct alloc_chain *reap;
|
||||
|
||||
/* bitmetrics for the frame */
|
||||
long glue_bits;
|
||||
long time_bits;
|
||||
long floor_bits;
|
||||
long res_bits;
|
||||
|
||||
void *internal;
|
||||
|
||||
} vorbis_block;
|
||||
|
||||
/* vorbis_block is a single block of data to be processed as part of
|
||||
the analysis/synthesis stream; it belongs to a specific logical
|
||||
bitstream, but is independant from other vorbis_blocks belonging to
|
||||
that logical bitstream. *************************************************/
|
||||
|
||||
struct alloc_chain{
|
||||
void *ptr;
|
||||
struct alloc_chain *next;
|
||||
};
|
||||
|
||||
/* vorbis_info contains all the setup information specific to the
|
||||
specific compression/decompression mode in progress (eg,
|
||||
psychoacoustic settings, channel setup, options, codebook
|
||||
etc). vorbis_info and substructures are in backends.h.
|
||||
*********************************************************************/
|
||||
|
||||
/* the comments are not part of vorbis_info so that vorbis_info can be
|
||||
static storage */
|
||||
typedef struct vorbis_comment{
|
||||
/* unlimited user comment fields. libvorbis writes 'libvorbis'
|
||||
whatever vendor is set to in encode */
|
||||
char **user_comments;
|
||||
int *comment_lengths;
|
||||
int comments;
|
||||
char *vendor;
|
||||
|
||||
} vorbis_comment;
|
||||
|
||||
|
||||
/* libvorbis encodes in two abstraction layers; first we perform DSP
|
||||
and produce a packet (see docs/analysis.txt). The packet is then
|
||||
coded into a framed OggSquish bitstream by the second layer (see
|
||||
docs/framing.txt). Decode is the reverse process; we sync/frame
|
||||
the bitstream and extract individual packets, then decode the
|
||||
packet back into PCM audio.
|
||||
|
||||
The extra framing/packetizing is used in streaming formats, such as
|
||||
files. Over the net (such as with UDP), the framing and
|
||||
packetization aren't necessary as they're provided by the transport
|
||||
and the streaming layer is not used */
|
||||
|
||||
/* Vorbis PRIMITIVES: general ***************************************/
|
||||
|
||||
extern void vorbis_info_init(vorbis_info *vi);
|
||||
extern void vorbis_info_clear(vorbis_info *vi);
|
||||
extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
|
||||
extern void vorbis_comment_init(vorbis_comment *vc);
|
||||
extern void vorbis_comment_add(vorbis_comment *vc, char *comment);
|
||||
extern void vorbis_comment_add_tag(vorbis_comment *vc,
|
||||
char *tag, char *contents);
|
||||
extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
|
||||
extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag);
|
||||
extern void vorbis_comment_clear(vorbis_comment *vc);
|
||||
|
||||
extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
|
||||
extern int vorbis_block_clear(vorbis_block *vb);
|
||||
extern void vorbis_dsp_clear(vorbis_dsp_state *v);
|
||||
extern double vorbis_granule_time(vorbis_dsp_state *v,
|
||||
ogg_int64_t granulepos);
|
||||
|
||||
/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
|
||||
|
||||
extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
|
||||
extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
|
||||
extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
|
||||
vorbis_comment *vc,
|
||||
ogg_packet *op,
|
||||
ogg_packet *op_comm,
|
||||
ogg_packet *op_code);
|
||||
extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
|
||||
extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
|
||||
extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
|
||||
extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op);
|
||||
|
||||
extern int vorbis_bitrate_addblock(vorbis_block *vb);
|
||||
extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
|
||||
ogg_packet *op);
|
||||
|
||||
/* Vorbis PRIMITIVES: synthesis layer *******************************/
|
||||
extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
|
||||
ogg_packet *op);
|
||||
|
||||
extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
|
||||
extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
|
||||
extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
|
||||
extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op);
|
||||
extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
|
||||
extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
|
||||
extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm);
|
||||
extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
|
||||
extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
|
||||
|
||||
extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag);
|
||||
extern int vorbis_synthesis_halfrate_p(vorbis_info *v);
|
||||
|
||||
/* Vorbis ERRORS and return codes ***********************************/
|
||||
|
||||
#define OV_FALSE -1
|
||||
#define OV_EOF -2
|
||||
#define OV_HOLE -3
|
||||
|
||||
#define OV_EREAD -128
|
||||
#define OV_EFAULT -129
|
||||
#define OV_EIMPL -130
|
||||
#define OV_EINVAL -131
|
||||
#define OV_ENOTVORBIS -132
|
||||
#define OV_EBADHEADER -133
|
||||
#define OV_EVERSION -134
|
||||
#define OV_ENOTAUDIO -135
|
||||
#define OV_EBADPACKET -136
|
||||
#define OV_EBADLINK -137
|
||||
#define OV_ENOSEEK -138
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
93
Engine/SoundLib/vorbis_sdk/include/vorbis/vorbisenc.h
Normal file
93
Engine/SoundLib/vorbis_sdk/include/vorbis/vorbisenc.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
|
||||
* by the XIPHOPHORUS Company http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: vorbis encode-engine setup
|
||||
last mod: $Id: vorbisenc.h,v 1.10 2002/07/01 11:20:10 xiphmont Exp $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _OV_ENC_H_
|
||||
#define _OV_ENC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "codec.h"
|
||||
|
||||
extern int vorbis_encode_init(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
long max_bitrate,
|
||||
long nominal_bitrate,
|
||||
long min_bitrate);
|
||||
|
||||
extern int vorbis_encode_setup_managed(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
long max_bitrate,
|
||||
long nominal_bitrate,
|
||||
long min_bitrate);
|
||||
|
||||
extern int vorbis_encode_setup_vbr(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
float /* quality level from 0. (lo) to 1. (hi) */
|
||||
);
|
||||
|
||||
extern int vorbis_encode_init_vbr(vorbis_info *vi,
|
||||
long channels,
|
||||
long rate,
|
||||
|
||||
float base_quality /* quality level from 0. (lo) to 1. (hi) */
|
||||
);
|
||||
|
||||
extern int vorbis_encode_setup_init(vorbis_info *vi);
|
||||
|
||||
extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
|
||||
|
||||
#define OV_ECTL_RATEMANAGE_GET 0x10
|
||||
|
||||
#define OV_ECTL_RATEMANAGE_SET 0x11
|
||||
#define OV_ECTL_RATEMANAGE_AVG 0x12
|
||||
#define OV_ECTL_RATEMANAGE_HARD 0x13
|
||||
|
||||
#define OV_ECTL_LOWPASS_GET 0x20
|
||||
#define OV_ECTL_LOWPASS_SET 0x21
|
||||
|
||||
#define OV_ECTL_IBLOCK_GET 0x30
|
||||
#define OV_ECTL_IBLOCK_SET 0x31
|
||||
|
||||
struct ovectl_ratemanage_arg {
|
||||
int management_active;
|
||||
|
||||
long bitrate_hard_min;
|
||||
long bitrate_hard_max;
|
||||
double bitrate_hard_window;
|
||||
|
||||
long bitrate_av_lo;
|
||||
long bitrate_av_hi;
|
||||
double bitrate_av_window;
|
||||
double bitrate_av_window_center;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
143
Engine/SoundLib/vorbis_sdk/include/vorbis/vorbisfile.h
Normal file
143
Engine/SoundLib/vorbis_sdk/include/vorbis/vorbisfile.h
Normal file
@@ -0,0 +1,143 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
|
||||
* by the XIPHOPHORUS Company http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: stdio-based convenience library for opening/seeking/decoding
|
||||
last mod: $Id: vorbisfile.h,v 1.20 2003/08/18 05:34:01 xiphmont Exp $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _OV_FILE_H_
|
||||
#define _OV_FILE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "codec.h"
|
||||
|
||||
/* The function prototypes for the callbacks are basically the same as for
|
||||
* the stdio functions fread, fseek, fclose, ftell.
|
||||
* The one difference is that the FILE * arguments have been replaced with
|
||||
* a void * - this is to be used as a pointer to whatever internal data these
|
||||
* functions might need. In the stdio case, it's just a FILE * cast to a void *
|
||||
*
|
||||
* If you use other functions, check the docs for these functions and return
|
||||
* the right values. For seek_func(), you *MUST* return -1 if the stream is
|
||||
* unseekable
|
||||
*/
|
||||
typedef struct {
|
||||
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
|
||||
int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
|
||||
int (*close_func) (void *datasource);
|
||||
long (*tell_func) (void *datasource);
|
||||
} ov_callbacks;
|
||||
|
||||
#define NOTOPEN 0
|
||||
#define PARTOPEN 1
|
||||
#define OPENED 2
|
||||
#define STREAMSET 3
|
||||
#define INITSET 4
|
||||
|
||||
typedef struct OggVorbis_File {
|
||||
void *datasource; /* Pointer to a FILE *, etc. */
|
||||
int seekable;
|
||||
ogg_int64_t offset;
|
||||
ogg_int64_t end;
|
||||
ogg_sync_state oy;
|
||||
|
||||
/* If the FILE handle isn't seekable (eg, a pipe), only the current
|
||||
stream appears */
|
||||
int links;
|
||||
ogg_int64_t *offsets;
|
||||
ogg_int64_t *dataoffsets;
|
||||
long *serialnos;
|
||||
ogg_int64_t *pcmlengths; /* overloaded to maintain binary
|
||||
compatability; x2 size, stores both
|
||||
beginning and end values */
|
||||
vorbis_info *vi;
|
||||
vorbis_comment *vc;
|
||||
|
||||
/* Decoding working state local storage */
|
||||
ogg_int64_t pcm_offset;
|
||||
int ready_state;
|
||||
long current_serialno;
|
||||
int current_link;
|
||||
|
||||
double bittrack;
|
||||
double samptrack;
|
||||
|
||||
ogg_stream_state os; /* take physical pages, weld into a logical
|
||||
stream of packets */
|
||||
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
|
||||
vorbis_block vb; /* local working space for packet->PCM decode */
|
||||
|
||||
ov_callbacks callbacks;
|
||||
|
||||
} OggVorbis_File;
|
||||
|
||||
extern int ov_clear(OggVorbis_File *vf);
|
||||
extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
|
||||
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
|
||||
char *initial, long ibytes, ov_callbacks callbacks);
|
||||
|
||||
extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
|
||||
extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
|
||||
char *initial, long ibytes, ov_callbacks callbacks);
|
||||
extern int ov_test_open(OggVorbis_File *vf);
|
||||
|
||||
extern long ov_bitrate(OggVorbis_File *vf,int i);
|
||||
extern long ov_bitrate_instant(OggVorbis_File *vf);
|
||||
extern long ov_streams(OggVorbis_File *vf);
|
||||
extern long ov_seekable(OggVorbis_File *vf);
|
||||
extern long ov_serialnumber(OggVorbis_File *vf,int i);
|
||||
|
||||
extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
|
||||
extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
|
||||
extern double ov_time_total(OggVorbis_File *vf,int i);
|
||||
|
||||
extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_time_seek(OggVorbis_File *vf,double pos);
|
||||
extern int ov_time_seek_page(OggVorbis_File *vf,double pos);
|
||||
|
||||
extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_time_seek_lap(OggVorbis_File *vf,double pos);
|
||||
extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos);
|
||||
|
||||
extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
|
||||
extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
|
||||
extern double ov_time_tell(OggVorbis_File *vf);
|
||||
|
||||
extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
|
||||
extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
|
||||
|
||||
extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
|
||||
int *bitstream);
|
||||
extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
|
||||
int bigendianp,int word,int sgned,int *bitstream);
|
||||
extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
|
||||
|
||||
extern int ov_halfrate(OggVorbis_File *vf,int flag);
|
||||
extern int ov_halfrate_p(OggVorbis_File *vf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user