MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / Sound_UpdateEffectPosition

Function Sound_UpdateEffectPosition

TombEngine/Sound/sound.cpp:875–902  ·  view source on GitHub ↗

Update sound position in a level.

Source from the content-addressed store, hash-verified

873
874// Update sound position in a level.
875bool Sound_UpdateEffectPosition(int index, Pose *position, bool force)
876{
877 if (index >= SOUND_MAX_CHANNELS || index < 0)
878 return false;
879
880 if (position)
881 {
882 BASS_CHANNELINFO info;
883 BASS_ChannelGetInfo(SoundSlot[index].Channel, &info);
884 if (info.flags & BASS_SAMPLE_3D)
885 {
886 SoundSlot[index].Origin.x = position->Position.x;
887 SoundSlot[index].Origin.y = position->Position.y;
888 SoundSlot[index].Origin.z = position->Position.z;
889
890 auto pos = BASS_3DVECTOR(position->Position.x, position->Position.y, position->Position.z);
891 auto rot = BASS_3DVECTOR(position->Orientation.x, position->Orientation.y, position->Orientation.z);
892 BASS_ChannelSet3DPosition(SoundSlot[index].Channel, &pos, &rot, NULL);
893 BASS_Apply3D();
894 }
895 }
896
897 // Reset activity flag, important for looped samples
898 if (BASS_ChannelIsActive(SoundSlot[index].Channel))
899 SoundSlot[index].State = SoundState::Idle;
900
901 return true;
902}
903
904// Update gain and pitch.
905bool Sound_UpdateEffectAttributes(int index, float pitch, float gain)

Callers 1

SoundEffectFunction · 0.85

Calls 1

BASS_3DVECTORClass · 0.85

Tested by

no test coverage detected