advertisement
48 | Native Application Framework | Mobile
Native SoundEffectContext
Use SoundEffectContext to easily play sound effects and replace sound assets without recompilation.
SoundEffectContext consists of a simple sound asset management class, SoundAssetMapping, and sound pool class, SoundPool.
The SoundAssetMapping is controlled by a JSON file in which sounds are mapped as key-value pairs, where a value is the actual path to the .wav file. For example:
"sv_touch_active" : "sv_touch_active.wav"
In code, we use the key to play the sound, which SoundEffectManger then resolves to the actual asset. For example: soundEffectContext->Play( “sv_touch_active” );
The string
“sv_touch_active” is first passed to SoundEffectContext, which resolves it to an absolute path, as long as the corresponding key was found during initialization.
The following two paths specify whether the sound file is in the res/raw folder of VrAppFramework (e.g., sounds that may be played from any app, such as default sounds or Universal Menu sounds), or the assets folder of a specific app: or
“res/raw/ sv_touch_active.wav"
“assets/ sv_touch_active.wav"
If SoundEffectContext fails to resolve the passed-in string within the
SoundEffectContext::Play function, the string is passed to
SoundPooler.play in Java. In SoundPooler.play, we first try to play the passed-in sound from res/raw, and if that fails, from the current assets folder. If that also fails, we attempt to play it as an absolute path. The latter allows for sounds to be played from the phone’s internal memory or SD card.
The JSON file loaded by SoundAssetMapping determines which assets are used with the following scheme:
1. Try to load sounds_assets.json in the Oculus folder on the sdcard: sdcard/Oculus/sound_assets.json
2. If we fail to find the above file, we the load the following two files in this order: res/raw/sound_assets.json
assets/sound_assets.json
The loading of the sound_assets.json in the first case allows for a definition file and sound assets to be placed on the SD card in the Oculus folder during sound development. The sounds may be placed into folders if desired, as long as the relative path is included in the definition.
For example, if we define the following in sdcard/Oculus/sound_assets.json:
"sv_touch_active" : "SoundDev/my_new_sound.wav" we would replace all instances of that sound being played with our new sound within the SoundDev folder.
The loading of the two asset definition files in the second step allows for overriding the framework's built-in sound definitions, including disabling sounds by redefining their asset as the empty string. For example:
"sv_touch_active" : ""
The above key-value pair, if defined in an app’s sound_assets.json (placed in its asset folder), will disable that sound completely, even though it is still played by other VrAppSupport code such as VrGUI.
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 3 Contents
- 6 Mobile SDK Getting Started Guide
- 6 Getting Started with the SDK
- 7 Mobile Development with Unity and Unreal
- 7 Mobile Development with Unity
- 8 Mobile Development with Unreal
- 9 System and Hardware Requirements
- 11 Device Setup
- 12 Android Development Software Setup for Windows
- 13 Java Development Kit (JDK)
- 13 Android Studio Installation
- 13 Standalone Android SDK Tools
- 14 Installing Additional Packages and Tools
- 14 Android Native Development Kit (NDK)
- 15 Gradle
- 15 Setting up your System to Detect your Android Device
- 15 Android Development Software Setup for Mac OS X
- 16 Xcode
- 16 Java Development Kit (JDK)
- 16 Android Studio Installation
- 16 Standalone Android SDK Tools
- 17 Installing Additional Packages and Tools
- 17 Android Native Development Kit (NDK)
- 18 Gradle
- 20 Mobile Development Basics
- 20 Oculus Signature File (osig) and Application Signing
- 21 Developer Mode: Running Apps Outside of the Gear VR Headset
- 21 Universal Menu and Reserved User Interactions
- 22 Reserved User Interactions
- 22 Universal Menu
- 23 Android Studio Basics
- 27 Native Development Overview
- 27 Native Source Code
- 28 Native Samples
- 29 Android Manifest Settings
- 30 Native Engine Integration
- 30 VrApi
- 30 Lifecycle and Rendering
- 33 Frame Timing
- 33 Latency Controls
- 35 Asynchronous TimeWarp
- 37 TimeWarp Minimum Vsyncs
- 37 Consequences of not rendering at 60 FPS
- 38 Power Management
- 39 Fixed Clock Level API
- 39 Power Management and Performance
- 40 Power State Notification and Mitigation Strategy
- 41 Advanced Rendering
- 41 Multi-View
- 46 Native Application Framework
- 46 Creating New Apps with the Framework Template
- 47 UI and Input Handling
- 48 Native SoundEffectContext
- 49 Runtime Threads
- 50 Other Native Libraries
- 51 Media and Assets
- 51 Mobile VR Media Overview
- 51 Panoramic Stills
- 51 Panoramic Videos
- 52 Movies on Screens
- 52 Movie Meta-data
- 53 Oculus 360 Photos and Videos Meta-data
- 53 Media Locations
- 54 Native VR Media Applications
- 56 Models
- 56 Oculus Cinema Theater Creation
- 56 Detailed Instructions
- 62 Theater Design Principles
- 62 FBX Converter
- 63 Overview
- 63 Coordinate System
- 64 Materials
- 65 Animations
- 65 Tags
- 65 Command-Line Interface
- 66 Options
- 67 Batch Execution
- 67 Troubleshooting
- 67 Optimization
- 67 Reducing Draw Calls
- 68 Reducing Vertices
- 68 Reducing Overdraw
- 70 Mobile Best Practices
- 70 Rendering Guidelines
- 70 Mobile VR Performance
- 71 Frame Rate
- 71 Scenes
- 72 Resolution
- 72 User Interface Guidelines
- 72 Stereoscopic UI Rendering
- 72 The Infinity Problem
- 73 Depth In-Depth
- 73 Gazing Into Virtual Reality
- 74 Adreno Hardware Profile
- 76 Testing and Troubleshooting
- 76 Tools and Procedures
- 76 Android System Properties and Local Preferences
- 79 Screenshot and Video Capture
- 81 Oculus Remote Monitor and VrCapture
- 81 VrCapture
- 83 Oculus Remote Monitor
- 83 Setup
- 84 Basic Usage
- 92 Using Oculus Remote Monitor to Identify Common Issues
- 96 Android Debugging
- 97 Adb
- 98 Logcat
- 99 Using Logcat to Determine the Cause of a Crash
- 99 Getting a Better Stack Trace
- 100 Application Performance Analysis
- 100 Basic Performance Stats through Logcat
- 101 SysTrace
- 102 NDK Profiler
- 103 Rendering Performance: Tracer for OpenGL ES
- 105 Android Studio Native Debugging
- 105 Native Debugging with Android Studio
- 108 Native Debugging with ndk-gdb
- 111 Mobile Native SDK Migration Guide
- 111 Migrating to Mobile SDK 1.0.4
- 113 Migrating to Mobile SDK 1.0.3
- 121 Migrating to Mobile SDK 1.0.0
- 124 Migrating to Mobile SDK 0.6.2.0
- 126 Migrating to Mobile SDK 0.6.1.0
- 128 Migrating to Mobile SDK 0.6.0
- 135 Release Notes
- 135 1.0 Release Notes
- 139 0.6 Release Notes
- 145 0.5 Release Notes
- 149 0.4 Release Notes
- 152 System Activities/VrApi Release Notes
- 152 1.11.x Release Notes
- 152 1.10.x Release Notes
- 153 1.0.x Release Notes
- 157 System Driver Release Notes
- 157 1.5.x Release Notes
- 157 1.0.x Release Notes
- 158 Oculus Remote Monitor Release Notes
- 158 1.x Release Notes