Skip to content

Commit

Permalink
Doppler blending update
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranDMC committed Sep 21, 2024
1 parent 5386f25 commit 6ee8ee9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cleo_plugins/Audio/C3DAudioStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ void C3DAudioStream::UpdatePosition()
}
else // listener inside sound soruce, no lef-right panning or Doppler effects then
{
// blending curve
outsideness = max(2.0f * outsideness - 1.0f, 0.0f); // blending curve
auto fakeVel = velocity * outsideness + CSoundSystem::velocity * (1.0f - outsideness); // blend

// modify blending curve for stereo panning
outsideness = max(2.0f * outsideness - 1.0f, 0.0f);
outsideness *= outsideness;

auto fakePos = CSoundSystem::position + CSoundSystem::forward; // 1 meter in front of the listener, dead center
fakePos = position * outsideness + fakePos * (1.0f - outsideness); // blend

auto fakeVel = velocity * outsideness + CSoundSystem::velocity * (1.0f - outsideness); // blend

BASS_ChannelSet3DPosition(streamInternal,
&toBass(fakePos),
&toBass(direction),
Expand Down
2 changes: 2 additions & 0 deletions cleo_plugins/Audio/CAudioStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ void CAudioStream::ProcessTransitions(bool instant)

void CAudioStream::ApplyParams()
{
if (CSoundSystem::skipFrame) return;

// volume
float volume = CalculateVolume();
BASS_ChannelSetAttribute(streamInternal, BASS_ATTRIB_VOL, volume);
Expand Down

0 comments on commit 6ee8ee9

Please sign in to comment.