本文整理匯總了Java中org.lwjgl.openal.AL10.alSourcei方法的典型用法代碼示例。如果您正苦於以下問題:Java AL10.alSourcei方法的具體用法?Java AL10.alSourcei怎麽用?Java AL10.alSourcei使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.lwjgl.openal.AL10
的用法示例。
在下文中一共展示了AL10.alSourcei方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: playAsMusic
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Play the specified buffer as music (i.e. use the music channel)
*
* @param buffer The buffer to be played
* @param pitch The pitch to play the music at
* @param gain The gaing to play the music at
* @param loop True if we should loop the music
*/
void playAsMusic(int buffer,float pitch,float gain, boolean loop) {
paused = false;
setMOD(null);
if (soundWorks) {
if (currentMusic != -1) {
AL10.alSourceStop(sources.get(0));
}
getMusicSource();
AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffer);
AL10.alSourcef(sources.get(0), AL10.AL_PITCH, pitch);
AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, loop ? AL10.AL_TRUE : AL10.AL_FALSE);
currentMusic = sources.get(0);
if (!music) {
pauseLoop();
} else {
AL10.alSourcePlay(sources.get(0));
}
}
}
示例2: 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);
}
示例3: playNewStream
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
@Override
public long playNewStream(double volume) {
int sourceID = audioFactory.obtainSource(false);
if (sourceID == -1) {
audioFactory.retain(this, true);
sourceID = audioFactory.obtainSource(false);
} else {
audioFactory.retain(this, false);
}
if (sourceID == -1) return -1;
long soundId = audioFactory.getSoundId(sourceID);
AL10.alSourcei(sourceID, AL10.AL_BUFFER, bufferID);
AL10.alSourcei(sourceID, AL10.AL_LOOPING, AL10.AL_FALSE);
AL10.alSourcef(sourceID, AL10.AL_GAIN, (float) volume);
AL10.alSourcePlay(sourceID);
return soundId;
}
示例4: setEnvironment
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
private static void setEnvironment(int sourceID, float sendGain0, float sendGain1, float sendGain2, float sendGain3, float sendCutoff0, float sendCutoff1,
float sendCutoff2, float sendCutoff3, float directCutoff, float directGain)
{
//Set reverb send filter values and set source to send to all reverb fx slots
EFX10.alFilterf(sendFilter0, EFX10.AL_LOWPASS_GAIN, sendGain0);
EFX10.alFilterf(sendFilter0, EFX10.AL_LOWPASS_GAINHF, sendCutoff0);
AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot0, 0, sendFilter0);
EFX10.alFilterf(sendFilter1, EFX10.AL_LOWPASS_GAIN, sendGain1);
EFX10.alFilterf(sendFilter1, EFX10.AL_LOWPASS_GAINHF, sendCutoff1);
AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot1, 1, sendFilter1);
EFX10.alFilterf(sendFilter2, EFX10.AL_LOWPASS_GAIN, sendGain2);
EFX10.alFilterf(sendFilter2, EFX10.AL_LOWPASS_GAINHF, sendCutoff2);
AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot2, 2, sendFilter2);
EFX10.alFilterf(sendFilter3, EFX10.AL_LOWPASS_GAIN, sendGain3);
EFX10.alFilterf(sendFilter3, EFX10.AL_LOWPASS_GAINHF, sendCutoff3);
AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot3, 3, sendFilter3);
EFX10.alFilterf(directFilter0, EFX10.AL_LOWPASS_GAIN, directGain);
EFX10.alFilterf(directFilter0, EFX10.AL_LOWPASS_GAINHF, directCutoff);
AL10.alSourcei(sourceID, EFX10.AL_DIRECT_FILTER, directFilter0);
AL10.alSourcef(sourceID, EFX10.AL_AIR_ABSORPTION_FACTOR, SoundPhysicsCore.Config.airAbsorption);
}
示例5: startPlayback
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Starts the streaming.
*/
private void startPlayback() {
AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_FALSE);
AL10.alSourcef(source, AL10.AL_PITCH, pitch);
remainingBufferCount = BUFFER_COUNT;
for (int i = 0; i < BUFFER_COUNT; i++) {
stream(bufferNames.get(i));
}
AL10.alSourceQueueBuffers(source, bufferNames);
AL10.alSourcePlay(source);
}
示例6: playAsSoundAt
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
* Play the specified buffer as a sound effect with the specified
* pitch and gain.
*
* @param buffer The ID of the buffer to play
* @param pitch The pitch to play at
* @param gain The gain to play at
* @param loop True if the sound should loop
* @param x The x position to play the sound from
* @param y The y position to play the sound from
* @param z The z position to play the sound from
* @return source The source that will be used
*/
int playAsSoundAt(int buffer,float pitch,float gain,boolean loop,float x, float y, float z) {
gain *= soundVolume;
if (gain == 0) {
gain = 0.001f;
}
if (soundWorks) {
if (sounds) {
int nextSource = findFreeSource();
if (nextSource == -1) {
return -1;
}
AL10.alSourceStop(sources.get(nextSource));
AL10.alSourcei(sources.get(nextSource), AL10.AL_BUFFER, buffer);
AL10.alSourcef(sources.get(nextSource), AL10.AL_PITCH, pitch);
AL10.alSourcef(sources.get(nextSource), AL10.AL_GAIN, gain);
AL10.alSourcei(sources.get(nextSource), AL10.AL_LOOPING, loop ? AL10.AL_TRUE : AL10.AL_FALSE);
sourcePos.clear();
sourceVel.clear();
sourceVel.put(new float[] { 0, 0, 0 });
sourcePos.put(new float[] { x, y, z });
sourcePos.flip();
sourceVel.flip();
AL10.alSource(sources.get(nextSource), AL10.AL_POSITION, sourcePos);
AL10.alSource(sources.get(nextSource), AL10.AL_VELOCITY, sourceVel);
AL10.alSourcePlay(sources.get(nextSource));
return nextSource;
}
}
return -1;
}
示例7: 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);
}
}
}
}
示例8: setSoundLooping
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
public void setSoundLooping(long soundId, boolean looping) {
if (AL.isCreated()) {
if (soundIdToSource.containsKey(soundId)) {
int sourceId = soundIdToSource.get(soundId);
AL10.alSourcei(sourceId, AL10.AL_LOOPING, looping ? AL10.AL_TRUE : AL10.AL_FALSE);
}
}
}
示例9: 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);
}
示例10: loopNewStream
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
@Override
public long loopNewStream(double volume) {
int sourceID = audioFactory.obtainSource(false);
if (sourceID == -1) {
return -1;
}
long soundId = audioFactory.getSoundId(sourceID);
AL10.alSourcei(sourceID, AL10.AL_BUFFER, bufferID);
AL10.alSourcei(sourceID, AL10.AL_LOOPING, AL10.AL_TRUE);
AL10.alSourcef(sourceID, AL10.AL_GAIN, (float) volume);
AL10.alSourcePlay(sourceID);
return soundId;
}
示例11: 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);
}
示例12: setSound
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
public void setSound(Sound sound){
if(this.sound == sound)
return;
AL10.alSourcei(id, AL10.AL_BUFFER, sound.id);
}
示例13: disableRolloff
import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
public void disableRolloff(){
if(!rolloff)
return;
AL10.alSourcei(id, AL10.AL_DISTANCE_MODEL, AL10.AL_NONE);
}