car/app/app/src/main/java/androidx/car/app/media/CarAudioRecord.java
/**
     * Reads audio data from the car microphone for recording into a byte array.
     *
     * @param audioData     the array to which the recorded audio data is written
     * @param offsetInBytes index in audioData from which the data is written expressed in bytes
     * @param sizeInBytes   the number of requested bytes
     * @return the number of bytes that were read, or {@code -1} if there isn't any more microphone
     * data
     * to read.  The number of bytes will be a multiple of the frame size in bytes not to exceed
     * {@code sizeInBytes}
     * @throws IllegalStateException if called before calling {@link #startRecording()} or after
     *                               calling {@link #stopRecording()}
     */
Reads audio data from the car microphone for recording into a byte array.
@param audioData     the array to which the recorded audio data is written
@param offsetInBytes index in audioData from which the data is written expressed in bytes
@param sizeInBytes   the number of requested bytes
@return the number of bytes that were read, or  -1 if there isn't any more microphone
data
to read.  The number of bytes will be a multiple of the frame size in bytes not to exceed
sizeInBytes
@throws IllegalStateException if called before calling  #startRecording() or after
calling  #stopRecording()
Reads audio data from the car microphone for recording into a byte array . @param audioData the array to which the recorded audio data is written @param offsetInBytes index in audioData from which the data is written expressed in bytes @param sizeInBytes the number of requested bytes @return the number of bytes that were read or - 1 if there isn ' t any more microphone data to read . The number of bytes will be a multiple of the frame size in bytes not to exceed sizeInBytes @throws IllegalStateException if called before calling #startRecording () or after calling #stopRecording ()
public int read(@NonNull byte[] audioData, int offsetInBytes, int sizeInBytes) {
        synchronized (mRecordingStateLock) {
            switch (mRecordingState) {
                case RECORDSTATE_STOPPED:
                    throw new IllegalStateException(
                            "Called read before calling startRecording or after "
                                    + "calling stopRecording");
                case RECORDSTATE_REMOTE_CLOSED:
                    return -1;
                case RECORDSTATE_RECORDING:
                default:
                    break;
            }
        }
        return readInternal(audioData, offsetInBytes, sizeInBytes);
    }
public int read ( @ NonNull byte [ ] audioData , int offsetInBytes , int sizeInBytes ) { synchronized ( mRecordingStateLock ) { switch ( mRecordingState ) { case RECORDSTATE_STOPPED : throw new IllegalStateException ( "Called read before calling startRecording or after " + "calling stopRecording" ) ; case RECORDSTATE_REMOTE_CLOSED : return - 1 ; case RECORDSTATE_RECORDING : default : break ; } } return readInternal ( audioData , offsetInBytes , sizeInBytes ) ; }
Reads audio data from the car microphone for recording into a byte array.
Reads audio data from the car microphone for recording into a byte array .