1 /* 2 * Copyright 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.hyphonate.megaaudio.common; 17 18 /** 19 * Constants for Stream State 20 */ 21 public class StreamState { 22 public static final int UNINITIALIZED = 0; // AAUDIO_STREAM_STATE_UNINITIALIZED, 23 public static final int UNKNOWN = 1; // AAUDIO_STREAM_STATE_UNKNOWN, 24 public static final int OPEN = 2; // AAUDIO_STREAM_STATE_OPEN, 25 public static final int STARTING = 3; // AAUDIO_STREAM_STATE_STARTING, 26 public static final int STARTED = 4; // AAUDIO_STREAM_STATE_STARTED, 27 public static final int PAUSING = 5; // AAUDIO_STREAM_STATE_PAUSING, 28 public static final int PAUSED = 6; // AAUDIO_STREAM_STATE_PAUSED, 29 public static final int FLUSHING = 7; // AAUDIO_STREAM_STATE_FLUSHING, 30 public static final int FLUSHED = 8; // AAUDIO_STREAM_STATE_FLUSHED, 31 public static final int STOPPING = 9; // AAUDIO_STREAM_STATE_STOPPING, 32 public static final int STOPPED = 10; // AAUDIO_STREAM_STATE_STOPPED, 33 public static final int CLOSING = 11; // AAUDIO_STREAM_STATE_CLOSING, 34 public static final int CLOSED = 12; // AAUDIO_STREAM_STATE_CLOSED, 35 public static final int DISCONNECTED = 13; // AAUDIO_STREAM_STATE_DISCONNECTED, 36 37 /** 38 * @param state a constant from above 39 * @return A textual name for the specified state code 40 */ toString(int state)41 public static String toString(int state) { 42 switch(state) { 43 case UNINITIALIZED: 44 return "UNINITIALIZED"; 45 case UNKNOWN: 46 return "UNKNOWN"; 47 case OPEN: 48 return "OPEN"; 49 case STARTING: 50 return "STARTING"; 51 case STARTED: 52 return "STARTED"; 53 case PAUSING: 54 return "PAUSING"; 55 case PAUSED: 56 return "PAUSED"; 57 case FLUSHING: 58 return "FLUSHING"; 59 case FLUSHED: 60 return "FLUSHED"; 61 case STOPPING: 62 return "STOPPING"; 63 case STOPPED: 64 return "STOPPED"; 65 case CLOSING: 66 return "CLOSING"; 67 case CLOSED: 68 return "CLOSED"; 69 case DISCONNECTED: 70 return "DISCONNECTED"; 71 default: 72 return "Unknown Stream State" + state; 73 } 74 } 75 } 76