mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Merge branch 'development' into MiscFixes20220829
This commit is contained in:
commit
fb5ad738e0
45 changed files with 824 additions and 601 deletions
|
|
@ -48,6 +48,8 @@
|
|||
#include "platform/profiler.h"
|
||||
#include "sfx/sfxTypes.h"
|
||||
|
||||
#include "SoundAssetInspectors.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CONOBJECT(SoundAsset);
|
||||
|
|
@ -225,6 +227,8 @@ bool SoundAsset::loadSound()
|
|||
}
|
||||
else
|
||||
{// = new SFXProfile(mProfileDesc, mSoundFile, mPreload);
|
||||
if (mProfileDesc.mSourceGroup == NULL)
|
||||
mProfileDesc.mSourceGroup = dynamic_cast<SFXSource*>(Sim::findObject("AudioChannelMaster"));
|
||||
mSFXProfile.setDescription(&mProfileDesc);
|
||||
mSFXProfile.setSoundFileName(mSoundPath);
|
||||
mSFXProfile.setPreload(mPreload);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@
|
|||
#include "assets/assetFieldTypes.h"
|
||||
#endif
|
||||
|
||||
#include "gui/editor/guiInspectorTypes.h"
|
||||
#ifndef _ASSET_PTR_H_
|
||||
#include "assets/assetPtr.h"
|
||||
#endif
|
||||
|
|
@ -145,33 +144,7 @@ protected:
|
|||
|
||||
DefineConsoleType(TypeSoundAssetPtr, SoundAsset)
|
||||
DefineConsoleType(TypeSoundAssetId, String)
|
||||
#ifdef TORQUE_TOOLS
|
||||
//-----------------------------------------------------------------------------
|
||||
// TypeAssetId GuiInspectorField Class
|
||||
//-----------------------------------------------------------------------------
|
||||
class GuiInspectorTypeSoundAssetPtr : public GuiInspectorTypeFileName
|
||||
{
|
||||
typedef GuiInspectorTypeFileName Parent;
|
||||
public:
|
||||
|
||||
GuiBitmapButtonCtrl* mEditButton;
|
||||
|
||||
DECLARE_CONOBJECT(GuiInspectorTypeSoundAssetPtr);
|
||||
static void consoleInit();
|
||||
|
||||
virtual GuiControl* constructEditControl();
|
||||
virtual bool updateRects();
|
||||
};
|
||||
|
||||
class GuiInspectorTypeSoundAssetId : public GuiInspectorTypeSoundAssetPtr
|
||||
{
|
||||
typedef GuiInspectorTypeSoundAssetPtr Parent;
|
||||
public:
|
||||
|
||||
DECLARE_CONOBJECT(GuiInspectorTypeSoundAssetId);
|
||||
static void consoleInit();
|
||||
};
|
||||
#endif
|
||||
#pragma region Singular Asset Macros
|
||||
|
||||
//Singular assets
|
||||
|
|
|
|||
32
Engine/source/T3D/assets/SoundAssetInspectors.h
Normal file
32
Engine/source/T3D/assets/SoundAssetInspectors.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include "SoundAsset.h"
|
||||
|
||||
#ifndef _GUI_INSPECTOR_TYPES_H_
|
||||
#include "gui/editor/guiInspectorTypes.h"
|
||||
#endif
|
||||
|
||||
#ifdef TORQUE_TOOLS
|
||||
class GuiInspectorTypeSoundAssetPtr : public GuiInspectorTypeFileName
|
||||
{
|
||||
typedef GuiInspectorTypeFileName Parent;
|
||||
public:
|
||||
|
||||
GuiBitmapButtonCtrl* mEditButton;
|
||||
|
||||
DECLARE_CONOBJECT(GuiInspectorTypeSoundAssetPtr);
|
||||
static void consoleInit();
|
||||
|
||||
virtual GuiControl* constructEditControl();
|
||||
virtual bool updateRects();
|
||||
};
|
||||
|
||||
class GuiInspectorTypeSoundAssetId : public GuiInspectorTypeSoundAssetPtr
|
||||
{
|
||||
typedef GuiInspectorTypeSoundAssetPtr Parent;
|
||||
public:
|
||||
|
||||
DECLARE_CONOBJECT(GuiInspectorTypeSoundAssetId);
|
||||
static void consoleInit();
|
||||
};
|
||||
#endif
|
||||
|
|
@ -817,7 +817,7 @@ void ReflectionProbe::createEditorResources()
|
|||
|
||||
void ReflectionProbe::prepRenderImage(SceneRenderState *state)
|
||||
{
|
||||
if (!mEnabled || (!RenderProbeMgr::smRenderReflectionProbes && dStrcmp(Con::getVariable("$Probes::Capturing", "0"),"1")))
|
||||
if (!mEnabled || (!RenderProbeMgr::smRenderReflectionProbes && !dStrcmp(Con::getVariable("$Probes::Capturing", "0"),"1")))
|
||||
return;
|
||||
|
||||
Point3F distVec = getRenderPosition() - state->getCameraPosition();
|
||||
|
|
|
|||
|
|
@ -252,8 +252,8 @@ void GuiButtonBaseCtrl::onMouseDown(const GuiEvent &event)
|
|||
if (mProfile->mCanKeyFocus)
|
||||
setFirstResponder();
|
||||
|
||||
if (mProfile->mSoundButtonDown)
|
||||
SFX->playOnce(mProfile->mSoundButtonDown);
|
||||
if (mProfile->isSoundButtonDownValid())
|
||||
SFX->playOnce(mProfile->getSoundButtonDownProfile());
|
||||
|
||||
mMouseDownPoint = event.mousePoint;
|
||||
mMouseDragged = false;
|
||||
|
|
@ -292,8 +292,8 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( mActive && mProfile->mSoundButtonOver )
|
||||
SFX->playOnce(mProfile->mSoundButtonOver);
|
||||
if (mProfile->isSoundButtonOverValid())
|
||||
SFX->playOnce(mProfile->getSoundButtonOverProfile());
|
||||
|
||||
mHighlighted = true;
|
||||
}
|
||||
|
|
@ -377,8 +377,8 @@ bool GuiButtonBaseCtrl::onKeyDown(const GuiEvent &event)
|
|||
if ((event.keyCode == KEY_RETURN || event.keyCode == KEY_SPACE)
|
||||
&& event.modifier == 0)
|
||||
{
|
||||
if ( mProfile->mSoundButtonDown )
|
||||
SFX->playOnce( mProfile->mSoundButtonDown);
|
||||
if (mProfile->isSoundButtonDownValid())
|
||||
SFX->playOnce(mProfile->getSoundButtonDownProfile());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,6 +204,9 @@ void GuiSliderCtrl::onMouseDown(const GuiEvent &event)
|
|||
setFirstResponder();
|
||||
mDepressed = true;
|
||||
|
||||
if (mProfile->isSoundButtonDownValid())
|
||||
SFX->playOnce(mProfile->getSoundButtonDownProfile());
|
||||
|
||||
Point2I curMousePos = globalToLocalCoord( event.mousePoint );
|
||||
F32 value;
|
||||
if (getWidth() >= getHeight())
|
||||
|
|
@ -261,7 +264,8 @@ void GuiSliderCtrl::onMouseEnter(const GuiEvent &event)
|
|||
if( mActive && mProfile->mSoundButtonOver )
|
||||
{
|
||||
//F32 pan = (F32(event.mousePoint.x)/F32(getRoot()->getWidth())*2.0f-1.0f)*0.8f;
|
||||
SFX->playOnce( mProfile->mSoundButtonOver );
|
||||
if (mProfile->isSoundButtonOverValid())
|
||||
SFX->playOnce(mProfile->getSoundButtonOverProfile());
|
||||
}
|
||||
|
||||
mMouseOver = true;
|
||||
|
|
|
|||
|
|
@ -218,60 +218,6 @@ bool GuiControlProfile::protectedSetBitmap( void *object, const char *index, con
|
|||
return false;
|
||||
}
|
||||
|
||||
const char* GuiControlProfile::protectedGetSoundButtonDown( void* object, const char* data )
|
||||
{
|
||||
GuiControlProfile* profile = reinterpret_cast< GuiControlProfile* >( object );
|
||||
|
||||
SFXTrack* track = profile->mSoundButtonDown;
|
||||
if( !track )
|
||||
return "";
|
||||
|
||||
return track->getName();
|
||||
}
|
||||
|
||||
bool GuiControlProfile::protectedSetSoundButtonDown( void* object, const char* index, const char* data )
|
||||
{
|
||||
GuiControlProfile* profile = reinterpret_cast< GuiControlProfile* >( object );
|
||||
|
||||
SFXTrack* track = NULL;
|
||||
if( data && data[ 0] && !Sim::findObject( data, track ) )
|
||||
{
|
||||
Con::errorf( "GuiControlProfile::protectedSetSoundButtonDown - no SFXTrack '%s'", data );
|
||||
return false;
|
||||
}
|
||||
|
||||
profile->mSoundButtonDown = track;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* GuiControlProfile::protectedGetSoundButtonOver( void* object, const char* data )
|
||||
{
|
||||
GuiControlProfile* profile = reinterpret_cast< GuiControlProfile* >( object );
|
||||
|
||||
SFXTrack* track = profile->mSoundButtonOver;
|
||||
if( !track )
|
||||
return "";
|
||||
|
||||
return track->getName();
|
||||
}
|
||||
|
||||
bool GuiControlProfile::protectedSetSoundButtonOver( void* object, const char* index, const char* data )
|
||||
{
|
||||
GuiControlProfile* profile = reinterpret_cast< GuiControlProfile* >( object );
|
||||
|
||||
SFXTrack* track = NULL;
|
||||
if( data && data[ 0] && !Sim::findObject( data, track ) )
|
||||
{
|
||||
Con::errorf( "GuiControlProfile::protectedSetSoundButtonOver - no SFXTrack '%s'", data );
|
||||
return false;
|
||||
}
|
||||
|
||||
profile->mSoundButtonOver = track;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
GuiControlProfile::GuiControlProfile(void) :
|
||||
mFillColor(255,0,255,255),
|
||||
mFillColorHL(255,0,255,255),
|
||||
|
|
@ -293,6 +239,8 @@ GuiControlProfile::GuiControlProfile(void) :
|
|||
mTextOffset(0,0),
|
||||
mBitmapArrayRects(0)
|
||||
{
|
||||
INIT_ASSET(SoundButtonDown);
|
||||
INIT_ASSET(SoundButtonOver);
|
||||
mLoadCount = 0;
|
||||
mUseCount = 0;
|
||||
|
||||
|
|
@ -367,8 +315,19 @@ GuiControlProfile::GuiControlProfile(void) :
|
|||
mTextOffset = def->mTextOffset;
|
||||
|
||||
// default sound
|
||||
mSoundButtonDown = def->mSoundButtonDown;
|
||||
mSoundButtonOver = def->mSoundButtonOver;
|
||||
_setSoundButtonDown(def->getSoundButtonDown());
|
||||
if (getSoundButtonDown() != StringTable->EmptyString())
|
||||
{
|
||||
if (!getSoundButtonDownProfile())
|
||||
Con::errorf(ConsoleLogEntry::General, "GuiControlProfile: Can't get default button pressed sound asset.");
|
||||
}
|
||||
|
||||
_setSoundButtonOver(def->getSoundButtonOver());
|
||||
if (getSoundButtonOver() != StringTable->EmptyString())
|
||||
{
|
||||
if (!getSoundButtonOverProfile())
|
||||
Con::errorf(ConsoleLogEntry::General, "GuiControlProfile: Can't get default button hover sound asset.");
|
||||
}
|
||||
|
||||
//used by GuiTextCtrl
|
||||
mModal = def->mModal;
|
||||
|
|
@ -478,12 +437,9 @@ void GuiControlProfile::initPersistFields()
|
|||
addField("hasBitmapArray", TypeBool, Offset(mUseBitmapArray, GuiControlProfile),
|
||||
"If true, 'bitmap' is an array of images." );
|
||||
|
||||
addProtectedField( "soundButtonDown", TypeSFXTrackName, Offset(mSoundButtonDown, GuiControlProfile),
|
||||
&GuiControlProfile::protectedSetSoundButtonDown, &GuiControlProfile::protectedGetSoundButtonDown,
|
||||
"Sound to play when mouse has been pressed on control." );
|
||||
addProtectedField( "soundButtonOver", TypeSFXTrackName, Offset(mSoundButtonOver, GuiControlProfile),
|
||||
&GuiControlProfile::protectedSetSoundButtonOver, &GuiControlProfile::protectedGetSoundButtonOver,
|
||||
"Sound to play when mouse is hovering over control." );
|
||||
INITPERSISTFIELD_SOUNDASSET(SoundButtonDown, GuiControlProfile, "The sound button down.");
|
||||
INITPERSISTFIELD_SOUNDASSET(SoundButtonOver, GuiControlProfile, "The sound button down.");
|
||||
|
||||
addField("profileForChildren", TypeString, Offset(mChildrenProfileName, GuiControlProfile));
|
||||
|
||||
endGroup( "Misc" );
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@
|
|||
#include "console/dynamicTypes.h"
|
||||
#endif
|
||||
|
||||
#ifndef SOUND_ASSET_H_
|
||||
#include "T3D/assets/SoundAsset.h"
|
||||
#endif
|
||||
|
||||
#include "T3D/assets/ImageAsset.h"
|
||||
|
||||
#include "gfx/gfxDevice.h"
|
||||
|
|
@ -562,9 +566,11 @@ public:
|
|||
bool mUseBitmapArray; ///< Flag to use the bitmap array or to fallback to non-array rendering
|
||||
Vector<RectI> mBitmapArrayRects; ///< Used for controls which use an array of bitmaps such as checkboxes
|
||||
|
||||
// sound members
|
||||
SimObjectPtr< SFXTrack > mSoundButtonDown; ///< Sound played when the object is "down" ie a button is pushed
|
||||
SimObjectPtr< SFXTrack > mSoundButtonOver; ///< Sound played when the mouse is over the object
|
||||
DECLARE_SOUNDASSET(GuiControlProfile, SoundButtonDown); ///< Sound played when a button is pressed.
|
||||
DECLARE_ASSET_SETGET(GuiControlProfile, SoundButtonDown);
|
||||
|
||||
DECLARE_SOUNDASSET(GuiControlProfile, SoundButtonOver); ///< Sound played when a button is hovered.
|
||||
DECLARE_ASSET_SETGET(GuiControlProfile, SoundButtonOver);
|
||||
|
||||
StringTableEntry mChildrenProfileName; ///< The name of the profile to use for the children controls
|
||||
|
||||
|
|
@ -583,10 +589,6 @@ protected:
|
|||
GuiControlProfile* mChildrenProfile; ///< Profile used with children controls (such as the scroll bar on a popup menu) when defined.
|
||||
|
||||
static bool protectedSetBitmap( void *object, const char *index, const char *data );
|
||||
static bool protectedSetSoundButtonDown( void* object, const char* index, const char* data );
|
||||
static bool protectedSetSoundButtonOver( void* object, const char* index, const char* data );
|
||||
static const char* protectedGetSoundButtonDown( void* object, const char* data );
|
||||
static const char* protectedGetSoundButtonOver( void* object, const char* data );
|
||||
|
||||
public:
|
||||
DECLARE_CONOBJECT(GuiControlProfile);
|
||||
|
|
|
|||
|
|
@ -470,6 +470,21 @@ void RenderProbeMgr::reloadTextures()
|
|||
}
|
||||
}
|
||||
|
||||
void RenderProbeMgr::preBake()
|
||||
{
|
||||
Con::setVariable("$Probes::Capturing", "1");
|
||||
mRenderMaximumNumOfLights = AdvancedLightBinManager::smMaximumNumOfLights;
|
||||
mRenderUseLightFade = AdvancedLightBinManager::smUseLightFade;
|
||||
|
||||
AdvancedLightBinManager::smMaximumNumOfLights = -1;
|
||||
AdvancedLightBinManager::smUseLightFade = false;
|
||||
}
|
||||
void RenderProbeMgr::postBake()
|
||||
{
|
||||
Con::setVariable("$Probes::Capturing", "0");
|
||||
AdvancedLightBinManager::smMaximumNumOfLights = mRenderMaximumNumOfLights;
|
||||
AdvancedLightBinManager::smUseLightFade = mRenderUseLightFade;
|
||||
}
|
||||
void RenderProbeMgr::bakeProbe(ReflectionProbe* probe)
|
||||
{
|
||||
GFXDEBUGEVENT_SCOPE(RenderProbeMgr_Bake, ColorI::WHITE);
|
||||
|
|
@ -477,7 +492,7 @@ void RenderProbeMgr::bakeProbe(ReflectionProbe* probe)
|
|||
Con::warnf("RenderProbeMgr::bakeProbe() - Beginning bake!");
|
||||
U32 startMSTime = Platform::getRealMilliseconds();
|
||||
|
||||
Con::setVariable("$Probes::Capturing", "1");
|
||||
preBake();
|
||||
|
||||
String path = Con::getVariable("$pref::ReflectionProbes::CurrentLevelPath", "levels/");
|
||||
U32 resolution = Con::getIntVariable("$pref::ReflectionProbes::BakeResolution", 64);
|
||||
|
|
@ -598,7 +613,7 @@ void RenderProbeMgr::bakeProbe(ReflectionProbe* probe)
|
|||
if (!renderWithProbes)
|
||||
RenderProbeMgr::smRenderReflectionProbes = probeRenderState;
|
||||
|
||||
Con::setVariable("$Probes::Capturing", "0");
|
||||
postBake();
|
||||
|
||||
cubeRefl.unregisterReflector();
|
||||
|
||||
|
|
@ -798,7 +813,7 @@ void RenderProbeMgr::render( SceneRenderState *state )
|
|||
_setupPerFrameParameters(state);
|
||||
|
||||
// Early out if nothing to draw.
|
||||
if ((!RenderProbeMgr::smRenderReflectionProbes && dStrcmp(Con::getVariable("$Probes::Capturing", "0"), "1")) || (!mHasSkylight && mProbeData.effectiveProbeCount == 0))
|
||||
if ((!RenderProbeMgr::smRenderReflectionProbes && !dStrcmp(Con::getVariable("$Probes::Capturing", "0"), "1")) || (!mHasSkylight && mProbeData.effectiveProbeCount == 0))
|
||||
{
|
||||
getProbeArrayEffect()->setSkip(true);
|
||||
mActiveProbes.clear();
|
||||
|
|
|
|||
|
|
@ -290,6 +290,11 @@ private:
|
|||
/// </summary>
|
||||
bool mUseHDRCaptures;
|
||||
|
||||
/// <summary>
|
||||
/// holds the normal render state for light fade so we can capture them before and restore them after baking
|
||||
/// </summary>
|
||||
S32 mRenderMaximumNumOfLights;
|
||||
bool mRenderUseLightFade;
|
||||
protected:
|
||||
/// The current active light manager.
|
||||
static RenderProbeMgr* smProbeManager;
|
||||
|
|
@ -413,7 +418,8 @@ public:
|
|||
/// Takes a reflection probe and runs the cubemap bake process on it, outputting the resulting files to disk
|
||||
/// </summary>
|
||||
void bakeProbe(ReflectionProbe* probe);
|
||||
|
||||
void preBake();
|
||||
void postBake();
|
||||
/// <summary>
|
||||
/// Runs the cubemap bake on all probes in the current scene
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#endif
|
||||
|
||||
#if defined(TORQUE_OS_MAC)
|
||||
//#define AL_ALEXT_PROTOTYPES true
|
||||
#undef AL_ALEXT_PROTOTYPES
|
||||
# include <OpenAL/al.h>
|
||||
# include <OpenAL/alc.h>
|
||||
#elif defined(TORQUE_OS_LINUX)
|
||||
|
|
@ -267,12 +267,11 @@ typedef struct
|
|||
LPALGETAUXILIARYEFFECTSLOTIV alGetAuxiliaryEffectSlotiv;
|
||||
LPALGETAUXILIARYEFFECTSLOTF alGetAuxiliaryEffectSlotf;
|
||||
LPALGETAUXILIARYEFFECTSLOTFV alGetAuxiliaryEffectSlotfv;
|
||||
#endif
|
||||
LPALGENFILTERS alGenFilters;
|
||||
LPALDELETEFILTERS alDeleteFilters;
|
||||
LPALFILTERI alFilteri;
|
||||
|
||||
LPALCGETSTRINGISOFT alcGetStringiSOFT;
|
||||
#endif
|
||||
|
||||
} OPENALFNTABLE, *LPOPENALFNTABLE;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -83,17 +83,23 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft )
|
|||
dMemset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO));
|
||||
ALDeviceInfo.bSelected = true;
|
||||
dStrncpy(ALDeviceInfo.strInternalDeviceName, devices, sizeof(ALDeviceInfo.strInternalDeviceName));
|
||||
char* openFind = dStrchr(devices, '(');
|
||||
char deviceExternal[256];
|
||||
dStrcpy(deviceExternal, devices, 256);
|
||||
char* openFind = dStrchr(deviceExternal, '(');
|
||||
if (openFind)
|
||||
{
|
||||
devices = openFind + 1;
|
||||
char* closeFind = dStrchr(devices, ')');
|
||||
char* deviceName = openFind + 1;
|
||||
char* closeFind = dStrchr(deviceName, ')');
|
||||
if (closeFind)
|
||||
(*closeFind) = '\0';
|
||||
|
||||
dStrncpy(ALDeviceInfo.strDeviceName, devices, sizeof(ALDeviceInfo.strDeviceName));
|
||||
dStrncpy(ALDeviceInfo.strDeviceName, deviceName, sizeof(ALDeviceInfo.strDeviceName));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dStrncpy(ALDeviceInfo.strDeviceName, devices, sizeof(ALDeviceInfo.strDeviceName));
|
||||
}
|
||||
|
||||
vDeviceInfo.push_back(ALDeviceInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,164 +62,47 @@ void SFXALDevice::printALInfo(ALCdevice* device)
|
|||
|
||||
}
|
||||
|
||||
void SFXALDevice::printHRTFInfo(ALCdevice* device)
|
||||
{
|
||||
if (mOpenAL.alcIsExtensionPresent(device, "ALC_SOFT_HRTF") == AL_FALSE)
|
||||
{
|
||||
Con::printf("HRTF Extensions not compatible");
|
||||
return;
|
||||
}
|
||||
|
||||
ALCint numHrtfs;
|
||||
|
||||
mOpenAL.alcGetIntegerv(device, ALC_NUM_HRTF_SPECIFIERS_SOFT, 1, &numHrtfs);
|
||||
if (!numHrtfs)
|
||||
Con::printf("No HRTFs Found");
|
||||
else
|
||||
{
|
||||
Con::printf("Available HRTFs");
|
||||
for (U32 i = 0; i < numHrtfs; ++i)
|
||||
{
|
||||
const ALCchar* name = mOpenAL.alcGetStringiSOFT(device, ALC_HRTF_SPECIFIER_SOFT, i);
|
||||
printf(" %s", name);
|
||||
}
|
||||
}
|
||||
|
||||
U32 err = mOpenAL.alcGetError(device);
|
||||
if (err != ALC_NO_ERROR)
|
||||
Con::errorf("SFXALDevice - Error Retrieving HRTF info: %s", mOpenAL.alcGetString(device, err));
|
||||
|
||||
}
|
||||
|
||||
void SFXALDevice::getEFXInfo(ALCdevice *device)
|
||||
{
|
||||
static const ALint filters[] = {
|
||||
AL_FILTER_LOWPASS, AL_FILTER_HIGHPASS, AL_FILTER_BANDPASS,
|
||||
AL_FILTER_NULL
|
||||
};
|
||||
|
||||
char filterNames[] = "Low-pass,High-pass,Band-pass,";
|
||||
static const ALint effects[] = {
|
||||
AL_EFFECT_EAXREVERB, AL_EFFECT_REVERB, AL_EFFECT_CHORUS,
|
||||
AL_EFFECT_DISTORTION, AL_EFFECT_ECHO, AL_EFFECT_FLANGER,
|
||||
AL_EFFECT_FREQUENCY_SHIFTER, AL_EFFECT_VOCAL_MORPHER,
|
||||
AL_EFFECT_PITCH_SHIFTER, AL_EFFECT_RING_MODULATOR,
|
||||
AL_EFFECT_AUTOWAH, AL_EFFECT_COMPRESSOR, AL_EFFECT_EQUALIZER,
|
||||
AL_EFFECT_NULL
|
||||
};
|
||||
static const ALint dedeffects[] = {
|
||||
AL_EFFECT_DEDICATED_DIALOGUE, AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT,
|
||||
AL_EFFECT_NULL
|
||||
};
|
||||
char effectNames[] = "EAX Reverb,Reverb,Chorus,Distortion,Echo,Flanger,"
|
||||
"Frequency Shifter,Vocal Morpher,Pitch Shifter,Ring Modulator,Autowah,"
|
||||
"Compressor,Equalizer,Dedicated Dialog,Dedicated LFE,";
|
||||
|
||||
ALCint major, minor, sends;
|
||||
ALuint obj;
|
||||
|
||||
char* current;
|
||||
U32 i;
|
||||
|
||||
if (mOpenAL.alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_FALSE)
|
||||
{
|
||||
Con::printf("SFXALDevice - EFX Not available.");
|
||||
return;
|
||||
}
|
||||
|
||||
mOpenAL.alcGetIntegerv(device, ALC_EFX_MAJOR_VERSION, 1, &major);
|
||||
mOpenAL.alcGetIntegerv(device, ALC_EFX_MINOR_VERSION, 1, &minor);
|
||||
U32 err = mOpenAL.alcGetError(device);
|
||||
if (err != ALC_NO_ERROR)
|
||||
Con::errorf("SFXALDevice - Error Retrieving EFX Version: %s", mOpenAL.alcGetString(device, err));
|
||||
else
|
||||
{
|
||||
Con::printf("| EFX Version: %d.%d", major, minor);
|
||||
}
|
||||
|
||||
mOpenAL.alcGetIntegerv(device, ALC_MAX_AUXILIARY_SENDS, 1, &sends);
|
||||
err = mOpenAL.alcGetError(device);
|
||||
if (err != ALC_NO_ERROR)
|
||||
Con::errorf("SFXALDevice - Error Retrieving Auxiliary Sends: %s", mOpenAL.alcGetString(device, err));
|
||||
else
|
||||
{
|
||||
Con::printf("| Max Aux Sends: %d", sends);
|
||||
}
|
||||
|
||||
mOpenAL.alGenFilters(1, &obj);
|
||||
err = mOpenAL.alcGetError(device);
|
||||
if (err != ALC_NO_ERROR)
|
||||
Con::errorf("SFXALDevice - Error Generating filter: %s", mOpenAL.alcGetString(device, err));
|
||||
|
||||
current = filterNames;
|
||||
for (i = 0; filters[i] != AL_FILTER_NULL; i++)
|
||||
{
|
||||
char* next = dStrchr(current, ',');
|
||||
|
||||
mOpenAL.alFilteri(obj, AL_FILTER_TYPE, filters[i]);
|
||||
if (mOpenAL.alGetError() != AL_NO_ERROR)
|
||||
dMemmove(current, next + 1, strlen(next));
|
||||
else
|
||||
current = next + 1;
|
||||
}
|
||||
|
||||
Con::printf("| Supported Filters: %s", filterNames);
|
||||
|
||||
mOpenAL.alDeleteFilters(1, &obj);
|
||||
|
||||
mOpenAL.alGenEffects(1, &obj);
|
||||
err = mOpenAL.alcGetError(device);
|
||||
if (err != ALC_NO_ERROR)
|
||||
Con::errorf("SFXALDevice - Error Generating effects: %s", mOpenAL.alcGetString(device, err));
|
||||
|
||||
current = effectNames;
|
||||
for (i = 0; effects[i] != AL_EFFECT_NULL; i++)
|
||||
{
|
||||
char* next = dStrchr(current, ',');
|
||||
mOpenAL.alEffecti(obj, AL_FILTER_TYPE, effects[i]);
|
||||
if (mOpenAL.alGetError() != AL_NO_ERROR)
|
||||
dMemmove(current, next + 1, strlen(next));
|
||||
else
|
||||
current = next + 1;
|
||||
}
|
||||
|
||||
if (mOpenAL.alcIsExtensionPresent(device, "ALC_EXT_DEDICATED"))
|
||||
{
|
||||
for (i = 0; dedeffects[i] != AL_EFFECT_NULL; i++)
|
||||
{
|
||||
char* next = dStrchr(current, ',');
|
||||
mOpenAL.alEffecti(obj, AL_FILTER_TYPE, dedeffects[i]);
|
||||
if (mOpenAL.alGetError() != AL_NO_ERROR)
|
||||
dMemmove(current, next + 1, strlen(next));
|
||||
else
|
||||
current = next + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; dedeffects[i] != AL_EFFECT_NULL; i++)
|
||||
{
|
||||
char* next = dStrchr(current, ',');
|
||||
dMemmove(current, next + 1, strlen(next));
|
||||
}
|
||||
}
|
||||
|
||||
Con::printf("| Supported Effects: %s", effectNames);
|
||||
|
||||
mOpenAL.alDeleteEffects(1, &obj);
|
||||
}
|
||||
|
||||
S32 SFXALDevice::getMaxSources()
|
||||
{
|
||||
// Clear AL Error Code
|
||||
mOpenAL.alGetError();
|
||||
|
||||
|
||||
ALCint nummono;
|
||||
mOpenAL.alcGetIntegerv(mDevice, ALC_MONO_SOURCES, 1, &nummono);
|
||||
|
||||
|
||||
if(nummono == 0)
|
||||
nummono = getMaxSourcesOld();
|
||||
|
||||
return nummono;
|
||||
}
|
||||
|
||||
S32 SFXALDevice::getMaxSourcesOld()
|
||||
{
|
||||
ALuint uiSource[256];
|
||||
S32 sourceCount = 0;
|
||||
|
||||
// clear errors.
|
||||
mOpenAL.alGetError();
|
||||
|
||||
for(sourceCount = 0; sourceCount < 256; sourceCount++)
|
||||
{
|
||||
mOpenAL.alGenSources(1,&uiSource[sourceCount]);
|
||||
if(mOpenAL.alGetError() != AL_NO_ERROR)
|
||||
break;
|
||||
}
|
||||
|
||||
mOpenAL.alDeleteSources(sourceCount, uiSource);
|
||||
if(mOpenAL.alGetError() != AL_NO_ERROR)
|
||||
{
|
||||
for(U32 i = 0; i < 256; i++)
|
||||
{
|
||||
mOpenAL.alDeleteSources(1,&uiSource[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return sourceCount;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
SFXALDevice::SFXALDevice( SFXProvider *provider,
|
||||
|
|
@ -292,8 +175,7 @@ SFXALDevice::SFXALDevice( SFXProvider *provider,
|
|||
#endif
|
||||
|
||||
printALInfo(mDevice);
|
||||
printHRTFInfo(mDevice);
|
||||
getEFXInfo(mDevice);
|
||||
|
||||
|
||||
mMaxBuffers = getMaxSources();
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ class SFXALDevice : public SFXDevice
|
|||
void printHRTFInfo(ALCdevice* device);
|
||||
void getEFXInfo(ALCdevice* device);
|
||||
S32 getMaxSources();
|
||||
|
||||
// Compatibility with pre openal 1.2
|
||||
S32 getMaxSourcesOld();
|
||||
|
||||
SFXALDevice( SFXProvider *provider,
|
||||
const OPENALFNTABLE &openal,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue