VISR  0.11.8
Versatile Interactive Scene Renderer
object.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
3 #ifndef VISR_OBJECTMODEL_OBJECT_HPP_INCLUDED
4 #define VISR_OBJECTMODEL_OBJECT_HPP_INCLUDED
5 
6 #include "export_symbols.hpp"
7 #include "object_type.hpp"
8 
10 
11 #include <climits>
12 #include <cstdint>
13 #include <memory>
14 #include <valarray>
15 
16 namespace visr
17 {
18 
19 namespace objectmodel
20 {
21 
22 // move to header object_id.hpp later (or make it a member of AudioObject)
23 using ObjectId = unsigned int;
24 
25 
26 using GroupId = unsigned int;
27 
31 using LevelType = float;
32 
36 class VISR_OBJECTMODEL_LIBRARY_SYMBOL Object
37 {
38 public:
46  using Coordinate = float;
50  using Priority = unsigned char;
51 
55  using ChannelIndex = unsigned int;
57 
61  static const ObjectId cInvalidObjectId = UINT_MAX; // should be std::numeric_limits<ObjectId>::max();
62 
63  static const GroupId cDefaultGroupId = 0;
64 
69  static const ChannelIndex cInvalidChannelIndex = UINT_MAX; // should be std::numeric_limits<ChannelIndex>::max();
70 
71  Object() = delete;
72 
73  explicit Object( ObjectId id );
74 
75  virtual ~Object() = 0;
76 
77  virtual ObjectTypeId type() const = 0;
78 
79  ObjectId id() const { return mObjectId; }
80 
81  GroupId groupId() const { return mGroupId; }
82 
83  void setGroupId( ObjectId newId );
84 
85  LevelType level() const;
86 
87  void setLevel( LevelType newLevel );
88 
89  Priority priority() const;
90 
91  void setPriority( Priority newPriority );
92 
102  std::size_t numberOfChannels() const;
103 
109  ChannelIndex channelIndex( std::size_t index ) const;
110 
115  void resetNumberOfChannels( std::size_t numChannels );
116 
121  void setChannelIndex( std::size_t index, ChannelIndex channelIndex );
123 
124  rbbl::ParametricIirCoefficientList<Coordinate> const & eqCoefficients() const;
125 
126  void setEqCoefficients( rbbl::ParametricIirCoefficientList<Coordinate> const & newCoeffs );
127 
128 
133  virtual std::unique_ptr<Object> clone() const = 0;
134 
135 protected:
136 
137 private:
138  ObjectId const mObjectId;
139 
140  GroupId mGroupId;
141 
142  LevelType mLevel;
143 
144  Priority mPriority;
145 
146  std::valarray<ChannelIndex> mChannelIndices;
147 
149 };
150 
151 } // namespace objectmodel
152 } // namespace visr
153 
154 #endif // VISR_OBJECTMODEL_OBJECT_HPP_INCLUDED
std::size_t const numChannels
Definition: delay_vector.cpp:21
unsigned int ObjectId
Definition: object.hpp:23
unsigned char Priority
Definition: object.hpp:50
ObjectTypeId
Definition: object_type.hpp:26
ObjectId id() const
Definition: object.hpp:79
GroupId groupId() const
Definition: object.hpp:81
float LevelType
Definition: object.hpp:31
Definition: options.cpp:10
unsigned int GroupId
Definition: object.hpp:26
Definition: object.hpp:36
float Coordinate
Definition: object.hpp:46
unsigned int ChannelIndex
Definition: object.hpp:55