This site has been permanently archived. The content on this site was last updated in 2019.
Stay organized with collections
Save and categorize content based on your preferences.
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
int64_t AddInterleavedInput(
const int16_t *input_buffer_ptr,
int64_t num_samples
)
Clear
void Clear()
Removes all buffered input and processed output buffers from the buffer queues.
For more information, see gvr_audio_surround_clear().
int64_t GetAvailableInputSizeSamples() const
GetAvailableOutputSizeSamples
int64_t GetAvailableOutputSizeSamples() const
GetInterleavedOutput
int64_t GetInterleavedOutput(
int16_t *output_buffer_ptr,
int64_t num_samples
)
Init
bool Init(
AudioSurroundFormat surround_format,
int32_t num_input_channels,
int32_t frames_per_buffer,
int sample_rate_hz
)
SetHeadRotation
void SetHeadRotation(
float w,
float x,
float y,
float z
)
TriggerProcessing
bool TriggerProcessing()
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-09 UTC."],[[["\u003cp\u003e\u003ccode\u003egvr::AudioSurroundApi\u003c/code\u003e is a C++ wrapper for the Audio Surround C API, designed to maintain ABI compatibility.\u003c/p\u003e\n"],["\u003cp\u003eThe wrapper facilitates communication between client code and the \u003ccode\u003elibgvr.so\u003c/code\u003e implementation using a pure C interface.\u003c/p\u003e\n"],["\u003cp\u003eThis class is thread-safe and reentrant after initialization using the \u003ccode\u003eInit()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods for adding, processing, and retrieving spatial audio data, as well as controlling head rotation for immersive audio experiences.\u003c/p\u003e\n"],["\u003cp\u003eFor detailed information about individual methods, refer to the corresponding functions in the C API documentation.\u003c/p\u003e\n"]]],["The `AudioSurroundApi` C++ wrapper facilitates audio processing through a C interface, ensuring ABI compatibility. Key actions include initializing the audio context via `Init`, adding audio data with `AddInterleavedInput`, retrieving processed output with `GetInterleavedOutput`, and managing buffers with `Clear`. Additional functionality includes getting buffer sizes with `GetAvailableInputSizeSamples` and `GetAvailableOutputSizeSamples`, setting head rotation via `SetHeadRotation`, and processing queued data using `TriggerProcessing`. This class is thread-safe after initialization.\n"],null,["# gvr::AudioSurroundApi Class Reference\n\ngvr::AudioSurroundApi\n=====================\n\n`#include \u003cgvr_audio_surround.h\u003e`\n\nThis is a convenience C++ wrapper for the Audio Surround C API.\n\nSummary\n-------\n\nThis 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.\n\nMethods 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.\n\nTHREADING: this class is thread-safe and reentrant after initialized with [Init()](/vr/reference/ios-ndk/class/gvr/audio-surround-api#classgvr_1_1_audio_surround_api_1a3b52399375c39f001856920b4819b8d0).\n\n### Inheritance\n\nInherits from: [gvr::WrapperBase\\\u003c gvr_audio_surround_context, gvr_audio_surround_destroy \\\u003e](/vr/reference/ios-ndk/class/gvr/wrapper-base)\n\n| ### Public functions ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|\n| [AddInterleavedInput](#classgvr_1_1_audio_surround_api_1a6f415c6d8c497cde7d6bde4d7ab08b97)`(const int16_t *input_buffer_ptr, int64_t num_samples)` | `int64_t` Adds interleaved audio data to the renderer. |\n| [Clear](#classgvr_1_1_audio_surround_api_1ade71b2f3655fb77e19cff0a46c21430d)`()` | `void` Removes all buffered input and processed output buffers from the buffer queues. |\n| [GetAvailableInputSizeSamples](#classgvr_1_1_audio_surround_api_1a6f5abd48313b486f2e083f5bc30cb473)`() const ` | `int64_t` Returns the number of samples the input buffer is currently able to consume. |\n| [GetAvailableOutputSizeSamples](#classgvr_1_1_audio_surround_api_1a7f0e88298206d3620e0add3631a11c77)`() const ` | `int64_t` Returns the number of samples available in the output buffer. |\n| [GetInterleavedOutput](#classgvr_1_1_audio_surround_api_1a9dadb386ee0f488338b63dceba4f6f91)`(int16_t *output_buffer_ptr, int64_t num_samples)` | `int64_t` Gets a processed output buffer in interleaved format. |\n| [Init](#classgvr_1_1_audio_surround_api_1a3b52399375c39f001856920b4819b8d0)`(`[AudioSurroundFormat](/vr/reference/ios-ndk/group/types#group__types_1gab85687cb403c1ee4b589bb29d5b0dfa0)` surround_format, int32_t num_input_channels, int32_t frames_per_buffer, int sample_rate_hz)` | `bool` Creates and initializes a gvr_audio_context. |\n| [SetHeadRotation](#classgvr_1_1_audio_surround_api_1a800dac701c9136cdaa4e39d51a5d041f)`(float w, float x, float y, float z)` | `void` Updates the head rotation. |\n| [TriggerProcessing](#classgvr_1_1_audio_surround_api_1a19db5bb494ad6cdb4f7914bbde4ae719)`()` | `bool` Triggers the processing of data that has been input but not yet processed. |\n\nPublic functions\n----------------\n\n### AddInterleavedInput\n\n```gdscript\nint64_t AddInterleavedInput(\n const int16_t *input_buffer_ptr,\n int64_t num_samples\n)\n``` \nAdds interleaved audio data to the renderer.\n\nFor more information, see [gvr_audio_surround_add_interleaved_input()](/vr/reference/ios-ndk/group/audio-surround#group___audio_surround_1ga9bc0ff92bdaa03f12d4ade5c0c9b27bf). \n\n### Clear\n\n```text\nvoid Clear()\n``` \nRemoves all buffered input and processed output buffers from the buffer queues.\n\nFor more information, see [gvr_audio_surround_clear()](/vr/reference/ios-ndk/group/audio-surround#group___audio_surround_1gaacbb3206db208b0b8d705745eafb0ce0). \n\n### GetAvailableInputSizeSamples\n\n```gdscript\nint64_t GetAvailableInputSizeSamples() const \n``` \nReturns the number of samples the input buffer is currently able to consume.\n\nFor more information, see [gvr_audio_surround_get_available_input_size_samples()](/vr/reference/ios-ndk/group/audio-surround#group___audio_surround_1gac06bedb0b155d54e1f4f721aa1ce144b). \n\n### GetAvailableOutputSizeSamples\n\n```gdscript\nint64_t GetAvailableOutputSizeSamples() const \n``` \nReturns the number of samples available in the output buffer.\n\nFor more information, see [gvr_audio_surround_get_available_output_size_samples()](/vr/reference/ios-ndk/group/audio-surround#group___audio_surround_1ga0435f5c19ce1900ab8ff0d45d0f25fc6). \n\n### GetInterleavedOutput\n\n```scdoc\nint64_t GetInterleavedOutput(\n int16_t *output_buffer_ptr,\n int64_t num_samples\n)\n``` \nGets a processed output buffer in interleaved format.\n\nFor more information, see [gvr_audio_surround_get_interleaved_output()](/vr/reference/ios-ndk/group/audio-surround#group___audio_surround_1ga51d3aeefaa2c480f66d7949d0888588c). \n\n### Init\n\n```scdoc\nbool Init(\n AudioSurroundFormat surround_format,\n int32_t num_input_channels,\n int32_t frames_per_buffer,\n int sample_rate_hz\n)\n``` \nCreates and initializes a gvr_audio_context.\n\nFor more information, see [gvr_audio_surround_create()](/vr/reference/ios-ndk/group/audio-surround#group___audio_surround_1ga31f1e804fe02850fc105a64422a584ce). \n\n### SetHeadRotation\n\n```text\nvoid SetHeadRotation(\n float w,\n float x,\n float y,\n float z\n)\n``` \nUpdates the head rotation.\n\nFor more information, see [gvr_audio_surround_set_head_rotation()](/vr/reference/ios-ndk/group/audio-surround#group___audio_surround_1ga7bd29287df0cd57c51981406678782de). \n\n### TriggerProcessing\n\n```text\nbool TriggerProcessing()\n``` \nTriggers the processing of data that has been input but not yet processed.\n\nFor more information, see [gvr_audio_surround_trigger_processing()](/vr/reference/ios-ndk/group/audio-surround#group___audio_surround_1ga868300c2322231fbb2cec8f9dce8bede)."]]