Skip to content
This repository was archived by the owner on Nov 8, 2019. It is now read-only.

Commit e4eeb86

Browse files
committed
GVR Android SDK v1.70.0
1 parent a27f768 commit e4eeb86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+186
-71
lines changed

apks/controller_emulator.apk

754 KB
Binary file not shown.

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ task clean(type: Delete) {
2929
// The dependencies for NDK builds live inside the .aar files so they need to
3030
// be extracted before NDK targets can build.
3131
task extractAudioSo(type: Copy) {
32-
from zipTree("${project.rootDir}/libraries/sdk-audio-1.60.1.aar")
32+
from zipTree("${project.rootDir}/libraries/sdk-audio-1.70.0.aar")
3333
into "${project.rootDir}/libraries/"
3434
include "jni/**/libgvr_audio.so"
3535
}
3636

3737
task extractGvrSo(type: Copy) {
38-
from zipTree("${project.rootDir}/libraries/sdk-base-1.60.1.aar")
38+
from zipTree("${project.rootDir}/libraries/sdk-base-1.70.0.aar")
3939
into "${project.rootDir}/libraries/"
4040
include "jni/**/libgvr.so"
4141
}

libraries/headers/vr/gvr/capi/include/gvr.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ extern "C" {
9494
/// right_eye_matrix);
9595
/// AppSetRenderTarget(primary_display);
9696
///
97-
/// gvr_frame_submit(&frame, viewport_list, head_matrix);
97+
/// gvr_frame_submit(&frame, viewport_list, head_view);
9898
/// }
9999
///
100100
/// // Cleanup memory.
@@ -219,8 +219,7 @@ void gvr_destroy(gvr_context** gvr);
219219

220220
/// Initializes necessary GL-related objects and uses the current thread and
221221
/// GL context for rendering. Please make sure that a valid GL context is
222-
/// available when this function is called. This should never be called more
223-
/// than once on the same GL context (doing so would cause resource leaks).
222+
/// available when this function is called.
224223
///
225224
/// @param gvr Pointer to the gvr instance to be initialized.
226225
void gvr_initialize_gl(gvr_context* gvr);
@@ -689,6 +688,10 @@ void gvr_swap_chain_resize_buffer(gvr_swap_chain* swap_chain, int32_t index,
689688
/// is finished and all its constituent buffers are ready, call
690689
/// gvr_frame_submit() to display it while applying lens distortion.
691690
///
691+
/// When this is called, the current thread's GL context must be the same
692+
/// context that was current when gvr_initialize_gl() was called, or at least be
693+
/// in a share group with the initialization context.
694+
///
692695
/// @param swap_chain The swap chain.
693696
/// @return Handle to the acquired frame. NULL if the swap chain is invalid,
694697
/// or if acquire has already been called on this swap chain.
@@ -1542,7 +1545,7 @@ class SwapChain {
15421545
/// AppDoSomeRenderingForEye(
15431546
/// right_eye_viewport.GetSourceUv(), right_eye_view);
15441547
/// frame.Unbind();
1545-
/// frame.Submit(viewport_list, head_matrix);
1548+
/// frame.Submit(viewport_list, head_view);
15461549
/// }
15471550
///
15481551
class GvrApi {

libraries/headers/vr/gvr/capi/include/gvr_audio.h

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ extern "C" {
125125
/// NOTE: If a sound object, soundfield or stereo sound is created with a file
126126
/// that has not been preloaded, that audio will be streamed.
127127
///
128-
/// **Spatializtion of sound objects**
128+
/// **Spatialization of sound objects**
129129
///
130130
/// The GVR Audio System allows the user to create virtual sound objects which
131131
/// can be placed anywhere in space around the listener.
@@ -149,6 +149,23 @@ extern "C" {
149149
/// gvr_audio_set_sound_volume(gvr_audio_context* api,
150150
/// gvr_audio_source_id source_id, float volume);
151151
///
152+
/// The GVR Audio System also support directivity patterns per sound source
153+
/// which define a shape or pattern that describes the way in which sound
154+
/// emanates from a source in different directions. The directivity pattern
155+
/// takes two values: alpha and order. Alpha is a weighting balance between a
156+
/// figure-8 pattern and omnidirectional pattern for source emission in the
157+
/// range [0, 1]. A value of 0.5 results in a cardioid pattern. Order is applied
158+
/// to computed directivity. Higher values will result in narrower and sharper
159+
/// directivity patterns, with a range of [1, inf).
160+
///
161+
/// void gvr_audio_set_sound_object_directivity(
162+
/// gvr_audio_context* api, gvr_audio_source_id sound_object_id,
163+
/// float alpha, float order);
164+
///
165+
/// void gvr_audio_set_sound_object_rotation(
166+
/// gvr_audio_context* api, gvr_audio_source_id sound_object_id,
167+
/// gvr_quatf sound_object_rotation);
168+
///
152169
/// The behavior of Sound Objects with respect to their distance from the
153170
/// listener can be controlled via calls to the following method:
154171
///
@@ -424,8 +441,9 @@ void gvr_audio_unload_soundfile(gvr_audio_context* api, const char* filename);
424441
///
425442
/// @param api Pointer to a gvr_audio_context.
426443
/// @param filename The path/name of the file to be played.
427-
/// @return Id of new sound object. Returns kInvalidId if the sound file has not
428-
/// been preloaded or if the number of input channels is > 1.
444+
/// @return Id of new sound object. Returns GVR_AUDIO_INVALID_SOURCE_ID if the
445+
/// sound file has not been preloaded or if the number of input channels
446+
/// is > 1.
429447
gvr_audio_source_id gvr_audio_create_sound_object(gvr_audio_context* api,
430448
const char* filename);
431449

@@ -435,9 +453,9 @@ gvr_audio_source_id gvr_audio_create_sound_object(gvr_audio_context* api,
435453
///
436454
/// @param api Pointer to a gvr_audio_context.
437455
/// @param filename The path/name of the file to be played.
438-
/// @return Id of new soundfield. Returns kInvalidId if the sound file has not
439-
/// been preloaded or if the number of input channels does not match that
440-
/// required.
456+
/// @return Id of new soundfield. Returns GVR_AUDIO_INVALID_SOURCE_ID if the
457+
/// sound file has not been preloaded or if the number of input channels
458+
/// does not match that required.
441459
gvr_audio_source_id gvr_audio_create_soundfield(gvr_audio_context* api,
442460
const char* filename);
443461

@@ -447,9 +465,9 @@ gvr_audio_source_id gvr_audio_create_soundfield(gvr_audio_context* api,
447465
///
448466
/// @param api Pointer to a gvr_audio_context.
449467
/// @param filename The path/name of the file to be played..
450-
/// @return Id of new stereo non-spatialized source. Returns kInvalidId if the
451-
/// sound file has not been preloaded or if the number of input channels is
452-
/// > 2;
468+
/// @return Id of new stereo non-spatialized source. Returns
469+
/// GVR_AUDIO_INVALID_SOURCE_ID if the sound file has not been preloaded or
470+
/// if the number of input channels is > 2;
453471
gvr_audio_source_id gvr_audio_create_stereo_sound(gvr_audio_context* api,
454472
const char* filename);
455473

@@ -511,6 +529,29 @@ void gvr_audio_set_sound_object_position(gvr_audio_context* api,
511529
gvr_audio_source_id sound_object_id,
512530
float x, float y, float z);
513531

532+
/// Sets the sound object directivity constants for an existing sound object.
533+
///
534+
/// @param api Pointer to a gvr_audio_context.
535+
/// @param sound_object_id Id of the sound object to configure.
536+
/// @param alpha A weighting balance between a figure-8 pattern and
537+
/// omnidirectional pattern for source emission in the range [0, 1]. A value
538+
/// of 0.5 results in a cardioid pattern.
539+
/// @param order Applied to computed directivity. Higher values will result in
540+
/// narrower and sharper directivity patterns, with a range of [1, inf).
541+
void gvr_audio_set_sound_object_directivity(gvr_audio_context* api,
542+
gvr_audio_source_id sound_object_id,
543+
float alpha, float order);
544+
545+
/// Sets the given sound object's rotation. Only applies if
546+
/// gvr_audio_set_sound_object_directivity has been called on the sound.
547+
///
548+
/// @param api Pointer to a gvr_audio_context.
549+
/// @param soundfield_id Id of the sound object to be rotated.
550+
/// @param object_rotation Quaternion representing the sound object rotation.
551+
void gvr_audio_set_sound_object_rotation(gvr_audio_context* api,
552+
gvr_audio_source_id sound_object_id,
553+
gvr_quatf sound_object_rotation);
554+
514555
/// Sets the given ambisonic soundfields's rotation.
515556
///
516557
/// @param api Pointer to a gvr_audio_context.
@@ -747,6 +788,22 @@ class AudioApi {
747788
gvr_audio_set_sound_object_position(context_, sound_object_id, x, y, z);
748789
}
749790

791+
/// Sets directivity constants for an existing sound object.
792+
/// For more information, see gvr_audio_set_sound_object_directivity.
793+
void SetSoundObjectDirectivity(AudioSourceId sound_object_id, float alpha,
794+
float order) {
795+
gvr_audio_set_sound_object_directivity(context_, sound_object_id, alpha,
796+
order);
797+
}
798+
799+
/// Sets the rotation for an existing sound object.
800+
/// For more information, see gvr_audio_set_sound_object_rotation.
801+
void SetSoundObjectRotation(AudioSourceId sound_object_id,
802+
const Quatf& sound_object_quat) {
803+
gvr_audio_set_sound_object_rotation(context_, sound_object_id,
804+
sound_object_quat);
805+
}
806+
750807
void SetSoundObjectDistanceRolloffModel(
751808
AudioSourceId sound_object_id,
752809
gvr_audio_distance_rolloff_type rolloff_model, float min_distance,

libraries/headers/vr/gvr/capi/include/gvr_controller.h

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ void gvr_controller_destroy(gvr_controller_context** api);
154154
/// Calling this when already paused is a no-op.
155155
/// Thread-safe (call from any thread).
156156
///
157-
/// @param api Pointer to a pointer to a gvr_controller_context.
157+
/// @param api Pointer to a gvr_controller_context.
158158
void gvr_controller_pause(gvr_controller_context* api);
159159

160160
/// Resumes the controller. Call this when your app/game regains focus.
161161
/// Calling this when already resumed is a no-op.
162162
/// Thread-safe (call from any thread).
163163
///
164-
/// @param api Pointer to a pointer to a gvr_controller_context.
164+
/// @param api Pointer to a gvr_controller_context.
165165
void gvr_controller_resume(gvr_controller_context* api);
166166

167167
/// Convenience to convert an API status code to string. The returned pointer
@@ -196,9 +196,9 @@ void gvr_controller_state_destroy(gvr_controller_state** state);
196196
/// const getter: it has side-effects. In particular, some of the
197197
/// gvr_controller_state fields (the ones documented as "transient") represent
198198
/// one-time events and will be true for only one read operation, and false
199-
/// in subsequente reads.
199+
/// in subsequent reads.
200200
///
201-
/// @param api Pointer to a pointer to a gvr_controller_context.
201+
/// @param api Pointer to a gvr_controller_context.
202202
/// @param flags Optional flags reserved for future use. A value of 0 should be
203203
/// used until corresponding flag attributes are defined and documented.
204204
/// @param out_state A pointer where the controller's state
@@ -207,6 +207,26 @@ void gvr_controller_state_destroy(gvr_controller_state** state);
207207
void gvr_controller_state_update(gvr_controller_context* api, int32_t flags,
208208
gvr_controller_state* out_state);
209209

210+
/// Sets up arm model with user's handedness, gaze behavior and head rotation.
211+
/// This setting needs to be applied for every frame. User preferences of
212+
/// handedness and gaze behavior can be changed as needed in a sequence of
213+
/// frames. This needs to be called before gvr_controller_state_update() to
214+
/// apply arm model. GVR_CONTROLLER_ENABLE_ARM_MODEL flag needs to be enabled
215+
/// to apply arm model.
216+
///
217+
/// @param api Pointer to a gvr_controller_context.
218+
/// @param handedness User's preferred handedness (GVR_CONTROLLER_RIGHT_HANDED
219+
/// or GVR_CONTROLLER_LEFT_HANDED). Arm model will assume this is the hand
220+
/// that is holding the controller and position the arm accordingly.
221+
/// @param behavior User's preferred gaze behavior (SYNC_GAZE / FOLLOW_GAZE
222+
/// / IGNORE_GAZE). Arm model uses this to determine how the body rotates as
223+
/// gaze direction (i.e. head rotation) changes.
224+
/// @param head_space_from_start_space_rotation User's head rotation with
225+
/// respect to start space.
226+
void gvr_controller_apply_arm_model(
227+
gvr_controller_context* api, int32_t handedness, int32_t behavior,
228+
gvr_mat4f head_space_from_start_space_rotation);
229+
210230
/// Gets the API status of the controller state. Returns one of the
211231
/// gvr_controller_api_status variants, but returned as an int32_t for ABI
212232
/// compatibility.
@@ -245,8 +265,8 @@ int32_t gvr_controller_state_get_connection_state(
245265
/// time due to controller/headset drift. A recentering operation will bring
246266
/// the two spaces back into sync.
247267
///
248-
/// Remember that a quaternion expresses a rotation. Given a rotation of theta
249-
/// radians about the (x, y, z) axis, the corresponding quaternion (in
268+
/// Remember that a unit quaternion expresses a rotation. Given a rotation of
269+
/// theta radians about the (x, y, z) axis, the corresponding quaternion (in
250270
/// xyzw order) is:
251271
///
252272
/// (x * sin(theta/2), y * sin(theta/2), z * sin(theta/2), cos(theta/2))
@@ -441,7 +461,6 @@ const char* gvr_controller_battery_level_to_string(int32_t level);
441461
} // extern "C"
442462
#endif
443463

444-
445464
// Convenience C++ wrapper.
446465
#if defined(__cplusplus) && !defined(GVR_NO_CPP_WRAPPER)
447466

@@ -600,8 +619,18 @@ class ControllerApi {
600619
/// @name Wrapper manipulation
601620
/// @{
602621
/// Creates a C++ wrapper for a C object and takes ownership.
603-
explicit ControllerApi(gvr_controller_context* context)
604-
: context_(context) {}
622+
explicit ControllerApi(gvr_controller_context* context) : context_(context) {}
623+
624+
/// For more information, see
625+
/// gvr_controller_apply_arm_model(gvr_controller_context* api, int32_t
626+
/// handedness, int32_t behavior, gvr_mat4f
627+
/// head_space_from_start_space_rotation);
628+
void ApplyArmModel(const ControllerHandedness handedness,
629+
const ArmModelBehavior behavior,
630+
const Mat4f& head_space_from_start_space_rotation) {
631+
gvr_controller_apply_arm_model(context_, handedness, behavior,
632+
head_space_from_start_space_rotation);
633+
}
605634

606635
/// Returns the wrapped C object. Does not affect ownership.
607636
gvr_controller_context* cobj() { return context_; }

libraries/headers/vr/gvr/capi/include/gvr_types.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ enum {
203203
GVR_CONTROLLER_ENABLE_POSITION = 1 << 6,
204204
/// Indicates that controller battery data should be reported.
205205
GVR_CONTROLLER_ENABLE_BATTERY = 1 << 7,
206+
/// Indicates that elbow model should be enabled.
207+
GVR_CONTROLLER_ENABLE_ARM_MODEL = 1 << 8,
206208
};
207209

208210
/// Constants that represent the status of the controller API.
@@ -431,6 +433,16 @@ typedef enum {
431433
GVR_CONTROLLER_LEFT_HANDED = 1,
432434
} gvr_controller_handedness;
433435

436+
/// Types of gaze behaviors used for arm model.
437+
typedef enum {
438+
// Body rotation matches head rotation all the time.
439+
GVR_ARM_MODEL_SYNC_GAZE = 0,
440+
// Body rotates as head rotates, but at a smaller angle.
441+
GVR_ARM_MODEL_FOLLOW_GAZE = 1,
442+
// Body doesn't rotate as head rotates.
443+
GVR_ARM_MODEL_IGNORE_GAZE = 2,
444+
} gvr_arm_model_behavior;
445+
434446
typedef struct gvr_user_prefs_ gvr_user_prefs;
435447

436448
// Anonymous enum for miscellaneous integer constants.
@@ -444,6 +456,9 @@ enum {
444456
/// gvr_buffer_viewport_set_source_buffer_index() to use the external surface
445457
/// as the buffer contents.
446458
GVR_BUFFER_INDEX_EXTERNAL_SURFACE = -1,
459+
/// Invalid source id that can be used to initialize source id variables
460+
/// during construction.
461+
GVR_AUDIO_INVALID_SOURCE_ID = -1,
447462
};
448463

449464
/// @}
@@ -540,6 +555,10 @@ const ControllerBatteryLevel kControllerBatteryLevelFull =
540555
const int32_t kUninitializedExternalSurface = GVR_BUFFER_INDEX_EXTERNAL_SURFACE;
541556
/// The default source buffer index for viewports.
542557
const int32_t kDefaultBufferIndex = 0;
558+
/// Invalid source id that can be used to initialize source id variables
559+
/// during construction.
560+
typedef gvr_audio_source_id AudioSourceId;
561+
const AudioSourceId kInvalidSourceId = GVR_AUDIO_INVALID_SOURCE_ID;
543562

544563
typedef gvr_eye Eye;
545564

@@ -566,7 +585,6 @@ typedef gvr_quatf ControllerQuat;
566585
typedef gvr_audio_rendering_mode AudioRenderingMode;
567586
typedef gvr_audio_material_type AudioMaterialName;
568587
typedef gvr_audio_distance_rolloff_type AudioRolloffMethod;
569-
typedef gvr_audio_source_id AudioSourceId;
570588
typedef gvr_audio_surround_format_type AudioSurroundFormat;
571589

572590
typedef gvr_color_format_type ColorFormat;
@@ -599,6 +617,12 @@ const ControllerHandedness kControllerRightHanded =
599617
const ControllerHandedness kControllerLeftHanded =
600618
static_cast<ControllerHandedness>(GVR_CONTROLLER_LEFT_HANDED);
601619

620+
typedef gvr_arm_model_behavior ArmModelBehavior;
621+
const ArmModelBehavior kArmModelBehaviorFollowGaze =
622+
static_cast<ArmModelBehavior>(GVR_ARM_MODEL_FOLLOW_GAZE);
623+
const ArmModelBehavior kArmModelBehaviorSyncGaze =
624+
static_cast<ArmModelBehavior>(GVR_ARM_MODEL_SYNC_GAZE);
625+
602626
typedef gvr_error Error;
603627
const Error kErrorNone = static_cast<Error>(GVR_ERROR_NONE);
604628
const Error kErrorControllerCreateFailed =

libraries/sdk-audio-1.60.1.aar

-778 KB
Binary file not shown.

libraries/sdk-audio-1.70.0.aar

771 KB
Binary file not shown.

libraries/sdk-audio-1.60.1.pom renamed to libraries/sdk-audio-1.70.0.pom

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.google.vr</groupId>
66
<artifactId>sdk-audio</artifactId>
7-
<version>1.60.1</version>
7+
<version>1.70.0</version>
88
<packaging>aar</packaging>
99

1010
<name>Google VR SDK-Audio</name>
@@ -19,7 +19,7 @@
1919
<groupId>com.google.vr</groupId>
2020
<artifactId>sdk-base</artifactId>
2121
<type>aar</type>
22-
<version>1.60.1</version>
22+
<version>1.70.0</version>
2323
</dependency>
2424
</dependencies>
2525
</project>

libraries/sdk-base-1.60.1.aar

-2.13 MB
Binary file not shown.

0 commit comments

Comments
 (0)