RavEngine
Loading...
Searching...
No Matches
ambisonic_codec.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_AMBISONICS_AMBISONIC_CODEC_H_
18#define RESONANCE_AUDIO_AMBISONICS_AMBISONIC_CODEC_H_
19
20#include <vector>
21
22#include "base/audio_buffer.h"
23#include "base/spherical_angle.h"
24
25namespace vraudio {
26// An encoder/decoder for ambisonic sound fields. It supports variable ambisonic
27// order, ACN channel sequencing and SN3D normalization.
29 public:
30 virtual ~AmbisonicCodec() {}
31 // Encodes the given buffer of decoded vectors (unencoded data).
32 //
33 // @param input |AudioBuffer| of decoded (unencoded) data.
34 // @param output |AudioBuffer| to store the encoded data.
35 virtual void EncodeBuffer(const AudioBuffer& input, AudioBuffer* output) = 0;
36
37 // Decodes the given |AudioBuffer| of planar (non-interleaved) encoded data.
38 //
39 // @param input |AudioBuffer| of encoded data.
40 // @param output |AudioBuffer| to store the decoded data.
41 virtual void DecodeBuffer(const AudioBuffer& input, AudioBuffer* output) = 0;
42
43 // Returns the maximum periphonic ambisonic order that this codec supports.
44 virtual int ambisonic_order() const = 0;
45
46 // Returns the number of angles for this codec.
47 virtual size_t num_angles() const = 0;
48
49 // Returns the maximum number of spherical harmonics computed by this codec.
50 virtual size_t num_spherical_harmonics() const = 0;
51
52 // Returns the spherical angles currently used to define the encoder/decoder
53 // matrices.
54 virtual const std::vector<SphericalAngle>& angles() const = 0;
55
56 // Sets the spherical angles used to build the encoder/decoder matrices.
57 virtual void set_angles(const std::vector<SphericalAngle>& angles) = 0;
58};
59
60} // namespace vraudio
61
62#endif // RESONANCE_AUDIO_AMBISONICS_AMBISONIC_CODEC_H_
Definition ambisonic_codec.h:28
Definition audio_buffer.h:78