*----------------------------------------------------------------------\r
*/\r
\r
-\r
-\r
/**\r
- * A Type-safe representation of the the supported output channel\r
- * constants. \r
+ * A Type-safe representation of the the supported output channel constants.\r
* \r
- * This class is immutable and, hence, is thread safe. \r
+ * This class is immutable and, hence, is thread safe.\r
* \r
- * @author Mat McGowan 12/12/99 \r
- * @since 0.0.7\r
+ * @author Mat McGowan 12/12/99\r
+ * @since 0.0.7\r
*/\r
-public class OutputChannels\r
-{ \r
- /**\r
- * Flag to indicate output should include both channels. \r
- */\r
- public static final int BOTH_CHANNELS = 0;\r
- \r
- /**\r
- * Flag to indicate output should include the left channel only. \r
- */\r
- public static final int LEFT_CHANNEL = 1;\r
-\r
- /**\r
- * Flag to indicate output should include the right channel only. \r
- */\r
- public static final int RIGHT_CHANNEL = 2;\r
- \r
- /**\r
- * Flag to indicate output is mono. \r
- */\r
- public static final int DOWNMIX_CHANNELS = 3;\r
-\r
- \r
- public static final OutputChannels LEFT = new OutputChannels(LEFT_CHANNEL);\r
- public static final OutputChannels RIGHT = new OutputChannels(RIGHT_CHANNEL);\r
- public static final OutputChannels BOTH = new OutputChannels(BOTH_CHANNELS);\r
- public static final OutputChannels DOWNMIX = new OutputChannels(DOWNMIX_CHANNELS);\r
- \r
- \r
- private /*final*/ int outputChannels;\r
- \r
- /**\r
- * Creates an <code>OutputChannels</code> instance\r
- * corresponding to the given channel code.\r
- * \r
- * @param code one of the OutputChannels channel code constants.\r
- * \r
- * @throws IllegalArgumentException if code is not a valid\r
- * channel code. \r
- */\r
- static public OutputChannels fromInt(int code)\r
- {\r
- switch (code)\r
- {\r
- case LEFT_CHANNEL:\r
- return LEFT;\r
- case RIGHT_CHANNEL:\r
- return RIGHT;\r
- case BOTH_CHANNELS:\r
- return BOTH;\r
- case DOWNMIX_CHANNELS:\r
- return DOWNMIX;\r
- default:\r
- throw new IllegalArgumentException("Invalid channel code: "+code);\r
- }\r
- }\r
- \r
- private OutputChannels(int channels)\r
- {\r
- outputChannels = channels;\r
- \r
- if (channels<0 || channels>3)\r
- throw new IllegalArgumentException("channels");\r
- }\r
- \r
- /**\r
- * Retrieves the code representing the desired output channels.\r
- * Will be one of LEFT_CHANNEL, RIGHT_CHANNEL, BOTH_CHANNELS\r
- * or DOWNMIX_CHANNELS.\r
- * \r
- * @return the channel code represented by this instance.\r
- */\r
- public int getChannelsOutputCode()\r
- {\r
- return outputChannels; \r
- }\r
- \r
- /**\r
- * Retrieves the number of output channels represented \r
- * by this channel output type.\r
- * \r
- * @return The number of output channels for this channel output\r
- * type. This will be 2 for BOTH_CHANNELS only, and 1\r
- * for all other types. \r
- */\r
- public int getChannelCount()\r
- {\r
- int count = (outputChannels==BOTH_CHANNELS) ? 2 : 1;\r
- return count;\r
- }\r
- \r
- \r
- public boolean equals(Object o)\r
- {\r
- boolean equals = false;\r
- \r
- if (o instanceof OutputChannels)\r
- {\r
- OutputChannels oc = (OutputChannels)o;\r
- equals = (oc.outputChannels == outputChannels);\r
- }\r
- \r
- return equals;\r
- }\r
- \r
- public int hashCode()\r
- {\r
- return outputChannels; \r
- }\r
- \r
+@LATTICE("B<T")\r
+@METHODDEFAULT("OUT<IN")\r
+public class OutputChannels {\r
+ /**\r
+ * Flag to indicate output should include both channels.\r
+ */\r
+ public static final int BOTH_CHANNELS = 0;\r
+\r
+ /**\r
+ * Flag to indicate output should include the left channel only.\r
+ */\r
+ public static final int LEFT_CHANNEL = 1;\r
+\r
+ /**\r
+ * Flag to indicate output should include the right channel only.\r
+ */\r
+ public static final int RIGHT_CHANNEL = 2;\r
+\r
+ /**\r
+ * Flag to indicate output is mono.\r
+ */\r
+ public static final int DOWNMIX_CHANNELS = 3;\r
+\r
+ @LOC("B")\r
+ public static final OutputChannels LEFT = new OutputChannels(LEFT_CHANNEL);\r
+ @LOC("B")\r
+ public static final OutputChannels RIGHT = new OutputChannels(RIGHT_CHANNEL);\r
+ @LOC("B")\r
+ public static final OutputChannels BOTH = new OutputChannels(BOTH_CHANNELS);\r
+ @LOC("B")\r
+ public static final OutputChannels DOWNMIX = new OutputChannels(DOWNMIX_CHANNELS);\r
+\r
+ @LOC("T")\r
+ private/* final */int outputChannels;\r
+\r
+ /**\r
+ * Creates an <code>OutputChannels</code> instance corresponding to the given\r
+ * channel code.\r
+ * \r
+ * @param code\r
+ * one of the OutputChannels channel code constants.\r
+ * \r
+ * @throws IllegalArgumentException\r
+ * if code is not a valid channel code.\r
+ */\r
+ static public OutputChannels fromInt(int code) {\r
+ switch (code) {\r
+ case LEFT_CHANNEL:\r
+ return LEFT;\r
+ case RIGHT_CHANNEL:\r
+ return RIGHT;\r
+ case BOTH_CHANNELS:\r
+ return BOTH;\r
+ case DOWNMIX_CHANNELS:\r
+ return DOWNMIX;\r
+ default:\r
+ throw new IllegalArgumentException("Invalid channel code: " + code);\r
+ }\r
+ }\r
+\r
+ public OutputChannels(@LOC("IN") int channels) {\r
+ outputChannels = channels;\r
+\r
+ if (channels < 0 || channels > 3)\r
+ throw new IllegalArgumentException("channels");\r
+ }\r
+\r
+ /**\r
+ * Retrieves the code representing the desired output channels. Will be one of\r
+ * LEFT_CHANNEL, RIGHT_CHANNEL, BOTH_CHANNELS or DOWNMIX_CHANNELS.\r
+ * \r
+ * @return the channel code represented by this instance.\r
+ */\r
+ public int getChannelsOutputCode() {\r
+ return outputChannels;\r
+ }\r
+\r
+ /**\r
+ * Retrieves the number of output channels represented by this channel output\r
+ * type.\r
+ * \r
+ * @return The number of output channels for this channel output type. This\r
+ * will be 2 for BOTH_CHANNELS only, and 1 for all other types.\r
+ */\r
+ public int getChannelCount() {\r
+ int count = (outputChannels == BOTH_CHANNELS) ? 2 : 1;\r
+ return count;\r
+ }\r
+\r
+ public boolean equals(Object o) {\r
+ boolean equals = false;\r
+\r
+ if (o instanceof OutputChannels) {\r
+ OutputChannels oc = (OutputChannels) o;\r
+ equals = (oc.outputChannels == outputChannels);\r
+ }\r
+\r
+ return equals;\r
+ }\r
+\r
+ public int hashCode() {\r
+ return outputChannels;\r
+ }\r
+\r
}\r