Audaspace 1.5.0
A high level audio library.
Loading...
Searching...
No Matches
HRTF.h
Go to the documentation of this file.
1/*******************************************************************************
2* Copyright 2015-2016 Juan Francisco Crespo Galán
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15******************************************************************************/
16
17#pragma once
18
25#include "util/StreamBuffer.h"
26#include "util/FFTPlan.h"
27#include "ImpulseResponse.h"
28
29#include <memory>
30#include <vector>
31#include <unordered_map>
32#include <utility>
33
35
40{
41private:
45 std::unordered_map<float, std::unordered_map<float, std::shared_ptr<ImpulseResponse>>> m_hrtfs;
46
50 std::shared_ptr<FFTPlan> m_plan;
51
55 Specs m_specs;
56
60 bool m_empty;
61
62 // delete copy constructor and operator=
63 HRTF(const HRTF&) = delete;
64 HRTF& operator=(const HRTF&) = delete;
65
66public:
71
76 HRTF(std::shared_ptr<FFTPlan> plan);
77
85 bool addImpulseResponse(std::shared_ptr<StreamBuffer> impulseResponse, float azimuth, float elevation);
86
93 std::pair<std::shared_ptr<ImpulseResponse>, std::shared_ptr<ImpulseResponse>> getImpulseResponse(float &azimuth, float &elevation);
94
100
105 bool isEmpty();
106};
107
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition Audaspace.h:119
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition Audaspace.h:116
#define AUD_API
Used for exporting symbols in the shared library.
Definition Audaspace.h:93
The FFTPlan class.
The ImpulseResponse class.
The StreamBuffer class.
This class represents a complete set of HRTFs.
Definition HRTF.h:40
bool isEmpty()
Retrieves the state of the HRTF object.
bool addImpulseResponse(std::shared_ptr< StreamBuffer > impulseResponse, float azimuth, float elevation)
Adds a new HRTF to the class.
HRTF()
Creates a new empty HRTF object that will instance it own FFTPlan with default size.
Specs getSpecs()
Retrieves the specs shared by all the HRTFs.
HRTF(std::shared_ptr< FFTPlan > plan)
Creates a new empty HRTF object.
std::pair< std::shared_ptr< ImpulseResponse >, std::shared_ptr< ImpulseResponse > > getImpulseResponse(float &azimuth, float &elevation)
Retrieves a pair of HRTFs for a certain azimuth and elevation.
Specification of a sound source.
Definition Specification.h:119