Author Topic: Playing a loaded sound resource globally with no position or orientation  (Read 29 times)

Offline Vulpovile

  • bit
  • Posts: 3
    • View Profile
So I am a bit lost trying to play a sound without it playing at an angle. It's just supposed to play through both speakers equally at once since it's steps coming from the player themselves, but it seems to play at some weird angle
When it is from the player themselves, entity is null. That is the situation i'm having issues with
This is what I have:

Code: newbielink:javascript:void(0); [nonactive]
public void playSound(Entity entity, String soundId, float pitch) {
if(settings.soundEnabled)
{
if(soundSystem.playing(soundId))
soundSystem.stop(soundId);
tick();
if(entity != null)
{
soundSystem.setPosition(soundId, entity.x, entity.y, entity.z);
soundSystem.setPitch(soundId, currentPitch);
soundSystem.setVolume(soundId, 1F);
soundSystem.setDistOrRoll(soundId, 16F);
soundSystem.setAttenuation(soundId, SoundSystemConfig.ATTENUATION_LINEAR);
soundSystem.play(soundId);
}
else
{
                                //My problem is here
soundSystem.setPitch(soundId, currentPitch);
soundSystem.setVolume(soundId, 1F);
soundSystem.setDistOrRoll(soundId, 0);
soundSystem.setAttenuation(soundId, SoundSystemConfig.ATTENUATION_NONE);
soundSystem.play(soundId);
}
}
}

Any suggestions?
« Last Edit: November 10, 2020, 12:47:10 AM by Vulpovile »