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


Java AL10.AL_PLAYING屬性代碼示例

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


在下文中一共展示了AL10.AL_PLAYING屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: update

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

示例2: update

/**
 * 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);
    }
}
 
開發者ID:imaTowan,項目名稱:Towan,代碼行數:34,代碼來源:OpenALMODPlayer.java

示例3: isMusicPlaying

/**
 * 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));
}
 
開發者ID:imaTowan,項目名稱:Towan,代碼行數:14,代碼來源:SoundStore.java

示例4: findFreeSource

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

示例5: findFreeSource

/**
 * 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;
}
 
開發者ID:TheRemote,項目名稱:Spark,代碼行數:19,代碼來源:Sounds.java

示例6: QueueSound

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);
	}
}
 
開發者ID:TheRemote,項目名稱:Spark,代碼行數:29,代碼來源:Sounds.java

示例7: update

/**
 * 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);
    }
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:46,代碼來源:OpenALStreamPlayer.java

示例8: update

public void update(){
	int state = AL10.alGetSourcei(id, AL10.AL_SOURCE_STATE);
	if(state != AL10.AL_PLAYING && state != AL10.AL_PAUSED)
		stop();
}
 
開發者ID:tek256,項目名稱:LD38,代碼行數:5,代碼來源:Source.java

示例9: isPlaying

/**
 * 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);
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:11,代碼來源:SoundStore.java


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