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_BASE_SOURCE_PARAMETERS_H_
18#define RESONANCE_AUDIO_BASE_SOURCE_PARAMETERS_H_
19
20#include "api/resonance_audio_api.h"
21
22#include "base/constants_and_types.h"
23#include "base/object_transform.h"
24
25namespace vraudio {
26
27// Gain attenuation types for audio sources.
28enum AttenuationType {
29 kInput = 0,
30 kDirect,
31 kReflections,
32 kReverb,
33 kNumAttenuationTypes
34};
35
36// Parameters describing an audio source.
37struct SourceParameters {
38 // Object transform associated with this buffer.
39 ObjectTransform object_transform;
40
41 // Angular spread in degrees. Range [0, 360].
42 float spread_deg = 0.0f;
43
44 // Source gain factor.
45 float gain = 1.0f;
46
47 // Source gain attenuation factors to be calculated per each buffer.
48 float attenuations[kNumAttenuationTypes];
49
50 // Distance attenuation. Value 1 represents no attenuation should be applied,
51 // value 0 will fully attenuate the volume. Range [0, 1].
52 float distance_attenuation = 1.0f;
53
54 // Distance attenuation rolloff model to use.
55 DistanceRolloffModel distance_rolloff_model =
56 DistanceRolloffModel::kLogarithmic;
57
58 // Minimum distance at which to apply distance attenuation.
59 float minimum_distance = 0.0f;
60
61 // Maximum distance at which to apply distance attenuation.
62 float maximum_distance = 500.0f;
63
64 // Alpha weighting of source's directivity pattern. This sets the balance
65 // between the dipole and omnidirectional directivity patterns which combine
66 // to produce the single directivity output value. Range [0, 1], where 0 is
67 // fully omnidirectional and 1 is fully dipole.
68 float directivity_alpha = 0.0f;
69
70 // Source directivity order. Increasing this value increases the directivity
71 // towards the front of the source. Range [1, inf).
72 float directivity_order = 1.0f;
73
74 // Alpha weighting of listener's directivity pattern. This sets the balance
75 // between the dipole and omnidirectional pickup patterns which combine to
76 // produce the single output value. Range [0, 1], where 0 is fully
77 // omnidirectional and 1 is fully dipole.
78 float listener_directivity_alpha = 0.0f;
79
80 // Listener directivity order. Increasing this value increases the directivity
81 // towards the front of the listener. Range [1, inf).
82 float listener_directivity_order = 1.0f;
83
84 // Occlusion intensity. Value 0 represents no occlusion, values greater than 1
85 // represent multiple occlusions. The intensity of each occlusion is scaled
86 // in range [0, 1].
87 float occlusion_intensity = 0.0f;
88
89 // Near field effect gain. Range [0, 9].
90 float near_field_gain = 0.0f;
91
92 // Source gain factor for the room effects.
93 float room_effects_gain = 1.0f;
94
95 // Whether the source uses binaural rendering or stereo panning.
96 bool enable_hrtf = true;
97};
98
99} // namespace vraudio
100
101#endif // RESONANCE_AUDIO_BASE_SOURCE_PARAMETERS_H_
102

source code of qtmultimedia/src/3rdparty/resonance-audio/resonance_audio/base/source_parameters.h