public void playSourceInstance(AudioSource src) { checkDead(); synchronized (threadLock) { if (audioDisabled) { return; } if (src.getAudioData() instanceof AudioStream) { throw new UnsupportedOperationException( "Cannot play instances " + "of audio streams. Use play() instead."); } if (src.getAudioData().isUpdateNeeded()) { updateAudioData(src.getAudioData()); } // create a new index for an audio-channel int index = newChannel(); if (index == -1) { return; } int sourceId = channels[index]; clearChannel(index); // set parameters, like position and max distance setSourceParams(sourceId, src, true); attachAudioToSource(sourceId, src.getAudioData(), false); chanSrcs[index] = src; // play the channel al.alSourcePlay(sourceId); } }
AudioSource src = chanSrcs[i]; if (src == null || !(src.getAudioData() instanceof AudioStream)) { continue; AudioStream stream = (AudioStream) src.getAudioData();
public void stopSource(AudioSource src) { synchronized (threadLock) { if (audioDisabled) { return; } if (src.getStatus() != Status.Stopped) { int chan = src.getChannel(); assert chan != -1; // if it's not stopped, must have id src.setStatus(Status.Stopped); src.setChannel(-1); clearChannel(chan); freeChannel(chan); if (src.getAudioData() instanceof AudioStream) { // If the stream is seekable, then rewind it. // Otherwise, close it, as it is no longer valid. AudioStream stream = (AudioStream)src.getAudioData(); if (stream.isSeekable()) { stream.setTime(0); } else { stream.close(); } } } } }
if (oalStatus == Status.Stopped && jmeStatus == Status.Playing) { if (src.getAudioData() instanceof AudioStream) { AudioStream stream = (AudioStream) src.getAudioData();
src.setChannel(index); AudioData data = src.getAudioData(); if (data.isUpdateNeeded()) { updateAudioData(data);
AudioData data = src.getAudioData(); int playbackOffsetBytes = 0;
if (forceNonLoop || src.getAudioData() instanceof AudioStream) { al.alSourcei(id, AL_LOOPING, AL_FALSE); } else {
if (src.isLooping() && !(src.getAudioData() instanceof AudioStream)) { al.alSourcei(id, AL_LOOPING, AL_TRUE); } else {
public void playSourceInstance(AudioSource src) { checkDead(); synchronized (threadLock) { if (audioDisabled) { return; } if (src.getAudioData() instanceof AudioStream) { throw new UnsupportedOperationException( "Cannot play instances " + "of audio streams. Use play() instead."); } if (src.getAudioData().isUpdateNeeded()) { updateAudioData(src.getAudioData()); } // create a new index for an audio-channel int index = newChannel(); if (index == -1) { return; } int sourceId = channels[index]; clearChannel(index); // set parameters, like position and max distance setSourceParams(sourceId, src, true); attachAudioToSource(sourceId, src.getAudioData(), false); chanSrcs[index] = src; // play the channel al.alSourcePlay(sourceId); } }
AudioSource src = chanSrcs[i]; if (src == null || !(src.getAudioData() instanceof AudioStream)) { continue; AudioStream stream = (AudioStream) src.getAudioData();
public void stopSource(AudioSource src) { synchronized (threadLock) { if (audioDisabled) { return; } if (src.getStatus() != Status.Stopped) { int chan = src.getChannel(); assert chan != -1; // if it's not stopped, must have id src.setStatus(Status.Stopped); src.setChannel(-1); clearChannel(chan); freeChannel(chan); if (src.getAudioData() instanceof AudioStream) { // If the stream is seekable, then rewind it. // Otherwise, close it, as it is no longer valid. AudioStream stream = (AudioStream)src.getAudioData(); if (stream.isSeekable()) { stream.setTime(0); } else { stream.close(); } } } } }
if (oalStatus == Status.Stopped && jmeStatus == Status.Playing) { if (src.getAudioData() instanceof AudioStream) { AudioStream stream = (AudioStream) src.getAudioData();
AudioData data = src.getAudioData(); int playbackOffsetBytes = 0;
src.setChannel(index); AudioData data = src.getAudioData(); if (data.isUpdateNeeded()) { updateAudioData(data);
if (forceNonLoop || src.getAudioData() instanceof AudioStream) { al.alSourcei(id, AL_LOOPING, AL_FALSE); } else {
if (src.isLooping() && !(src.getAudioData() instanceof AudioStream)) { al.alSourcei(id, AL_LOOPING, AL_TRUE); } else {