private int convertFormat(AudioData ad) { switch (ad.getBitsPerSample()) { case 8: if (ad.getChannels() == 1) { return AL_FORMAT_MONO8; } else if (ad.getChannels() == 2) { return AL_FORMAT_STEREO8; } break; case 16: if (ad.getChannels() == 1) { return AL_FORMAT_MONO16; } else { return AL_FORMAT_STEREO16; } } throw new UnsupportedOperationException("Unsupported channels/bits combination: " + "bits=" + ad.getBitsPerSample() + ", channels=" + ad.getChannels()); }
/** * Start playing the audio. */ public void play(){ if (positional && data.getChannels() > 1) { throw new IllegalStateException("Only mono audio is supported for positional audio nodes"); } getRenderer().playSource(this); }
/** * Start playing an instance of this audio. This method can be used * to play the same <code>AudioNode</code> multiple times. Note * that changes to the parameters of this AudioNode will not affect the * instances already playing. */ public void playInstance(){ if (positional && data.getChannels() > 1) { throw new IllegalStateException("Only mono audio is supported for positional audio nodes"); } getRenderer().playSourceInstance(this); }
data.getChannels() * data.getBitsPerSample() / 8);
private int convertFormat(AudioData ad) { switch (ad.getBitsPerSample()) { case 8: if (ad.getChannels() == 1) { return AL_FORMAT_MONO8; } else if (ad.getChannels() == 2) { return AL_FORMAT_STEREO8; } break; case 16: if (ad.getChannels() == 1) { return AL_FORMAT_MONO16; } else { return AL_FORMAT_STEREO16; } } throw new UnsupportedOperationException("Unsupported channels/bits combination: " + "bits=" + ad.getBitsPerSample() + ", channels=" + ad.getChannels()); }
/** * Start playing an instance of this audio. This method can be used * to play the same <code>AudioNode</code> multiple times. Note * that changes to the parameters of this AudioNode will not affect the * instances already playing. */ public void playInstance(){ if (positional && data.getChannels() > 1) { throw new IllegalStateException("Only mono audio is supported for positional audio nodes"); } getRenderer().playSourceInstance(this); }
/** * Start playing the audio. */ public void play(){ if (positional && data.getChannels() > 1) { throw new IllegalStateException("Only mono audio is supported for positional audio nodes"); } getRenderer().playSource(this); }
data.getChannels() * data.getBitsPerSample() / 8);