1 /******************************************************************************* 2 * Copyright 2011 See AUTHORS file. 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 17 package com.badlogic.gdx.audio; 18 19 import com.badlogic.gdx.utils.Disposable; 20 21 /** An AudioRecorder allows to record input from an audio device. It has a sampling rate and is either stereo or mono. Samples are 22 * returned in signed 16-bit PCM format. Stereo samples are interleaved in the order left channel, right channel. The 23 * AudioRecorder has to be disposed if no longer needed via the {@link #dispose()}. 24 * 25 * @author mzechner */ 26 public interface AudioRecorder extends Disposable { 27 /** Reads in numSamples samples into the array samples starting at offset. If the recorder is in stereo you have to multiply 28 * numSamples by 2. 29 * 30 * @param samples the array to write the samples to 31 * @param offset the offset into the array 32 * @param numSamples the number of samples to be read */ read(short[] samples, int offset, int numSamples)33 public void read (short[] samples, int offset, int numSamples); 34 35 /** Disposes the AudioRecorder */ dispose()36 public void dispose (); 37 } 38