Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * 
 * For information on usage and redistribution, and for a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 * 
 */

import android.media.AudioFormat;

public class Main {
    public static int getOutFormat(int outChannels) {
        switch (outChannels) {
        case 1:
            return AudioFormat.CHANNEL_OUT_MONO;
        case 2:
            return AudioFormat.CHANNEL_OUT_STEREO;
        case 4:
            return AudioFormat.CHANNEL_OUT_QUAD;
        case 6:
            return AudioFormat.CHANNEL_OUT_5POINT1;
        case 8:
            return AudioFormat.CHANNEL_OUT_7POINT1;
        default:
            throw new IllegalArgumentException("illegal number of output channels: " + outChannels);
        }
    }
}