Merge pull request #11925 from unknownbrackets/android-audio

Android: Allow less common sample rates
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2019-03-24 10:56:02 +01:00
commit 4fce6784b3
1 file changed
+2 -8
+2 -8
View File
@@ -23,10 +23,6 @@ AudioContext::AudioContext(AndroidAudioCallback cb, int _FramesPerBuffer, int _S
framesPerBuffer = 4096;
sampleRate = _SampleRate;
if (sampleRate != 44100 && sampleRate != 48000) {
ELOG("Invalid sample rate %i - choosing 44100", sampleRate);
sampleRate = 44100;
}
}
// This callback handler is called every time a buffer finishes playing.
@@ -84,10 +80,8 @@ bool OpenSLContext::Init() {
result = (*outputMixObject)->Realize(outputMixObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result);
SLuint32 sr = SL_SAMPLINGRATE_44_1;
if (sampleRate == 48000) {
sr = SL_SAMPLINGRATE_48;
} // Don't allow any other sample rates.
// The constants, such as SL_SAMPLINGRATE_44_1, are just 44100000.
SLuint32 sr = (SLuint32)sampleRate * 1000;
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
SLDataFormat_PCM format_pcm = {