Search in sources :

Example 1 with SoundEffectNotFoundException

use of io.xol.chunkstories.api.exceptions.SoundEffectNotFoundException in project chunkstories by Hugobros3.

the class ALSoundManager method playSoundEffect.

@Override
public SoundSource playSoundEffect(String soundEffect, Mode mode, Vector3dc position, float pitch, float gain, float attStart, float attEnd) {
    try {
        ALSoundSource ss;
        if (mode == Mode.STREAMED)
            ss = new ALBufferedSoundSource(soundEffect, position, pitch, gain, attStart, attEnd);
        else
            ss = new ALSoundSource(soundEffect, mode, position, pitch, gain, attStart, attEnd);
        addSoundSource(ss);
        return ss;
    } catch (SoundEffectNotFoundException e) {
        logger.warn("Sound not found " + soundEffect);
    }
    return new DummySoundSource();
}
Also used : DummySoundSource(io.xol.chunkstories.sound.source.DummySoundSource) ALSoundSource(io.xol.chunkstories.sound.source.ALSoundSource) SoundEffectNotFoundException(io.xol.chunkstories.api.exceptions.SoundEffectNotFoundException) ALBufferedSoundSource(io.xol.chunkstories.sound.source.ALBufferedSoundSource)

Example 2 with SoundEffectNotFoundException

use of io.xol.chunkstories.api.exceptions.SoundEffectNotFoundException in project chunkstories by Hugobros3.

the class ALSoundManager method replicateServerSoundSource.

@Override
public SoundSource replicateServerSoundSource(String soundName, Mode mode, Vector3dc position, float pitch, float gain, float attenuationStart, float attenuationEnd, long UUID) {
    try {
        ALSoundSource soundSource = null;
        if (mode == Mode.STREAMED)
            soundSource = new ALBufferedSoundSource(soundName, position, pitch, gain, attenuationStart, attenuationEnd);
        else
            soundSource = new ALSoundSource(soundName, mode, position, pitch, gain, attenuationStart, attenuationEnd);
        // Match the UUIDs
        soundSource.setUUID(UUID);
        addSoundSource(soundSource);
        return soundSource;
    } catch (SoundEffectNotFoundException e) {
        logger.warn("Sound not found " + soundName);
        return null;
    }
}
Also used : ALSoundSource(io.xol.chunkstories.sound.source.ALSoundSource) SoundEffectNotFoundException(io.xol.chunkstories.api.exceptions.SoundEffectNotFoundException) ALBufferedSoundSource(io.xol.chunkstories.sound.source.ALBufferedSoundSource)

Aggregations

SoundEffectNotFoundException (io.xol.chunkstories.api.exceptions.SoundEffectNotFoundException)2 ALBufferedSoundSource (io.xol.chunkstories.sound.source.ALBufferedSoundSource)2 ALSoundSource (io.xol.chunkstories.sound.source.ALSoundSource)2 DummySoundSource (io.xol.chunkstories.sound.source.DummySoundSource)1