001package com.github.theholywaffle.teamspeak3.api;
002
003/*
004 * #%L
005 * TeamSpeak 3 Java API
006 * %%
007 * Copyright (C) 2014 Bert De Geyter
008 * %%
009 * Permission is hereby granted, free of charge, to any person obtaining a copy
010 * of this software and associated documentation files (the "Software"), to deal
011 * in the Software without restriction, including without limitation the rights
012 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
013 * copies of the Software, and to permit persons to whom the Software is
014 * furnished to do so, subject to the following conditions:
015 * 
016 * The above copyright notice and this permission notice shall be included in
017 * all copies or substantial portions of the Software.
018 * 
019 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
020 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
021 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
022 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
023 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
024 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
025 * THE SOFTWARE.
026 * #L%
027 */
028
029import com.github.theholywaffle.teamspeak3.TS3Api;
030
031import java.util.Map;
032
033/**
034 * Voice codecs currently used by TeamSpeak3.
035 * <p>
036 * A channel's codec may be edited by using {@link TS3Api#editChannel(int, Map)}.
037 * All voice data may also be encrypted.
038 * </p>
039 */
040public enum Codec {
041
042        /**
043         * The Speex narrowband codec with a sampling rate of 8kHz.
044         * <p>
045         * All Speex codecs are basically obsolete as Opus is better
046         * in every aspect and has a comparable required bandwidth.
047         * </p><ul>
048         * <li>Bandwidth per client with codec quality 0: 2.49 KiB/s</li>
049         * <li>Bandwidth per client with codec quality 10: 5.22 KiB/s</li>
050         * </ul>
051         */
052        SPEEX_NARROWBAND(0),
053
054        /**
055         * The Speex wideband codec with a sampling rate of 16kHz.
056         * <p>
057         * All Speex codecs are basically obsolete as Opus is better
058         * in every aspect and has a comparable required bandwidth.
059         * </p><ul>
060         * <li>Bandwidth per client with codec quality 0: 2.69 KiB/s</li>
061         * <li>Bandwidth per client with codec quality 10: 7.37 KiB/s</li>
062         * </ul>
063         */
064        SPEEX_WIDEBAND(1),
065
066        /**
067         * The Speex ultra-wideband codec with a sampling rate of 32kHz.
068         * <p>
069         * All Speex codecs are basically obsolete as Opus is better
070         * in every aspect and has a comparable required bandwidth.
071         * </p><ul>
072         * <li>Bandwidth per client with codec quality 0: 2.73 KiB/s</li>
073         * <li>Bandwidth per client with codec quality 10: 7.57 KiB/s</li>
074         * </ul>
075         */
076        SPEEX_ULTRAWIDEBAND(2),
077
078        /**
079         * The CELT Mono codec. It is optimised for music but still generates very good
080         * results in voice transmission.
081         * <p>
082         * Note that this codec requires the most bandwidth of all currently available codecs.
083         * </p><ul>
084         * <li>Bandwidth per client with codec quality 0: 6.10 KiB/s</li>
085         * <li>Bandwidth per client with codec quality 10: 13.92 KiB/s</li>
086         * </ul>
087         */
088        CELT_MONO(3),
089
090        /**
091         * The Opus codec optimised for voice transmission.
092         * <p>
093         * This is the default codec used by TeamSpeak and usually achieves the
094         * best results for voice transmission.
095         * </p><ul>
096         * <li>Bandwidth per client with codec quality 0: 2.73 KiB/s</li>
097         * <li>Bandwidth per client with codec quality 10: 7.71 KiB/s</li>
098         * </ul>
099         */
100        OPUS_VOICE(4),
101
102        /**
103         * The Opus codec optimised for music transmission.
104         * <p>
105         * Please note that if used only to transmit speech, this codec can
106         * sound worse than Opus Voice despite a higher bandwidth.
107         * </p><ul>
108         * <li>Bandwidth per client with codec quality 0: 3.08 KiB/s</li>
109         * <li>Bandwidth per client with codec quality 10: 11.87 KiB/s</li>
110         * </ul>
111         */
112        OPUS_MUSIC(5),
113
114        /**
115         * An unknown codec.
116         * <p>
117         * If you ever encounter an unknown codec, please tell us!
118         * We may have to update the API.
119         * </p>
120         */
121        UNKNOWN(-1);
122
123        private final int i;
124
125        Codec(int i) {
126                this.i = i;
127        }
128
129        public int getIndex() {
130                return i;
131        }
132}