gvr::AudioSurroundApi

#include <gvr_audio_surround.h>

This is a convenience C++ wrapper for the Audio Surround C API.

Summary

This wrapper strategy prevents ABI compatibility issues between compilers by ensuring that the interface between client code and the implementation code in libgvr.so is a pure C interface. The translation from C++ calls to C calls provided by this wrapper runs entirely in the client's binary and is compiled by the client's compiler.

Methods in this class are only documented insofar as the C++ wrapping logic is concerned; for information about the method itself, please refer to the corresponding function in the C API.

THREADING: this class is thread-safe and reentrant after initialized with Init().

Inheritance

Inherits from: gvr::WrapperBase< gvr_audio_surround_context, gvr_audio_surround_destroy >

Public functions

AddInterleavedInput(const int16_t *input_buffer_ptr, int64_t num_samples)
int64_t
Adds interleaved audio data to the renderer.
Clear()
void
Removes all buffered input and processed output buffers from the buffer queues.
GetAvailableInputSizeSamples() const
int64_t
Returns the number of samples the input buffer is currently able to consume.
GetAvailableOutputSizeSamples() const
int64_t
Returns the number of samples available in the output buffer.
GetInterleavedOutput(int16_t *output_buffer_ptr, int64_t num_samples)
int64_t
Gets a processed output buffer in interleaved format.
Init(AudioSurroundFormat surround_format, int32_t num_input_channels, int32_t frames_per_buffer, int sample_rate_hz)
bool
Creates and initializes a gvr_audio_context.
SetHeadRotation(float w, float x, float y, float z)
void
Updates the head rotation.
TriggerProcessing()
bool
Triggers the processing of data that has been input but not yet processed.

Public functions

AddInterleavedInput

int64_t AddInterleavedInput(
  const int16_t *input_buffer_ptr,
  int64_t num_samples
)

Adds interleaved audio data to the renderer.

For more information, see gvr_audio_surround_add_interleaved_input().

Clear

void Clear()

Removes all buffered input and processed output buffers from the buffer queues.

For more information, see gvr_audio_surround_clear().

GetAvailableInputSizeSamples

int64_t GetAvailableInputSizeSamples() const 

Returns the number of samples the input buffer is currently able to consume.

For more information, see gvr_audio_surround_get_available_input_size_samples().

GetAvailableOutputSizeSamples

int64_t GetAvailableOutputSizeSamples() const 

Returns the number of samples available in the output buffer.

For more information, see gvr_audio_surround_get_available_output_size_samples().

GetInterleavedOutput

int64_t GetInterleavedOutput(
  int16_t *output_buffer_ptr,
  int64_t num_samples
)

Gets a processed output buffer in interleaved format.

For more information, see gvr_audio_surround_get_interleaved_output().

Init

bool Init(
  AudioSurroundFormat surround_format,
  int32_t num_input_channels,
  int32_t frames_per_buffer,
  int sample_rate_hz
)

Creates and initializes a gvr_audio_context.

For more information, see gvr_audio_surround_create().

SetHeadRotation

void SetHeadRotation(
  float w,
  float x,
  float y,
  float z
)

Updates the head rotation.

For more information, see gvr_audio_surround_set_head_rotation().

TriggerProcessing

bool TriggerProcessing()

Triggers the processing of data that has been input but not yet processed.

For more information, see gvr_audio_surround_trigger_processing().