Audaspace  1.3.0
A high level audio library.
BinauralSound.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 "ISound.h"
26 #include "HRTF.h"
27 #include "Source.h"
28 #include "util/ThreadPool.h"
29 #include "util/FFTPlan.h"
30 
31 #include <memory>
32 #include <vector>
33 
35 
40 {
41 private:
45  std::shared_ptr<ISound> m_sound;
46 
50  std::shared_ptr<HRTF> m_hrtfs;
51 
55  std::shared_ptr<Source> m_source;
56 
60  std::shared_ptr<ThreadPool> m_threadPool;
61 
65  std::shared_ptr<FFTPlan> m_plan;
66 
67  // delete copy constructor and operator=
68  BinauralSound(const BinauralSound&) = delete;
69  BinauralSound& operator=(const BinauralSound&) = delete;
70 
71 public:
81  BinauralSound(std::shared_ptr<ISound> sound, std::shared_ptr<HRTF> hrtfs, std::shared_ptr<Source> source, std::shared_ptr<ThreadPool> threadPool, std::shared_ptr<FFTPlan> plan);
82 
91  BinauralSound(std::shared_ptr<ISound> sound, std::shared_ptr<HRTF> hrtfs, std::shared_ptr<Source> source, std::shared_ptr<ThreadPool> threadPool);
92 
93  virtual std::shared_ptr<IReader> createReader();
94 
99  std::shared_ptr<HRTF> getHRTFs();
100 
105  void setHRTFs(std::shared_ptr<HRTF> hrtfs);
106 
111  std::shared_ptr<Source> getSource();
112 
117  void setSource(std::shared_ptr<Source> source);
118 };
ISound.h
The ISound interface.
BinauralSound::BinauralSound
BinauralSound(std::shared_ptr< ISound > sound, std::shared_ptr< HRTF > hrtfs, std::shared_ptr< Source > source, std::shared_ptr< ThreadPool > threadPool)
Creates a new BinauralSound.
ISound
This class represents a type of sound source and saves the necessary values for it.
Definition: ISound.h:40
BinauralSound::setHRTFs
void setHRTFs(std::shared_ptr< HRTF > hrtfs)
Changes the set of HRTFs used for convolution, it'll only affect newly created readers.
Source.h
The Source class.
BinauralSound::createReader
virtual std::shared_ptr< IReader > createReader()
Creates a reader for playback of the sound source.
ThreadPool.h
The ThreadPool class.
BinauralSound::setSource
void setSource(std::shared_ptr< Source > source)
Changes the Source object used to change the source position of the sound.
BinauralSound
This class represents a sound that can sound different depending on its realtive position with the li...
Definition: BinauralSound.h:40
AUD_NAMESPACE_END
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition: Audaspace.h:119
BinauralSound::getSource
std::shared_ptr< Source > getSource()
Retrieves the Source object being used.
BinauralSound::BinauralSound
BinauralSound(std::shared_ptr< ISound > sound, std::shared_ptr< HRTF > hrtfs, std::shared_ptr< Source > source, std::shared_ptr< ThreadPool > threadPool, std::shared_ptr< FFTPlan > plan)
Creates a new ConvolverSound.
AUD_NAMESPACE_BEGIN
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition: Audaspace.h:116
AUD_API
#define AUD_API
Used for exporting symbols in the shared library.
Definition: Audaspace.h:93
FFTPlan.h
The FFTPlan class.
HRTF.h
The HRTF class.
BinauralSound::getHRTFs
std::shared_ptr< HRTF > getHRTFs()
Retrieves the HRTF set being used.