cancel
Showing results for 
Search instead for 
Did you mean: 

Audio SDK 1.25.0 Spatialization - silent output

Anonymous
Not applicable
I'm trying to use the OVR Audio C/C++ native SDK 1.25.0 with my Oculus Go app.
The output buffer of ovrAudio_SpatializeMonoSourceInterleaved is always 0.00 (silence). Is this known to be working? Am I missing something in setup?

Here's a sample of my code.
static const int FRONT_LEFT = 0;
static const int OVR_BUFFER_SIZE = 8192;
float *ovrInBuffer;
float *ovrOutBuffer;

void setupOVRAudio() {
ovrAudioContextConfiguration config = {};
config.acc_Size = sizeof(config);
config.acc_SampleRate = 44100;
config.acc_BufferLength = OVR_BUFFER_SIZE;
config.acc_MaxNumSources = 4;

if (ovrAudio_CreateContext(&audioContext, &config) != ovrSuccess) {
DLOG("Could not create OVRAudio context!\n");
return;
}

ovrInBuffer = ovrAudio_AllocSamples(OVR_BUFFER_SIZE);
ovrOutBuffer = ovrAudio_AllocSamples(OVR_BUFFER_SIZE * 2); // Output is stereo

// Setup source
ovrAudio_SetAudioSourcePos(audioContext, FRONT_LEFT, -5.0f, 0.0f, -10.0f);
ovrAudio_SetAudioSourceAttenuationMode(audioContext, FRONT_LEFT, ovrAudioSourceAttenuationMode_None, 1.0f);
ovrAudio_SetAudioSourceRange(audioContext, FRONT_LEFT, 0.0f, 100.0f);
ovrAudio_SetAudioSourceRadius(audioContext, FRONT_LEFT, 0.0f);

}

...

void processOVRAudio(const int16_t *in, int16_t *out, size_t sample_count) {
uint32_t status = 0;
// Deinterleave input and convert to float in ovrInBuffer
for (int i = 0; i < sample_count; i++) {
ovrInBuffer = (float)in[i * 2] / 32768.0f;
}

// Spatialize
ovrAudio_SpatializeMonoSourceInterleaved(audioContext,
FRONT_LEFT,
&status,
ovrOutBuffer, // <-- Gets filled with 0.00
ovrInBuffer);

// Mixdown spatialized, interleaved output to int16_t
for (int i = 0; i < sample_count; i++) {
out = (int16_t)(ovrOutBuffer * 32768);
}
}

5 REPLIES 5

Anonymous
Not applicable
Figured out the problem here. The input buffer size (ovrInBuffer) must match the audio context configured buffer size. (And output buffer must be 2x the size since it’s stereo.)

Anonymous
Not applicable
Does anyone know of any sample source code that uses the Audio SDK? None came in the ovr_audio_spatializer_native_1.39.0?  And for that matter, is there any other sample source code available other than what was in the VrSamples directory of the ovr_sdk_mobile_1.24.0? It seams that samples are neglected in recent years probably because function deprecations are such common place nowadays and samples break more frequently. For example, the current VrSamples has broken gradle files because of the << operator has been removed.

Anonymous
Not applicable
Hi brainware. 
Fixed compile gradle v5.x: Could not find method leftShift() for arguments. 
Here my fix github repo: https://github.com/cnnid/oculus-sdk-mobile-fix 
For Oculus Mobile SDK v1.23.0, v1.24.0 
Month ago I created bug report for v1.23.0 but still not fixed.
Hope this fix will be added in the next release.)

alonalbert
Honored Guest
Do you have a link to the bug?

Anonymous
Not applicable


Do you have a link to the bug?


If you asked about my fix repo, compile gradle v5.x: Could not find method leftShift() for arguments.
https://developer.oculus.com/bugs/bug/308765720075224/
https://developer.oculus.com/bugs/bug/406802860183379/