當前位置: 首頁>>代碼示例>>Java>>正文


Java AL10.alSourceStop方法代碼示例

本文整理匯總了Java中org.lwjgl.openal.AL10.alSourceStop方法的典型用法代碼示例。如果您正苦於以下問題:Java AL10.alSourceStop方法的具體用法?Java AL10.alSourceStop怎麽用?Java AL10.alSourceStop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.lwjgl.openal.AL10的用法示例。


在下文中一共展示了AL10.alSourceStop方法的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)); 
		}
	}
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:34,代碼來源:SoundStore.java

示例2: getOggStream

import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
 * Get the Sound based on a specified OGG file
 * 
 * @param ref The reference to the OGG file in the classpath
 * @return The Sound read from the OGG file
 * @throws IOException Indicates a failure to load the OGG
 */
public Audio getOggStream(String ref) throws IOException {
	if (!soundWorks) {
		return new NullAudio();
	}
	
	setMOD(null);
	setStream(null);
	
	if (currentMusic != -1) {
		AL10.alSourceStop(sources.get(0));
	}
	
	getMusicSource();
	currentMusic = sources.get(0);
	
	return new StreamSound(new OpenALStreamPlayer(currentMusic, ref));
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:25,代碼來源:SoundStore.java

示例3: 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);
}
 
開發者ID:imaTowan,項目名稱:Towan,代碼行數:19,代碼來源:StreamSound.java

示例4: getOggStream

import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
 * Get the Sound based on a specified OGG file
 * 
 * @param ref The reference to the OGG file in the classpath
 * @return The Sound read from the OGG file
 * @throws IOException Indicates a failure to load the OGG
 */
public Audio getOggStream(URL ref) throws IOException {
	if (!soundWorks) {
		return new NullAudio();
	}
	
	setMOD(null);
	setStream(null);
	
	if (currentMusic != -1) {
		AL10.alSourceStop(sources.get(0));
	}
	
	getMusicSource();
	currentMusic = sources.get(0);
	
	return new StreamSound(new OpenALStreamPlayer(currentMusic, ref));
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:25,代碼來源:SoundStore.java

示例5: 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);
}
 
開發者ID:imaTowan,項目名稱:Towan,代碼行數:17,代碼來源:MODSound.java

示例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;
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:50,代碼來源:SoundStore.java

示例7: play

import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
    * Play a mod or xm track streamed from the specified location
    * 
    * @param module The moudle to play back
    * @param source The OpenAL source to play the music on
    * @param start True if the music should be started
    * @param loop True if the track should be looped
    */
public void play(Module module, int source, boolean loop, boolean start) {
	this.source = source;
	this.loop = loop;
	this.module = module;
	done = false;
	
	ibxm = new IBXM(48000);
	ibxm.set_module(module);
	songDuration = ibxm.calculate_song_duration();

	if (bufferNames != null) {
		AL10.alSourceStop(source);
		bufferNames.flip();
		AL10.alDeleteBuffers(bufferNames);
	}
	
	bufferNames = BufferUtils.createIntBuffer(2);
	AL10.alGenBuffers(bufferNames);
	remainingBufferCount = 2;
	
	for (int i=0;i<2;i++) {
        stream(bufferNames.get(i));
	}
       AL10.alSourceQueueBuffers(source, bufferNames);
	AL10.alSourcef(source, AL10.AL_PITCH, 1.0f);
	AL10.alSourcef(source, AL10.AL_GAIN, 1.0f); 
	
	if (start) {
		AL10.alSourcePlay(source);
	}
}
 
開發者ID:imaTowan,項目名稱:Towan,代碼行數:40,代碼來源:OpenALMODPlayer.java

示例8: 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);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:18,代碼來源:MODSound.java

示例9: destroy

import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
@Override
public void destroy() {
    try {
        if (AL.isCreated()) {
            for (int i = 0; i < music.size(); i++) {
                MusicController musicControllerImpl = music.get(i);
                if (musicControllerImpl != null) {
                    musicControllerImpl.release();
                }
            }
            for (int i = 0, n = allSources.size; i < n; i++) {
                int sourceID = allSources.get(i);
                int state = AL10.alGetSourcei(sourceID, AL10.AL_SOURCE_STATE);
                if (state != AL10.AL_STOPPED) AL10.alSourceStop(sourceID);
                AL10.alDeleteSources(sourceID);
            }
            sourceToSoundId.clear();
            soundIdToSource.clear();
            AL.destroy();
            while (AL.isCreated()) {
                try {
                    Thread.sleep(10);
                } catch (InterruptedException skip) {
                    skip.printStackTrace();
                }
            }
        }
    } catch (UnsatisfiedLinkError e) {
        e.printStackTrace();
    }
}
 
開發者ID:dmitrykolesnikovich,項目名稱:featurea,代碼行數:32,代碼來源:OpenALImpl.java

示例10: play

import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
 * Start this stream playing
 * 
 * @param loop True if the stream should loop 
 * @throws IOException Indicates a failure to read from the stream
 */
public void play(boolean loop) throws IOException {
	this.loop = loop;
	initStreams();
	
	done = false;

	AL10.alSourceStop(source);
	removeBuffers();
	
	startPlayback();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:18,代碼來源:OpenALStreamPlayer.java

示例11: 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);
            }
        }
    }
}
 
開發者ID:dmitrykolesnikovich,項目名稱:featurea,代碼行數:15,代碼來源:OpenALImpl.java

示例12: 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);
            }
        }
    }
}
 
開發者ID:dmitrykolesnikovich,項目名稱:featurea,代碼行數:16,代碼來源:OpenALImpl.java

示例13: stopSource

import org.lwjgl.openal.AL10; //導入方法依賴的package包/類
/**
 * Stop a particular sound source
 * 
 * @param index The index of the source to stop
 */
void stopSource(int index) {
	AL10.alSourceStop(sources.get(index));
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:9,代碼來源:SoundStore.java


注:本文中的org.lwjgl.openal.AL10.alSourceStop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。