mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
SFX API Changes
DSound has since been deprecated and xaudio2 would require us to write our own 3d spatialization and mixer Load devices the same way we load in the gfx end setup sfx provider run sfx devices on startup various fixes around sfx null device added the bitrate and samplerate globals added the hrtf global code is in to use this but not setup yet Adds speed of sound to the sound system SFXAmbience now has a property for speed of sound for different mediums, can also be set directly
This commit is contained in:
parent
54b6c3ec47
commit
d56bf257c7
53 changed files with 1870 additions and 6401 deletions
|
|
@ -23,102 +23,44 @@
|
|||
#ifndef _SFXPROVIDER_H_
|
||||
#define _SFXPROVIDER_H_
|
||||
|
||||
#ifndef _TVECTOR_H_
|
||||
#include "core/util/tVector.h"
|
||||
#ifndef _SFXCOMMON_H_
|
||||
#include "sfx/sfxCommon.h"
|
||||
#endif
|
||||
|
||||
#ifndef _TVECTOR_H_
|
||||
#include "core/util/tVector.h"
|
||||
#endif
|
||||
|
||||
#ifndef _UTIL_DELEGATE_H_
|
||||
#include "core/util/delegate.h"
|
||||
#endif
|
||||
|
||||
class SFXDevice;
|
||||
|
||||
|
||||
|
||||
struct SFXDeviceInfo
|
||||
struct SFXProvider
|
||||
{
|
||||
String driver;
|
||||
String internalName;
|
||||
String name;
|
||||
bool hasHardware = false;
|
||||
S32 maxBuffers =0;
|
||||
public:
|
||||
typedef Delegate<SFXDevice* (U32 providerIndex)> CreateProviderInstanceDelegate;
|
||||
|
||||
virtual ~SFXDeviceInfo() {}
|
||||
};
|
||||
String mName;
|
||||
bool mHasHardware;
|
||||
SFXProviderType mType;
|
||||
SFXDeviceType mDeviceType;
|
||||
U32 mIndex;
|
||||
bool mDefault;
|
||||
CreateProviderInstanceDelegate mCreateDeviceInstanceDelegate;
|
||||
|
||||
typedef Vector<SFXDeviceInfo*> SFXDeviceInfoVector;
|
||||
|
||||
class SFXProvider
|
||||
{
|
||||
friend class SFXSystem;
|
||||
|
||||
private:
|
||||
|
||||
/// The head of the linked list of avalible providers.
|
||||
static SFXProvider* smProviders;
|
||||
|
||||
/// The next provider in the linked list of available providers.
|
||||
SFXProvider* mNextProvider;
|
||||
|
||||
/// The provider name which is passed by the concrete provider
|
||||
/// class to the SFXProvider constructor.
|
||||
String mName;
|
||||
|
||||
static Vector<SFXProvider*> sAllProviders;
|
||||
|
||||
protected:
|
||||
|
||||
/// The array of avaIlable devices from this provider. The
|
||||
/// concrete provider class will fill this on construction.
|
||||
SFXDeviceInfoVector mDeviceInfo;
|
||||
|
||||
/// This registers the provider to the available provider list. It should be called
|
||||
/// for providers that are properly initialized and available for device enumeration and creation.
|
||||
/// the add and registration process is 2 steps to avoid issues when TGEA is used as a shared library (specifically on Windows)
|
||||
static void regProvider( SFXProvider* provider );
|
||||
|
||||
virtual void init() = 0;
|
||||
|
||||
SFXProvider( const String& name );
|
||||
~SFXProvider();
|
||||
|
||||
/// Look up the SFXDeviceInfo for the given device in mDeviceInfo.
|
||||
/// Return default device (first in list) if no other device matches (or null if device list is empty).
|
||||
SFXDeviceInfo* _findDeviceInfo( const String& deviceName );
|
||||
|
||||
/// This is called from SFXSystem to create a new device. Must be implemented
|
||||
/// by all contrete provider classes.
|
||||
///
|
||||
/// @param deviceName The case sensitive name of the device or NULL to create the
|
||||
// default device.
|
||||
/// @param useHardware Toggles the use of hardware processing when available.
|
||||
/// @param maxBuffers The maximum buffers for this device to use or -1
|
||||
/// for the device to pick a reasonable default for that device.
|
||||
///
|
||||
/// @return Returns the created device or NULL for failure.
|
||||
///
|
||||
virtual SFXDevice* createDevice( const String& deviceName, bool useHardware, S32 maxBuffers ) = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// Returns a specific provider by searching the provider list
|
||||
/// for the first provider with the case sensitive name.
|
||||
static SFXProvider* findProvider( String providerName );
|
||||
|
||||
/// Returns the first provider in the provider list. Use
|
||||
/// getNextProvider() to iterate over list.
|
||||
static SFXProvider* getFirstProvider() { return smProviders; }
|
||||
|
||||
/// Returns the next provider in the provider list or NULL
|
||||
/// when the end of the list is reached.
|
||||
SFXProvider* getNextProvider() const { return mNextProvider; }
|
||||
|
||||
/// The case sensitive name of this provider.
|
||||
const String& getName() const { return mName; }
|
||||
|
||||
/// Returns a read only vector with device information for
|
||||
/// all creatable devices available from this provider.
|
||||
const SFXDeviceInfoVector& getDeviceInfo() const { return mDeviceInfo; }
|
||||
|
||||
static void initializeAllProviders();
|
||||
const char* getName() const { return mName; }
|
||||
|
||||
SFXProvider()
|
||||
{
|
||||
mName = String::EmptyString;
|
||||
mHasHardware = false;
|
||||
mType = NullProvider;
|
||||
mIndex = 0;
|
||||
mDefault = false;
|
||||
mDeviceType = Output;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue