RavEngine
Loading...
Searching...
No Matches
wwise_common.h
1/*
2Copyright 2018 Google Inc. All Rights Reserved.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS-IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#ifndef RESONANCE_AUDIO_PLATFORM_WWISE_WWISE_COMMON_H_
18#define RESONANCE_AUDIO_PLATFORM_WWISE_WWISE_COMMON_H_
19
20#include <list>
21#include <memory>
22#include <vector>
23
24#include "AK/SoundEngine/Common/AkCommonDefs.h"
25#include "AK/SoundEngine/Common/AkTypes.h"
26#include "AK/Tools/Common/AkAssert.h"
27#include "api/resonance_audio_api.h"
28
29namespace vraudio {
30namespace wwise {
31
32// Number of channels in stereo output configuration.
33const size_t kNumStereoChannels = 2;
34
35// Company ID reserved for Google third-party plugins.
36const AkUInt32 kCompanyId = 272;
37
38// Plugin ID for Google VR binaural renderer.
39const AkUInt32 kRendererPluginId = 100;
40
41// Plugin ID for Google VR room effects.
42const AkUInt32 kRoomEffectsPluginId = 200;
43
44// Plugin ID for Google VR room effects attachment.
45const AkUInt32 kRoomEffectsAttachmentPluginId = 201;
46
47// Invalid plugin instance id.
48const int kInvalidInstanceId = -1;
49
50// Default dialog id for a plugin UI window in the Wwise Authoring app. This
51// should be passed as the dialog id if no custom dialog window is implemented.
52const unsigned int kDefaultPluginDialogId = 0;
53
54// Stores a singleton ResonanceAudio system with a reference count.
57 : api(nullptr), num_instances(0), instance_id_counter(0) {}
58
59 // Singleton ResonanceAudio API instance to communicate with the internal
60 // system.
61 std::unique_ptr<ResonanceAudioApi> api;
62
63 // Number of global instances attempted to initialize.
64
65 int num_instances;
66
67 // List of currently active plugin instance ids.
68 std::list<int> instance_ids;
69
70 // Incremental plugin instance id counter.
71 int instance_id_counter;
72};
73
74// Returns a vector of raw pointers to beginning of each channel in given audio
75// buffer.
76//
77// @param buffer Pointer to Audikinetic planar audio buffer.
78// @return Vector of raw pointers per each buffer channel.
79template <typename T>
80inline std::vector<T> GetChannelPointerArrayFromAkAudioBuffer(
81 AkAudioBuffer* buffer) {
82 const AkUInt32 num_channels = buffer->NumChannels();
83 AKASSERT(num_channels >= 0U);
84
85 std::vector<T> channel_ptrs(static_cast<size_t>(num_channels));
86 for (AkUInt32 channel = 0; channel < num_channels; ++channel) {
87 channel_ptrs[channel] = static_cast<T>(buffer->GetChannel(channel));
88 }
89 return channel_ptrs;
90}
91
92} // namespace wwise
93} // namespace vraudio
94
95#endif // RESONANCE_AUDIO_PLATFORM_WWISE_WWISE_COMMON_H_
Definition wwise_common.h:55