mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-05-02 02:23:56 +00:00
Fix animation audio playing ~1.5x too fast with 3D sound enabled
Camera animations compute high listener velocities via CalculateWorldVelocity, and miniaudio's default Doppler factor of 1.0 shifts the pitch/speed of all spatialized sounds accordingly. Disable Doppler on sounds created by the multiplayer AudioPlayer using a friend class to access LegoCacheSound's private ma_sound handle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
08f44b9a93
commit
892fb808b6
@ -2,6 +2,7 @@
|
|||||||
#define LEGOCACHSOUND_H
|
#define LEGOCACHSOUND_H
|
||||||
|
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
|
#include "extensions/fwd.h"
|
||||||
#include "lego3dsound.h"
|
#include "lego3dsound.h"
|
||||||
#include "mxcore.h"
|
#include "mxcore.h"
|
||||||
#include "mxstring.h"
|
#include "mxstring.h"
|
||||||
@ -58,6 +59,8 @@ class LegoCacheSound : public MxCore {
|
|||||||
// LegoCacheSound::`scalar deleting destructor'
|
// LegoCacheSound::`scalar deleting destructor'
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class Multiplayer::Animation::AudioPlayer;
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void CopyData(MxU8* p_data, MxU32 p_dataSize);
|
void CopyData(MxU8* p_data, MxU32 p_dataSize);
|
||||||
MxString GetBaseFilename(MxString& p_path);
|
MxString GetBaseFilename(MxString& p_path);
|
||||||
|
|||||||
@ -22,6 +22,7 @@ class NetworkManager;
|
|||||||
class WorldStateSync;
|
class WorldStateSync;
|
||||||
namespace Animation
|
namespace Animation
|
||||||
{
|
{
|
||||||
|
class AudioPlayer;
|
||||||
class Catalog;
|
class Catalog;
|
||||||
class Controller;
|
class Controller;
|
||||||
} // namespace Animation
|
} // namespace Animation
|
||||||
|
|||||||
@ -13,6 +13,11 @@ void AudioPlayer::Init(const std::vector<SceneAnimData::AudioTrack>& p_tracks)
|
|||||||
MxWavePresenter::WaveFormat format = audioTrack.format;
|
MxWavePresenter::WaveFormat format = audioTrack.format;
|
||||||
if (sound->Create(format, mediaSrcPath, audioTrack.volume, audioTrack.pcmData, audioTrack.pcmDataSize) ==
|
if (sound->Create(format, mediaSrcPath, audioTrack.volume, audioTrack.pcmData, audioTrack.pcmDataSize) ==
|
||||||
SUCCESS) {
|
SUCCESS) {
|
||||||
|
// Disable Doppler on extension-created sounds. Camera animations drive high
|
||||||
|
// listener velocities via CalculateWorldVelocity, and miniaudio's default
|
||||||
|
// dopplerFactor of 1.0 shifts the pitch/speed of spatialized sounds.
|
||||||
|
ma_sound_set_doppler_factor(sound->m_cacheSound, 0);
|
||||||
|
|
||||||
ActiveSound active;
|
ActiveSound active;
|
||||||
active.sound = sound;
|
active.sound = sound;
|
||||||
active.timeOffset = audioTrack.timeOffset;
|
active.timeOffset = audioTrack.timeOffset;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user