Rename FORMAT to ENCODING
The AudioFormat contains several properties. This specific value is named "encoding".
This commit is contained in:
parent
38900d7730
commit
597d2ccc01
1 changed files with 3 additions and 3 deletions
|
@ -22,7 +22,7 @@ public final class AudioCapture {
|
||||||
public static final int SAMPLE_RATE = 48000;
|
public static final int SAMPLE_RATE = 48000;
|
||||||
public static final int CHANNEL_CONFIG = AudioFormat.CHANNEL_IN_STEREO;
|
public static final int CHANNEL_CONFIG = AudioFormat.CHANNEL_IN_STEREO;
|
||||||
public static final int CHANNELS = 2;
|
public static final int CHANNELS = 2;
|
||||||
public static final int FORMAT = AudioFormat.ENCODING_PCM_16BIT;
|
public static final int ENCODING = AudioFormat.ENCODING_PCM_16BIT;
|
||||||
public static final int BYTES_PER_SAMPLE = 2;
|
public static final int BYTES_PER_SAMPLE = 2;
|
||||||
|
|
||||||
private AudioRecord recorder;
|
private AudioRecord recorder;
|
||||||
|
@ -37,7 +37,7 @@ public final class AudioCapture {
|
||||||
|
|
||||||
private static AudioFormat createAudioFormat() {
|
private static AudioFormat createAudioFormat() {
|
||||||
AudioFormat.Builder builder = new AudioFormat.Builder();
|
AudioFormat.Builder builder = new AudioFormat.Builder();
|
||||||
builder.setEncoding(FORMAT);
|
builder.setEncoding(ENCODING);
|
||||||
builder.setSampleRate(SAMPLE_RATE);
|
builder.setSampleRate(SAMPLE_RATE);
|
||||||
builder.setChannelMask(CHANNEL_CONFIG);
|
builder.setChannelMask(CHANNEL_CONFIG);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
@ -53,7 +53,7 @@ public final class AudioCapture {
|
||||||
}
|
}
|
||||||
builder.setAudioSource(SOURCE);
|
builder.setAudioSource(SOURCE);
|
||||||
builder.setAudioFormat(createAudioFormat());
|
builder.setAudioFormat(createAudioFormat());
|
||||||
int minBufferSize = AudioRecord.getMinBufferSize(SAMPLE_RATE, CHANNEL_CONFIG, FORMAT);
|
int minBufferSize = AudioRecord.getMinBufferSize(SAMPLE_RATE, CHANNEL_CONFIG, ENCODING);
|
||||||
// This buffer size does not impact latency
|
// This buffer size does not impact latency
|
||||||
builder.setBufferSizeInBytes(8 * minBufferSize);
|
builder.setBufferSizeInBytes(8 * minBufferSize);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
|
Loading…
Reference in a new issue