From 6a74d16a805a4204093972bb91361b2aa633065c Mon Sep 17 00:00:00 2001
From: Sven Gothel
- * The preferred sample-rate is guaranteed to be supported
- * and shall reflect this sinks most native format,
- * i.e. best performance w/o data conversion.
- *
- * May return {@link AudioSink#DefaultFormat}'s 44100 default if undefined.
- *
@@ -236,32 +221,64 @@ public interface AudioSink {
public float getDefaultLatency();
/**
- * Returns the preferred {@link AudioFormat} by this sink.
+ * Returns the native {@link AudioFormat} by this sink.
*
- * The preferred format is guaranteed to be supported
+ * The native format is guaranteed to be supported
* and shall reflect this sinks most native format,
* i.e. best performance w/o data conversion.
*
+ * The native format is not impacted by {@link #setChannelLimit(int)}.
+ *
+ * May return {@link AudioSink#DefaultFormat} if undefined.
+ *
+ * The preferred format is a subset of {@link #getNativeFormat()},
+ * impacted by {@link #setChannelLimit(int)}.
+ *
* Known {@link #AudioFormat} attributes considered by implementations:
*
*
*
- * May return {@link AudioSink#DefaultFormat} if undefined. - *
+ * @see #getNativeFormat() * @see #init(AudioFormat, float, int, int, int) + * @see #setChannelLimit(int) * @see #isSupported(AudioFormat) - * @see #getPreferredSampleRate() */ public AudioFormat getPreferredFormat(); - /** Return the maximum number of supported channels, e.g. 1 for mono, 2 for stereo, etc. */ - public int getMaxSupportedChannels(); + /** + * Limit maximum supported audio channels by user. + *+ * Must be set before {@link #getPreferredFormat()}, {@link #isSupported(AudioFormat)} and naturally {@link #init(AudioFormat, int, int, int, int)}. + *
+ *+ * May be utilized to enforce 1 channel (mono) downsampling + * in combination with JOAL/OpenAL to experience spatial 3D position effects. + *
+ * @param cc maximum supported audio channels, will be clipped [1..{@link #getNativeFormat()}.{@link AudioFormat#channelCount channelCount}] + * @see #getNativeFormat() + * @see #getPreferredFormat() + * @see #isSupported(AudioFormat) + * @see #init(AudioFormat, int, int, int, int) + */ + public void setChannelLimit(final int cc); /** * Returns true if the given format is supported by the sink, otherwise false. + *+ * The {@link #getPreferredFormat()} is used to validate compatibility with the given format. + *
* @see #init(AudioFormat, float, int, int, int) * @see #getPreferredFormat() */ @@ -275,7 +292,7 @@ public interface AudioSink { *
* Caller shall validate requestedFormat
via {@link #isSupported(AudioFormat)}
* beforehand and try to find a suitable supported one.
- * {@link #getPreferredFormat()} and {@link #getMaxSupportedChannels()} may help.
+ * {@link #getPreferredFormat()} may help.
*