mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-11 16:59:53 +00:00
Implemenet proper positional audio, one issue still.
With this patch, entities can serve as a sound source whose position updates relative to the listener. This implements the last missing feature of my previous positional audio patch, which is moving sound sources. Previously, all sounds were relative to the listener with the listener centered at (0, 0, 0), and once a sound started playing, the position could not be changed. Volume was set as an estimation of the distance to the listener. These restrictions are now gone; OpenAL will handle the volume & panning based on the distance. The remaining problem is that stereo sounds are not attenuated, at all. Lua additions: - playSfx() takes an additional parameter now. - entity_setStopSoundsOnDeath()
This commit is contained in:
parent
49b6234ac8
commit
e6680da428
12 changed files with 435 additions and 174 deletions
|
@ -60,6 +60,24 @@ typedef enum
|
|||
FMOD_DSP_TYPE_REVERB,
|
||||
} FMOD_DSP_TYPE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FMOD_CHANNEL_CALLBACKTYPE_END, /* Called when a sound ends. */
|
||||
FMOD_CHANNEL_CALLBACKTYPE_VIRTUALVOICE, /* Called when a voice is swapped out or swapped in. */
|
||||
FMOD_CHANNEL_CALLBACKTYPE_SYNCPOINT, /* Called when a syncpoint is encountered. Can be from wav file markers. */
|
||||
FMOD_CHANNEL_CALLBACKTYPE_OCCLUSION, /* Called when the channel has its geometry occlusion value calculated. Can be used to clamp or change the value. */
|
||||
|
||||
FMOD_CHANNEL_CALLBACKTYPE_MAX, /* Maximum number of callback types supported. */
|
||||
FMOD_CHANNEL_CALLBACKTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */
|
||||
} FMOD_CHANNEL_CALLBACKTYPE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float x; /* X co-ordinate in 3D space. */
|
||||
float y; /* Y co-ordinate in 3D space. */
|
||||
float z; /* Z co-ordinate in 3D space. */
|
||||
} FMOD_VECTOR;
|
||||
|
||||
#define F_CALLBACK
|
||||
|
||||
typedef int FMOD_CAPS;
|
||||
|
@ -77,8 +95,13 @@ typedef int FMOD_MODE;
|
|||
#define FMOD_LOOP_OFF (1<<4)
|
||||
#define FMOD_LOOP_NORMAL (1<<5)
|
||||
#define FMOD_LOWMEM (1<<6)
|
||||
#define FMOD_3D (1<<7)
|
||||
#define FMOD_3D_HEADRELATIVE (1<<8)
|
||||
#define FMOD_3D_WORLDRELATIVE (1<<9)
|
||||
#define FMOD_3D_LINEARROLLOFF (1<<10)
|
||||
#define FMOD_DEFAULT (FMOD_2D | FMOD_HARDWARE)
|
||||
|
||||
|
||||
typedef int FMOD_CREATESOUNDEXINFO;
|
||||
|
||||
#define FMOD_INIT_NORMAL 0
|
||||
|
@ -92,6 +115,8 @@ typedef FMOD_RESULT (*FMOD_FILE_CLOSECALLBACK)(void *,void *);
|
|||
typedef FMOD_RESULT (*FMOD_FILE_READCALLBACK)(void *,void *,unsigned int,unsigned int *,void *);
|
||||
typedef FMOD_RESULT (*FMOD_FILE_SEEKCALLBACK)(void *,unsigned int,void *);
|
||||
|
||||
typedef FMOD_RESULT (*FMOD_CHANNEL_CALLBACK)(void *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *commanddata1, void *commanddata2);
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -146,6 +171,13 @@ namespace FMOD
|
|||
FMOD_RESULT stop();
|
||||
FMOD_RESULT setPaused(bool paused);
|
||||
FMOD_RESULT setPan(float pan);
|
||||
FMOD_RESULT setCallback(FMOD_CHANNEL_CALLBACK callback);
|
||||
FMOD_RESULT getUserData(void **userdata);
|
||||
FMOD_RESULT setUserData(void *userdata);
|
||||
FMOD_RESULT set3DAttributes(const FMOD_VECTOR *pos, const FMOD_VECTOR *vel);
|
||||
FMOD_RESULT set3DMinMaxDistance(float mindistance, float maxdistance);
|
||||
FMOD_RESULT setMode(FMOD_MODE mode);
|
||||
FMOD_RESULT getMode(FMOD_MODE *mode);
|
||||
};
|
||||
|
||||
class System
|
||||
|
@ -165,6 +197,7 @@ namespace FMOD
|
|||
FMOD_RESULT setFileSystem(FMOD_FILE_OPENCALLBACK useropen, FMOD_FILE_CLOSECALLBACK userclose, FMOD_FILE_READCALLBACK userread, FMOD_FILE_SEEKCALLBACK userseek, int blockalign);
|
||||
FMOD_RESULT setSpeakerMode(FMOD_SPEAKERMODE speakermode);
|
||||
FMOD_RESULT update();
|
||||
FMOD_RESULT set3DListenerAttributes(int listener, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel, const FMOD_VECTOR *forward, const FMOD_VECTOR *up);
|
||||
|
||||
// BBGE-specific...
|
||||
FMOD_RESULT getNumChannels(int *maxchannels_ret);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue