本文整理匯總了Java中org.lwjgl.openal.AL10.alGetSourcei方法的典型用法代碼示例。如果您正苦於以下問題:Java AL10.alGetSourcei方法的具體用法?Java AL10.alGetSourcei怎麽用?Java AL10.alGetSourcei使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.lwjgl.openal.AL10
的用法示例。
在下文中一共展示了AL10.alGetSourcei方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: cleanUpSource
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Clean up the buffers applied to the sound source
*/
private void cleanUpSource() {
SoundStore store = SoundStore.get();
AL10.alSourceStop(store.getSource(0));
IntBuffer buffer = BufferUtils.createIntBuffer(1);
int queued = AL10.alGetSourcei(store.getSource(0), AL10.AL_BUFFERS_QUEUED);
while (queued > 0)
{
AL10.alSourceUnqueueBuffers(store.getSource(0), buffer);
queued--;
}
AL10.alSourcei(store.getSource(0), AL10.AL_BUFFER, 0);
}
示例2: update
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
public synchronized void update() {
if (sourceID == -1) return;
boolean end = false;
int buffers = AL10.alGetSourcei(sourceID, AL10.AL_BUFFERS_PROCESSED);
while (buffers-- > 0) {
int bufferID = AL10.alSourceUnqueueBuffers(sourceID);
if (bufferID == AL10.AL_INVALID_VALUE) break;
renderedSeconds += secondsPerBuffer;
if (end) continue;
if (fill(bufferID)) {
AL10.alSourceQueueBuffers(sourceID, bufferID);
} else {
end = true;
}
}
if (end && AL10.alGetSourcei(sourceID, AL10.AL_BUFFERS_QUEUED) == 0) {
stop();
}
if (isPlaying && AL10.alGetSourcei(sourceID, AL10.AL_SOURCE_STATE) != AL10.AL_PLAYING)
AL10.alSourcePlay(sourceID);
}
示例3: cleanUpSource
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Clean up the buffers applied to the sound source
*/
private void cleanUpSource()
{
AL10.alSourceStop(store.getSource(0));
IntBuffer buffer = BufferUtils.createIntBuffer(1);
int queued = AL10.alGetSourcei(store.getSource(0), AL10.AL_BUFFERS_QUEUED);
while (queued > 0)
{
AL10.alSourceUnqueueBuffers(store.getSource(0), buffer);
queued--;
}
AL10.alSourcei(store.getSource(0), AL10.AL_BUFFER, 0);
}
示例4: findFreeSource
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Find a free sound source
*
* @return The index of the free sound source
*/
private int findFreeSource() {
for (int i=1;i<sourceCount-1;i++) {
int state = AL10.alGetSourcei(sources.get(i), AL10.AL_SOURCE_STATE);
if ((state != AL10.AL_PLAYING) && (state != AL10.AL_PAUSED)) {
return i;
}
}
return -1;
}
示例5: isMusicPlaying
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Check if the music is currently playing
*
* @return True if the music is playing
*/
public boolean isMusicPlaying()
{
if (!soundWorks) {
return false;
}
int state = AL10.alGetSourcei(sources.get(0), AL10.AL_SOURCE_STATE);
return ((state == AL10.AL_PLAYING) || (state == AL10.AL_PAUSED));
}
示例6: cleanUpSource
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Clean up the buffers applied to the sound source
*/
private void cleanUpSource() {
AL10.alSourceStop(store.getSource(0));
IntBuffer buffer = BufferUtils.createIntBuffer(1);
int queued = AL10.alGetSourcei(store.getSource(0), AL10.AL_BUFFERS_QUEUED);
while (queued > 0)
{
AL10.alSourceUnqueueBuffers(store.getSource(0), buffer);
queued--;
}
AL10.alSourcei(store.getSource(0), AL10.AL_BUFFER, 0);
}
示例7: update
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Poll the bufferNames - check if we need to fill the bufferNames with another
* section.
*
* Most of the time this should be reasonably quick
*/
public void update() {
if (done) {
return;
}
int processed = AL10.alGetSourcei(source, AL10.AL_BUFFERS_PROCESSED);
while (processed > 0) {
unqueued.clear();
AL10.alSourceUnqueueBuffers(source, unqueued);
if (stream(unqueued.get(0))) {
AL10.alSourceQueueBuffers(source, unqueued);
} else {
remainingBufferCount--;
if (remainingBufferCount == 0) {
done = true;
}
}
processed--;
}
int state = AL10.alGetSourcei(source, AL10.AL_SOURCE_STATE);
if (state != AL10.AL_PLAYING) {
AL10.alSourcePlay(source);
}
}
示例8: findFreeSource
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Find a free sound source
*
* @return The index of the free sound source
*/
private int findFreeSource()
{
for (int i = 1; i < sourceCount - 1; i++)
{
int state = AL10.alGetSourcei(sources.get(i), AL10.AL_SOURCE_STATE);
if (state != AL10.AL_PLAYING)
{
return i;
}
}
return -1;
}
示例9: freeBuffer
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
public void freeBuffer(int bufferID) {
if (AL.isCreated()) {
for (int i = 0, n = idleSources.size; i < n; i++) {
int sourceID = idleSources.get(i);
if (AL10.alGetSourcei(sourceID, AL10.AL_BUFFER) == bufferID) {
if (sourceToSoundId.containsKey(sourceID)) {
long soundId = sourceToSoundId.remove(sourceID);
soundIdToSource.remove(soundId);
}
AL10.alSourceStop(sourceID);
AL10.alSourcei(sourceID, AL10.AL_BUFFER, 0);
}
}
}
}
示例10: QueueSound
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
private void QueueSound(int sound)
{
if (game.gameOptions.soundEnable == false)
return;
intBuffer.clear();
intBuffer.put(sounds[sound]);
intBuffer.flip();
AL10.alSourceQueueBuffers(sources.get(0), intBuffer);
int state = AL10.alGetSourcei(sources.get(0), AL10.AL_SOURCE_STATE);
if (state != AL10.AL_PLAYING)
{
sourcePos.clear();
sourcePos.put(0).put(0).put(0);
sourcePos.flip();
int Source = sources.get(0);
AL10.alSourceStop(Source);
AL10.alSourcef(Source, AL10.AL_PITCH, 1.0f);
AL10.alSourcef(Source, AL10.AL_GAIN, 1.0f);
AL10.alSource(Source, AL10.AL_POSITION, sourcePos);
AL10.alSourcePlay(Source);
}
}
示例11: update
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
public boolean update(int source, boolean loop){
if(dead)
return false;
int processed = AL10.alGetSourcei(source, AL10.AL_BUFFERS_PROCESSED);
for(int i=0;i<processed;i++){
int buffer = AL10.alSourceUnqueueBuffers(source);
if(!stream(buffer)){
boolean close = true;
if(loop){
rewind();
close = !stream(buffer);
}
if(close)
return false;
}
AL10.alSourceQueueBuffers(source, buffer);
}
if(processed == buffers.limit()){
AL10.alSourcePlay(source);
}
return true;
}
示例12: stopSourcesWithBuffer
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
public void stopSourcesWithBuffer(int bufferID) {
if (AL.isCreated()) {
for (int i = 0, n = idleSources.size; i < n; i++) {
int sourceID = idleSources.get(i);
if (AL10.alGetSourcei(sourceID, AL10.AL_BUFFER) == bufferID) {
if (sourceToSoundId.containsKey(sourceID)) {
long soundId = sourceToSoundId.remove(sourceID);
soundIdToSource.remove(soundId);
}
AL10.alSourceStop(sourceID);
}
}
}
}
示例13: update
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Poll the bufferNames - check if we need to fill the bufferNames with another
* section.
*
* Most of the time this should be reasonably quick
*/
public void update() {
if (done) {
return;
}
float sampleRate = audio.getRate();
float sampleSize;
if (audio.getChannels() > 1) {
sampleSize = 4; // AL10.AL_FORMAT_STEREO16
} else {
sampleSize = 2; // AL10.AL_FORMAT_MONO16
}
int processed = AL10.alGetSourcei(source, AL10.AL_BUFFERS_PROCESSED);
while (processed > 0) {
unqueued.clear();
AL10.alSourceUnqueueBuffers(source, unqueued);
int bufferIndex = unqueued.get(0);
float bufferLength = (AL10.alGetBufferi(bufferIndex, AL10.AL_SIZE) / sampleSize) / sampleRate;
positionOffset += bufferLength;
if (stream(bufferIndex)) {
AL10.alSourceQueueBuffers(source, unqueued);
} else {
remainingBufferCount--;
if (remainingBufferCount == 0) {
done = true;
}
}
processed--;
}
int state = AL10.alGetSourcei(source, AL10.AL_SOURCE_STATE);
if (state != AL10.AL_PLAYING) {
AL10.alSourcePlay(source);
}
}
示例14: update
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
public void update(){
int state = AL10.alGetSourcei(id, AL10.AL_SOURCE_STATE);
if(state != AL10.AL_PLAYING && state != AL10.AL_PAUSED)
stop();
}
示例15: isPlaying
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Check if a particular source is playing
*
* @param index The index of the source to check
* @return True if the source is playing
*/
boolean isPlaying(int index) {
int state = AL10.alGetSourcei(sources.get(index), AL10.AL_SOURCE_STATE);
return (state == AL10.AL_PLAYING);
}