public class AgoraAudioFrame
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.nio.ByteBuffer |
buffer
The data buffer of the audio frame.
|
private int |
bytesPerSample
The number of bytes per sample.
|
private int |
channels
The number of audio channels (interleaved if stereo).
|
private int |
sampleRate
The number of samples per channel in the audio frame, should
be 8000, 16000, 24000, 32000, 44100 or 48000.
|
private int |
samplesPerChannel
The number of samples per channel in this frame, should
be (sampleRate / 100) corresponding to 10ms.
|
private int |
type
The audio frame type.
|
| Constructor and Description |
|---|
AgoraAudioFrame()
Constructs an AgoraAudioFrame with default settings.
|
AgoraAudioFrame(int type,
int sampleRate,
int channels,
int samplesPerChannel,
int bytesPerSample,
java.nio.ByteBuffer buffer)
Constructs an AgoraAudioFrame with the specified parameters.
|
| Modifier and Type | Method and Description |
|---|---|
java.nio.ByteBuffer |
getBuffer()
Gets the audio data buffer.
|
int |
getBytesPerSample()
Gets the number of bytes per sample.
|
int |
getChannels()
Gets the number of audio channels.
|
int |
getSampleRate()
Gets the sample rate of the audio frame.
|
int |
getSamplesPerChannel()
Gets the number of samples per channel.
|
int |
getType()
Gets the audio frame type.
|
void |
setBuffer(java.nio.ByteBuffer buffer)
Sets the audio data buffer.
|
void |
setBytesPerSample(int bytesPerSample)
Sets the number of bytes per sample.
|
void |
setChannels(int channels)
Sets the number of audio channels.
|
void |
setSampleRate(int sampleRate)
Sets the sample rate of the audio frame.
|
void |
setSamplesPerChannel(int samplesPerChannel)
Sets the number of samples per channel.
|
void |
setType(int type)
Sets the audio frame type.
|
java.lang.String |
toString() |
private int type
Constants.AudioFrameType.
Default is PCM16.private int sampleRate
private int channels
private int samplesPerChannel
private int bytesPerSample
Constants.BytesPerSample, default
is 2.private java.nio.ByteBuffer buffer
public AgoraAudioFrame()
public AgoraAudioFrame(int type,
int sampleRate,
int channels,
int samplesPerChannel,
int bytesPerSample,
java.nio.ByteBuffer buffer)
type - The audio frame type.sampleRate - The sample rate of the audio frame.channels - The number of audio channels.samplesPerChannel - The number of samples per channel in the audio
frame.bytesPerSample - The number of bytes per sample in the audio frame.buffer - The data buffer of the audio frame.public int getType()
public void setType(int type)
type - Audio frame typepublic int getSampleRate()
public void setSampleRate(int sampleRate)
sampleRate - Sample ratepublic int getChannels()
public void setChannels(int channels)
channels - Number of channelspublic int getSamplesPerChannel()
public void setSamplesPerChannel(int samplesPerChannel)
samplesPerChannel - Samples per channelpublic int getBytesPerSample()
public void setBytesPerSample(int bytesPerSample)
bytesPerSample - Bytes per samplepublic java.nio.ByteBuffer getBuffer()
public void setBuffer(java.nio.ByteBuffer buffer)
buffer - Audio data bufferpublic java.lang.String toString()
toString in class java.lang.Object