add spatial distance scaler to init
parent
4fceb026da
commit
a8993eb776
|
@ -132,8 +132,8 @@ typedef struct FAudioGMS_SoundInstance
|
|||
} parent;
|
||||
} FAudioGMS_SoundInstance;
|
||||
|
||||
static const float SPEED_OF_SOUND = 343.5f;
|
||||
static const float DOPPLER_SCALE = 1.0f;
|
||||
static const float CURVE_DISTANCE_SCALER = 1.0f;
|
||||
|
||||
typedef struct FAudioGMS_Device
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ typedef struct FAudioGMS_Device
|
|||
FAudioMasteringVoice *masteringVoice;
|
||||
|
||||
F3DAUDIO_LISTENER listener;
|
||||
float speedOfSound;
|
||||
float spatialDistanceScale;
|
||||
|
||||
FAudioGMS_StaticSound **staticSounds;
|
||||
uint32_t staticSoundCount;
|
||||
|
@ -183,7 +183,7 @@ static inline FAudioGMS_SoundInstance* FAudioGMS_INTERNAL_LookupSoundInstance(ui
|
|||
}
|
||||
}
|
||||
|
||||
void FAudioGMS_Init(double speedOfSound)
|
||||
void FAudioGMS_Init(double spatialDistanceScale)
|
||||
{
|
||||
device = SDL_malloc(sizeof(FAudioGMS_Device));
|
||||
|
||||
|
@ -256,11 +256,11 @@ void FAudioGMS_Init(double speedOfSound)
|
|||
return;
|
||||
}
|
||||
|
||||
device->speedOfSound = speedOfSound;
|
||||
device->spatialDistanceScale = spatialDistanceScale;
|
||||
|
||||
F3DAudioInitialize(
|
||||
device->deviceDetails.OutputFormat.dwChannelMask,
|
||||
device->speedOfSound,
|
||||
SPEED_OF_SOUND,
|
||||
device->handle3D
|
||||
);
|
||||
|
||||
|
@ -781,7 +781,7 @@ static void FAudioGMS_INTERNAL_StaticSound_AddEmitter(FAudioGMS_SoundInstance* i
|
|||
instance->emitter->InnerRadiusAngle = 0;
|
||||
|
||||
instance->emitter->ChannelCount = instance->dspSettings.SrcChannelCount;
|
||||
instance->emitter->CurveDistanceScaler = CURVE_DISTANCE_SCALER;
|
||||
instance->emitter->CurveDistanceScaler = device->spatialDistanceScale;
|
||||
instance->emitter->DopplerScaler = 1.0f;
|
||||
|
||||
instance->emitter->Position.x = x;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
FAUDIOGMSAPI void FAudioGMS_Init(double speedOfSound); /* recommend about 1500? for 2D game */
|
||||
FAUDIOGMSAPI void FAudioGMS_Init(double spatialDistanceScale); /* recommend about 50 for a 2D game, 1 for a 3D game */
|
||||
|
||||
FAUDIOGMSAPI double FAudioGMS_StaticSound_LoadWAV(char *filePath); /* returns a static sound ID */
|
||||
FAUDIOGMSAPI void FAudioGMS_StaticSound_PlayOneOff(double staticSoundID, double pan, double pitch, double volume, double reverb); /* automatically frees itself when done! */
|
||||
|
|
Loading…
Reference in New Issue