VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtAudioSettingsRecord.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (c) 2017 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
14 
16 
17 #include <string>
18 #include <vector>
19 
20 namespace makVrv
21 {
22 
27  {
28  public:
31  typedef std::vector<DtEntitySoundMapRecord> EntityMapRecordList;
32 
35  typedef std::vector<DtFireSoundMapRecord> FireMapRecordList;
36 
39  typedef std::vector<DtDetonationSoundMapRecord> DetonationMapRecordList;
40 
43 
47 
49  virtual ~DtAudioSettingsRecord();
50 
54  DtAudioSettingsRecord& operator = ( DtAudioSettingsRecord rhs );
55 
59  virtual void swap( DtAudioSettingsRecord& other );
60 
62  virtual void sort();
63 
65  virtual void clearMaps();
66 
69  virtual void setAudioPlaybackDevice(const std::string& deviceName);
70 
73  virtual std::string audioPlaybackDevice() const;
74 
77  virtual void setAudioCaptureDevice(const std::string& deviceName);
78 
81  virtual std::string audioCaptureDevice() const;
82 
85  virtual void setShowCaptureDeviceSettings( bool val );
86 
90  virtual bool showCaptureDeviceSettings() const;
91 
94  virtual void setAudioEnabled( bool val );
95 
99  virtual bool audioEnabled() const;
100 
103  virtual void setVolume( double val );
104 
107  virtual double volume() const;
108 
111  virtual void setSpeedOfSound( double val );
112 
115  virtual double speedOfSound() const;
116 
119  virtual void setMaxVoices( int val );
120 
123  virtual int maxVoices() const;
124 
129  virtual void setMaximumOutputDecibelCapability( double val );
130 
133  virtual double maximumOutputDecibelCapability() const;
134 
137  virtual void setEnvironmentalProcessingEnabled( bool val );
138 
142  virtual bool environmentalProcessingEnabled() const;
143 
146  virtual unsigned int entityMapSize() const;
147 
150  virtual unsigned int weaponFireMapSize() const;
151 
154  virtual unsigned int detonationMapSize() const;
155 
158  virtual EntityMapRecordList& entityMap();
159 
164  virtual EntityMapRecordList::iterator
165  entityMapFind( DtEntitySoundMapRecord& record );
166 
171  virtual EntityMapRecordList::const_iterator
172  entityMapFind( const DtEntitySoundMapRecord& record );
173 
178  virtual const DtEntitySoundMapRecord&
179  entityMapAt( unsigned int index ) const;
180 
184  virtual unsigned int
185  entityMapIndex( const DtEntitySoundMapRecord& record ) const;
186 
189  virtual FireMapRecordList& weaponFireMap();
190 
195  virtual FireMapRecordList::iterator
196  weaponFireMapFind( DtFireSoundMapRecord& record );
197 
202  virtual FireMapRecordList::const_iterator
203  weaponFireMapFind( const DtFireSoundMapRecord& record );
204 
209  virtual const DtEntitySoundMapRecord&
210  weaponFireMapAt( unsigned int index ) const;
211 
215  virtual unsigned int
216  weaponFireMapIndex( const DtFireSoundMapRecord& record ) const;
217 
220  virtual DetonationMapRecordList& detonationMap();
221 
226  virtual DetonationMapRecordList::iterator
227  detonationMapFind( DtDetonationSoundMapRecord& record );
228 
233  virtual DetonationMapRecordList::const_iterator
234  detonationMapFind( const DtDetonationSoundMapRecord& record );
235 
240  virtual const DtEntitySoundMapRecord&
241  detonationMapAt( unsigned int index ) const;
242 
246  virtual unsigned int
247  detonationMapIndex( const DtDetonationSoundMapRecord& record ) const;
248 
251  virtual void entityMapAdd( const DtEntitySoundMapRecord& record );
252 
255  virtual void entityMapRemove( const DtEntitySoundMapRecord& record );
256 
260  virtual void weaponFireMapAdd( const DtFireSoundMapRecord& record );
261 
264  virtual void weaponFireMapRemove( const DtFireSoundMapRecord& record );
265 
269  virtual void
270  detonationMapAdd( const DtDetonationSoundMapRecord& record );
271 
274  virtual void
275  detonationMapRemove( const DtDetonationSoundMapRecord& record );
276 
277  protected:
278 
279  friend class boost::serialization::access;
280 
285  template<class Archive>
286  void serialize( Archive& ar, const unsigned int version )
287  {
288  if(version == 6)
289  {
290  ar & BOOST_SERIALIZATION_NVP( myAudioPlaybackDevice );
291  ar & BOOST_SERIALIZATION_NVP( myAudioCaptureDevice );
292  ar & BOOST_SERIALIZATION_NVP( myShowCaptureSettings );
293  ar & BOOST_SERIALIZATION_NVP( myAudioEnabled );
294  ar & BOOST_SERIALIZATION_NVP( myVolume );
295  ar & BOOST_SERIALIZATION_NVP( mySpeedOfSound );
296  ar & BOOST_SERIALIZATION_NVP( myMaxVoices );
297  ar & BOOST_SERIALIZATION_NVP( myMaximumOutputDecibelCapability );
298  ar & BOOST_SERIALIZATION_NVP( myEnvironmentalProcessingEnabled );
299  ar & BOOST_SERIALIZATION_NVP( myEntitySounds );
300  ar & BOOST_SERIALIZATION_NVP( myWeaponFireSounds );
301  ar & BOOST_SERIALIZATION_NVP( myDetonationSounds );
302  }
303  }
304 
310  template<typename MapType>
311  typename MapType::iterator
312  mapFind( DtEntitySoundMapRecord& record, MapType& sndMap ) const
313  {
314  typename MapType::iterator iter( sndMap.begin() );
315  typename MapType::iterator endr( sndMap.end() );
316  for( ; iter != endr; ++iter )
317  {
318  if ( ( *iter ) == record )
319  {
320  return iter;
321  }
322  }
323  return endr;
324  }
325 
331  template<typename MapType>
332  typename MapType::const_iterator
333  mapFind( const DtEntitySoundMapRecord& record, MapType& sndMap ) const
334  {
335  typename MapType::const_iterator iter( sndMap.begin() );
336  typename MapType::const_iterator endr( sndMap.end() );
337  for( ; iter != endr; ++iter )
338  {
339  if ( ( *iter ) == record )
340  {
341  return iter;
342  }
343  }
344  return endr;
345  }
346 
352  template<typename RecType, typename MapType>
353  const RecType& at( unsigned int index, MapType& sndMap ) const
354  {
355  return sndMap.at( index );
356  }
357 
362  template<typename RecType, typename MapType>
363  unsigned int index( const RecType& record, MapType& sndMap ) const
364  {
365  return static_cast<unsigned int>
366  ( std::distance( sndMap.begin(), mapFind( record, sndMap ) ) );
367  }
368 
371  template<typename MapType>
372  void clearMap( MapType& sndMap )
373  {
374  sndMap.clear();
375  }
376 
377 
378  protected:
380  std::string myAudioCaptureDevice;
383  int myVolume;
391  };
392 
393 }
394 

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)