Added is playing method
This commit is contained in:
parent
938c098161
commit
4f2ed0cb0d
2 changed files with 21 additions and 0 deletions
|
|
@ -2,6 +2,8 @@ package ei.engine.sound;
|
||||||
|
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
|
import org.lwjgl.openal.AL10;
|
||||||
|
|
||||||
import ei.engine.math.Vector3f;
|
import ei.engine.math.Vector3f;
|
||||||
import ei.engine.scene.Entity;
|
import ei.engine.scene.Entity;
|
||||||
import ei.engine.texture.Texture;
|
import ei.engine.texture.Texture;
|
||||||
|
|
@ -108,5 +110,12 @@ public class Sound extends Entity{
|
||||||
public Texture getTexture() {
|
public Texture getTexture() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPlaying(){
|
||||||
|
if(SoundManager.getInstnace().getSoundState(this) == AL10.AL_PLAYING){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,18 @@ public class SoundManager {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the state of the sound class
|
||||||
|
* @param sound The sound to get state of
|
||||||
|
* @return The state of the sound
|
||||||
|
*/
|
||||||
|
public int getSoundState(Sound sound){
|
||||||
|
if(sound.getSourceId() >= 0 && sources.get(sound.getSourceId()).soundId == sound.getSoundId()){
|
||||||
|
AL10.alGetSourcei(sources.get(sound.getSourceId()).source, AL10.AL_SOURCE_STATE);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops playing a sound
|
* Stops playing a sound
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue