summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util/av
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-08-26 09:59:47 +0200
committerSven Gothel <[email protected]>2013-08-26 09:59:47 +0200
commite28a3b39e1e8caf3f6cf3bfe82efdaae818a6c7b (patch)
tree92166bb7d9df0829ed45db383181b6f999c95d6d /src/jogl/classes/jogamp/opengl/util/av
parent871c7cac1939e6c7fbcd33aa031b7861f63da6ae (diff)
AudioSink: Fixe type names ; Enhance AudioFormat negotiation ; ALAudioSink adds AL_SOFT_buffer_samples support w/ full AL caps
- Fixe type names: - Remove AudioDataType, we only support PCM here anyways - AudioDataFormat -> AudioFormat / Add 'planar' attribute to distingush packed/planar data type - Validate float types - Enhance AudioFormat negotiation - Add 'isSupported(AudioFormat format)' which _shall_ be used before 'init(..)' to test/negotiate format - Add getMaxSupportedChannels(), which may be used w/ getPreferredFormat() if orig requested format fails via 'isSupported(..)' - 'init(..)' returns boolean only. - ALAudioSink adds AL_SOFT_buffer_samples support w/ full AL caps - Determine whether AL_SOFT_buffer_samples is supported - Use new JOAL ALHelper to convert AudioFormat -> AL-types, which also answers the 'isSupported(..)' query. - Now allows multiple: channles, sample-types, etc.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/av')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java20
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java16
2 files changed, 28 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
index b1b9c1b6c..85fab96a4 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
@@ -33,7 +33,7 @@ public class JavaSoundAudioSink implements AudioSink {
private int bufferCount;
private byte [] sampleData = new byte[BUFFER_SIZE];
private boolean initialized = false;
- private AudioDataFormat chosenFormat = null;
+ private AudioSink.AudioFormat chosenFormat = null;
private volatile boolean playRequested = false;
private float volume = 1.0f;
@@ -77,14 +77,24 @@ public class JavaSoundAudioSink implements AudioSink {
}
@Override
- public AudioDataFormat getPreferredFormat() {
+ public AudioSink.AudioFormat getPreferredFormat() {
return DefaultFormat;
}
@Override
- public AudioDataFormat init(AudioDataFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
+ public final int getMaxSupportedChannels() {
+ return 2;
+ }
+
+ @Override
+ public final boolean isSupported(AudioSink.AudioFormat format) {
+ return true;
+ }
+
+ @Override
+ public boolean init(AudioSink.AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
if( !staticAvailable ) {
- return null;
+ return false;
}
// Create the audio format we wish to use
format = new javax.sound.sampled.AudioFormat(requestedFormat.sampleRate, requestedFormat.sampleSize, requestedFormat.channelCount, requestedFormat.signed, !requestedFormat.littleEndian);
@@ -105,7 +115,7 @@ public class JavaSoundAudioSink implements AudioSink {
} catch (Exception e) {
initialized=false;
}
- return chosenFormat;
+ return true;
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
index 83799b074..723bb9dd1 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
@@ -42,13 +42,23 @@ public class NullAudioSink implements AudioSink {
}
@Override
- public AudioDataFormat getPreferredFormat() {
+ public AudioFormat getPreferredFormat() {
return DefaultFormat;
}
@Override
- public AudioDataFormat init(AudioDataFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
- return requestedFormat;
+ public final int getMaxSupportedChannels() {
+ return 8;
+ }
+
+ @Override
+ public final boolean isSupported(AudioFormat format) {
+ return true;
+ }
+
+ @Override
+ public boolean init(AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
+ return true;
}
@Override