RigsofRods
Soft-body Physics Simulation
SoundScriptManager.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5  Copyright 2017-2018 Petr Ohlidal
6 
7  For more information, see http://www.rigsofrods.org/
8 
9  Rigs of Rods is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License version 3, as
11  published by the Free Software Foundation.
12 
13  Rigs of Rods is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifdef USE_OPENAL
23 
24 #pragma once
25 
26 #include "AngelScriptBindings.h"
27 #include "Application.h"
28 #include "RefCountingObjectPtr.h"
29 #include "Sound.h"
30 #include "SoundManager.h"
31 
32 #include <OgreScriptLoader.h>
33 
34 #define SOUND_PLAY_ONCE(_ACTOR_, _TRIG_) App::GetSoundScriptManager()->trigOnce ( (_ACTOR_), (_TRIG_) )
35 #define SOUND_START(_ACTOR_, _TRIG_) App::GetSoundScriptManager()->trigStart ( (_ACTOR_), (_TRIG_) )
36 #define SOUND_STOP(_ACTOR_, _TRIG_) App::GetSoundScriptManager()->trigStop ( (_ACTOR_), (_TRIG_) )
37 #define SOUND_TOGGLE(_ACTOR_, _TRIG_) App::GetSoundScriptManager()->trigToggle ( (_ACTOR_), (_TRIG_) )
38 #define SOUND_KILL(_ACTOR_, _TRIG_) App::GetSoundScriptManager()->trigKill ( (_ACTOR_), (_TRIG_) )
39 #define SOUND_GET_STATE(_ACTOR_, _TRIG_) App::GetSoundScriptManager()->getTrigState( (_ACTOR_), (_TRIG_) )
40 #define SOUND_MODULATE(_ACTOR_, _MOD_, _VALUE_) App::GetSoundScriptManager()->modulate ( (_ACTOR_), (_MOD_), (_VALUE_) )
41 
42 namespace RoR {
43 
46 
47 enum {
50 };
51 
121 };
122 
156 };
157 
174 };
175 
176 class SoundScriptTemplate : public RefCountingObject<SoundScriptTemplate>
177 {
178  friend class SoundScriptManager;
179  friend class SoundScriptInstance;
180 
181 public:
182 
183  SoundScriptTemplate(Ogre::String name, Ogre::String groupname, Ogre::String filename, bool baseTemplate);
184  virtual ~SoundScriptTemplate() override {};
185 
186  // 'sound' attribute getters for AngelScript
187  int getNumSounds() { return free_sound; }
188  Ogre::String getSoundName(int pos) { if (pos >= 0 && pos < free_sound) { return sound_names[pos]; } else { return ""; } }
189  float getSoundPitch(int pos) { if (pos >= 0 && pos < free_sound) { return sound_pitches[pos]; } else { return 0.f; } }
190 
191  // start/stop sound attribute getters for AngelScript
192  Ogre::String getStartSoundName() { return start_sound_name; }
194  Ogre::String getStopSoundName() { return stop_sound_name; }
196 
197  // other getters for AngelScript
198  Ogre::String getName() { return name; }
199  Ogre::String getFileName() { return file_name; }
200  Ogre::String getGroupName() { return group_name; }
201  bool isBaseTemplate() { return base_template; }
202 
203 private:
204 
205  int parseModulation(Ogre::String str);
206  bool setParameter(Ogre::StringVector vec);
207 
208  Ogre::String name;
209  Ogre::String file_name;
210  Ogre::String group_name;
211 
216 
218  float gain_offset;
219  float gain_square;
221 
226 
229  Ogre::String start_sound_name;
231  Ogre::String stop_sound_name;
233 
236 };
237 
238 class SoundScriptInstance : public RefCountingObject<SoundScriptInstance>
239 {
240  friend class SoundScriptManager;
241 
242 public:
243 
244  SoundScriptInstance(int actor_id, SoundScriptTemplatePtr templ, SoundManager* sm, Ogre::String instancename, int soundLinkType=SL_DEFAULT, int soundLinkItemId=-1);
245  virtual ~SoundScriptInstance() override {};
246 
247  void runOnce();
248  void setEnabled(bool e);
249  void setGain(float value);
250  void setPitch(float value);
251  void setPosition(Ogre::Vector3 pos);
252  void setVelocity(Ogre::Vector3 velo);
253  void start();
254  void stop();
255  void kill();
256 
258  const SoundPtr& getStartSound() { return start_sound; }
259  const SoundPtr& getStopSound() { return stop_sound; }
260  const SoundPtr& getSound(int pos) { if (pos >= 0 && pos < templ->free_sound) { return sounds[pos]; } else { return SOUNDPTR_NULL; } }
263  float getSoundPitchgain(int pos) { if (pos >= 0 && pos < templ->free_sound) { return sounds_pitchgain[pos]; } else { return 0.f; } }
264  int getActorInstanceId() { return actor_id; }
265  const Ogre::String& getInstanceName() { return instance_name; }
266 
267  static const float PITCHDOWN_FADE_FACTOR;
268  static const float PITCHDOWN_CUTOFF_FACTOR;
269  static const int ACTOR_ID_UNKNOWN = -1;
270  static const int ACTOR_ID_TERRAIN_OBJECT = -2;
271  static const SoundPtr SOUNDPTR_NULL; // Dummy value to be returned as const reference.
272 
273 private:
274 
275  float pitchgain_cutoff(float sourcepitch, float targetpitch);
276 
277  Ogre::String instance_name;
286  float lastgain;
287 
288  int actor_id; // ID of the actor this sound belongs to, or an `ACTOR_ID_*` constant.
289  int sound_link_type; // holds the SL_ type this is bound to
290  int sound_link_item_id; // holds the item number this is for
291 };
292 
293 class SoundScriptManager : public Ogre::ScriptLoader
294 {
295 public:
296 
299 
300  // ScriptLoader interface
301  const Ogre::StringVector& getScriptPatterns(void) const;
302  void parseScript(Ogre::DataStreamPtr& stream, const Ogre::String& groupName);
303  Ogre::Real getLoadingOrder(void) const;
304 
305  SoundScriptInstancePtr createInstance(Ogre::String templatename, int actor_id, int soundLinkType=SL_DEFAULT, int soundLinkItemId=-1);
306  void removeInstance(const SoundScriptInstancePtr& ssi);
307  std::vector<SoundScriptInstancePtr>& getAllInstances() { return instances; }
308  SoundScriptTemplatePtr getTemplate(Ogre::String name) { return templates[name]; }
309  std::map <Ogre::String, SoundScriptTemplatePtr>& getAllTemplates() { return templates; }
310 
311  // functions
312  void trigOnce (int actor_id, int trig, int linkType = SL_DEFAULT, int linkItemID=-1);
313  void trigOnce (const ActorPtr& actor, int trig, int linkType = SL_DEFAULT, int linkItemID=-1);
314  void trigStart (int actor_id, int trig, int linkType = SL_DEFAULT, int linkItemID=-1);
315  void trigStart (const ActorPtr& actor, int trig, int linkType = SL_DEFAULT, int linkItemID=-1);
316  void trigStop (int actor_id, int trig, int linkType = SL_DEFAULT, int linkItemID=-1);
317  void trigStop (const ActorPtr& actor, int trig, int linkType = SL_DEFAULT, int linkItemID=-1);
318  void trigToggle (int actor_id, int trig, int linkType = SL_DEFAULT, int linkItemID=-1);
319  void trigToggle (const ActorPtr& actor, int trig, int linkType = SL_DEFAULT, int linkItemID=-1);
320  void trigKill (int actor_id, int trig, int linkType = SL_DEFAULT, int linkItemID = -1);
321  void trigKill (const ActorPtr& actor, int trig, int linkType = SL_DEFAULT, int linkItemID = -1);
322  bool getTrigState(int actor_id, int trig, int linkType = SL_DEFAULT, int linkItemID=-1);
323  bool getTrigState(const ActorPtr& actor, int trig, int linkType = SL_DEFAULT, int linkItemID=-1);
324  void modulate (int actor_id, int mod, float value, int linkType = SL_DEFAULT, int linkItemID=-1);
325  void modulate (const ActorPtr& actor, int mod, float value, int linkType = SL_DEFAULT, int linkItemID=-1);
326 
327  void setEnabled(bool state);
328 
329  void setCamera(Ogre::Vector3 position, Ogre::Vector3 direction, Ogre::Vector3 up, Ogre::Vector3 velocity);
330  void setLoadingBaseSounds(bool value) { loading_base = value; };
331 
332  bool isDisabled() { return disabled; }
333 
334  void update(float dt_sec);
335 
337 
338 private:
339 
340  SoundScriptTemplatePtr createTemplate(Ogre::String name, Ogre::String groupname, Ogre::String filename);
341  void skipToNextCloseBrace(Ogre::DataStreamPtr& chunk);
342  void skipToNextOpenBrace(Ogre::DataStreamPtr& chunk);
343 
344  bool disabled;
350  Ogre::StringVector script_patterns;
351 
352  std::map <Ogre::String, SoundScriptTemplatePtr> templates;
353  std::vector<SoundScriptInstancePtr> instances;
354 
355  // instances lookup tables - using `std::array<>` because it does bounds checking under VisualStudio/Debug.
356  std::array<int, SS_MAX_TRIG> free_trigs;
357  std::array<SoundScriptInstancePtr, SS_MAX_TRIG* MAX_INSTANCES_PER_GROUP> trigs;
358 
359  std::array<int, SS_MAX_MOD> free_pitches;
360  std::array<SoundScriptInstancePtr, SS_MAX_MOD* MAX_INSTANCES_PER_GROUP> pitches;
361 
362  std::array<int, SS_MAX_MOD> free_gains;
363  std::array<SoundScriptInstancePtr, SS_MAX_MOD* MAX_INSTANCES_PER_GROUP> gains;
364 
365  // state map
366  // soundLinks, soundItems, actor_ids, triggers
367  std::map <int, std::map <int, std::map <int, std::map <int, bool > > > > state_map;
368 
370 };
371 
373 
374 } // namespace RoR
375 
376 #else // USE_OPENAL
377 
378 #define SOUND_PLAY_ONCE(_ACTOR_, _TRIG_)
379 #define SOUND_START(_ACTOR_, _TRIG_)
380 #define SOUND_STOP(_ACTOR_, _TRIG_)
381 #define SOUND_TOGGLE(_ACTOR_, _TRIG_)
382 #define SOUND_KILL(_ACTOR_, _TRIG_)
383 #define SOUND_GET_STATE(_ACTOR_, _TRIG_) (false)
384 #define SOUND_MODULATE(_ACTOR_, _MOD_, _VALUE_)
385 
386 #endif // USE_OPENAL
RoR::SS_TRIG_AVICHAT09
@ SS_TRIG_AVICHAT09
Definition: SoundScriptManager.h:113
RoR::SoundScriptManager::templates
std::map< Ogre::String, SoundScriptTemplatePtr > templates
Definition: SoundScriptManager.h:352
RoR::SS_TRIG_GPWS_40
@ SS_TRIG_GPWS_40
Definition: SoundScriptManager.h:73
RoR::SS_MOD_THROTTLE7
@ SS_MOD_THROTTLE7
Definition: SoundScriptManager.h:145
RoR::SoundScriptInstance::sound_link_item_id
int sound_link_item_id
Definition: SoundScriptManager.h:290
RoR::SL_COMMAND
@ SL_COMMAND
Definition: SoundScriptManager.h:160
RoR::SS_TRIG_GPWS_APDISCONNECT
@ SS_TRIG_GPWS_APDISCONNECT
Definition: SoundScriptManager.h:69
RoR::SS_TRIG_AVICHAT06
@ SS_TRIG_AVICHAT06
Definition: SoundScriptManager.h:110
RoR::SoundScriptManager::gains
std::array< SoundScriptInstancePtr, SS_MAX_MOD *MAX_INSTANCES_PER_GROUP > gains
Definition: SoundScriptManager.h:363
Sound.h
RoR::SS_TRIG_CREAK
@ SS_TRIG_CREAK
Definition: SoundScriptManager.h:81
RoR::SoundScriptInstance::start
void start()
Definition: SoundScriptManager.cpp:1386
RoR::SoundScriptInstance::pitchgain_cutoff
float pitchgain_cutoff(float sourcepitch, float targetpitch)
Definition: SoundScriptManager.cpp:1266
RoR::MAX_INSTANCES_PER_GROUP
@ MAX_INSTANCES_PER_GROUP
Definition: SoundScriptManager.h:49
RoR::SS_TRIG_AEROENGINE8
@ SS_TRIG_AEROENGINE8
Definition: SoundScriptManager.h:96
RoR::SoundScriptTemplate::getSoundPitch
float getSoundPitch(int pos)
Definition: SoundScriptManager.h:189
RoR::SoundManager
Definition: SoundManager.h:44
RoR::SS_MOD_THROTTLE6
@ SS_MOD_THROTTLE6
Definition: SoundScriptManager.h:144
RoR::SS_TRIG_AVICHAT04
@ SS_TRIG_AVICHAT04
Definition: SoundScriptManager.h:108
RoR::SS_MOD_AEROENGINE1
@ SS_MOD_AEROENGINE1
Definition: SoundScriptManager.h:127
RoR::SS_TRIG_AFTERBURNER6
@ SS_TRIG_AFTERBURNER6
Definition: SoundScriptManager.h:90
RoR::SoundScriptManager::setCamera
void setCamera(Ogre::Vector3 position, Ogre::Vector3 direction, Ogre::Vector3 up, Ogre::Vector3 velocity)
Definition: SoundScriptManager.cpp:324
RoR::SL_HYDRO
@ SL_HYDRO
Definition: SoundScriptManager.h:161
RoR::SL_PARTICLES
@ SL_PARTICLES
Definition: SoundScriptManager.h:167
RoR::SL_DEFAULT
@ SL_DEFAULT
Definition: SoundScriptManager.h:159
RoR::SS_TRIG_TURN_SIGNAL_TICK
@ SS_TRIG_TURN_SIGNAL_TICK
Definition: SoundScriptManager.h:101
RoR::SS_MOD_AEROENGINE5
@ SS_MOD_AEROENGINE5
Definition: SoundScriptManager.h:147
RoR::SS_TRIG_ALB_ACTIVE
@ SS_TRIG_ALB_ACTIVE
Definition: SoundScriptManager.h:103
RoR::SS_TRIG_AEROENGINE2
@ SS_TRIG_AEROENGINE2
Definition: SoundScriptManager.h:56
RoR::SoundScriptManager::trigKill
void trigKill(int actor_id, int trig, int linkType=SL_DEFAULT, int linkItemID=-1)
Definition: SoundScriptManager.cpp:203
RoR::SoundScriptManager::getTrigState
bool getTrigState(int actor_id, int trig, int linkType=SL_DEFAULT, int linkItemID=-1)
Definition: SoundScriptManager.cpp:255
AngelScriptBindings.h
RoR::SoundScriptInstance::lastgain
float lastgain
Definition: SoundScriptManager.h:286
RoR::SoundScriptInstance::ACTOR_ID_TERRAIN_OBJECT
static const int ACTOR_ID_TERRAIN_OBJECT
Definition: SoundScriptManager.h:270
RoR::SL_ROPES
@ SL_ROPES
Definition: SoundScriptManager.h:165
RoR::SoundScriptInstance::setPitch
void setPitch(float value)
Definition: SoundScriptManager.cpp:1128
RoR::SL_MAX
@ SL_MAX
Definition: SoundScriptManager.h:173
RoR::SS_TRIG_AEROENGINE6
@ SS_TRIG_AEROENGINE6
Definition: SoundScriptManager.h:94
RoR::SS_TRIG_ENGINE
@ SS_TRIG_ENGINE
Definition: SoundScriptManager.h:54
RoR::SoundScriptManager::instance_counter
int instance_counter
Definition: SoundScriptManager.h:349
RoR::SL_COLLISION
@ SL_COLLISION
Definition: SoundScriptManager.h:162
RoR::SoundScriptManager::reference_distance
float reference_distance
Definition: SoundScriptManager.h:347
RoR::SoundScriptManager::removeInstance
void removeInstance(const SoundScriptInstancePtr &ssi)
Definition: SoundScriptManager.cpp:409
RoR::SoundScriptManager::trigOnce
void trigOnce(int actor_id, int trig, int linkType=SL_DEFAULT, int linkItemID=-1)
Definition: SoundScriptManager.cpp:114
RoR::SoundScriptTemplate
Definition: SoundScriptManager.h:176
RoR::SS_TRIG_GPWS_MINIMUMS
@ SS_TRIG_GPWS_MINIMUMS
Definition: SoundScriptManager.h:77
RoR::SS_TRIG_BRAKE
@ SS_TRIG_BRAKE
Definition: SoundScriptManager.h:60
RoR::SoundScriptInstance::getStopSoundPitchgain
float getStopSoundPitchgain()
Definition: SoundScriptManager.h:262
RoR::SS_TRIG_AFTERBURNER5
@ SS_TRIG_AFTERBURNER5
Definition: SoundScriptManager.h:89
RoR::SoundScriptInstance::setVelocity
void setVelocity(Ogre::Vector3 velo)
Definition: SoundScriptManager.cpp:1331
RoR::SoundScriptManager::free_gains
std::array< int, SS_MAX_MOD > free_gains
Definition: SoundScriptManager.h:362
RoR::SoundScriptInstance::stop
void stop()
Definition: SoundScriptManager.cpp:1405
RoR::SS_TRIG_TURBOBACKFIRE
@ SS_TRIG_TURBOBACKFIRE
Definition: SoundScriptManager.h:65
SoundManager.h
RoR::SoundScriptInstance::sound_manager
SoundManager * sound_manager
Definition: SoundScriptManager.h:279
RoR::SoundScriptManager::getSoundManager
SoundManager * getSoundManager()
Definition: SoundScriptManager.h:336
RoR::SS_TRIG_AFTERBURNER2
@ SS_TRIG_AFTERBURNER2
Definition: SoundScriptManager.h:86
RoR::SL_AXLES
@ SL_AXLES
Definition: SoundScriptManager.h:168
RoR::SS_TRIG_AVICHAT03
@ SS_TRIG_AVICHAT03
Definition: SoundScriptManager.h:107
RoR::MAX_SOUNDS_PER_SCRIPT
@ MAX_SOUNDS_PER_SCRIPT
Definition: SoundScriptManager.h:48
RoR::SoundScriptInstance::PITCHDOWN_FADE_FACTOR
static const float PITCHDOWN_FADE_FACTOR
Definition: SoundScriptManager.h:267
RoR::SS_MOD_PUMP
@ SS_MOD_PUMP
Definition: SoundScriptManager.h:138
RoR::SS_TRIG_TURBOWASTEGATE
@ SS_TRIG_TURBOWASTEGATE
Definition: SoundScriptManager.h:64
RoR::SS_MOD_AEROENGINE4
@ SS_MOD_AEROENGINE4
Definition: SoundScriptManager.h:130
RoR::SoundScriptManager::setEnabled
void setEnabled(bool state)
Definition: SoundScriptManager.cpp:549
RoR::SoundScriptManager
Definition: SoundScriptManager.h:293
RoR::SS_TRIG_AEROENGINE3
@ SS_TRIG_AEROENGINE3
Definition: SoundScriptManager.h:57
RoR::SoundScriptManager::sound_manager
SoundManager * sound_manager
Definition: SoundScriptManager.h:369
RoR::SS_TRIG_TC_ACTIVE
@ SS_TRIG_TC_ACTIVE
Definition: SoundScriptManager.h:104
RoR::SS_MOD_AEROENGINE8
@ SS_MOD_AEROENGINE8
Definition: SoundScriptManager.h:150
RoR::SS_TRIG_GPWS_PULLUP
@ SS_TRIG_GPWS_PULLUP
Definition: SoundScriptManager.h:76
RoR::SoundScriptInstance::ACTOR_ID_UNKNOWN
static const int ACTOR_ID_UNKNOWN
Definition: SoundScriptManager.h:269
RoR::SoundScriptManager::getAllInstances
std::vector< SoundScriptInstancePtr > & getAllInstances()
Definition: SoundScriptManager.h:307
RoR::SS_TRIG_PUMP
@ SS_TRIG_PUMP
Definition: SoundScriptManager.h:61
RoR::SS_MOD_AOA
@ SS_MOD_AOA
Definition: SoundScriptManager.h:152
RoR::SS_MOD_GEARBOX
@ SS_MOD_GEARBOX
Definition: SoundScriptManager.h:134
RoR::SoundScriptInstance::sound_link_type
int sound_link_type
Definition: SoundScriptManager.h:289
RoR::SoundScriptTemplate::gain_square
float gain_square
Definition: SoundScriptManager.h:219
RoR::SS_TRIG_AVICHAT11
@ SS_TRIG_AVICHAT11
Definition: SoundScriptManager.h:115
RoR::SS_TRIG_MAIN_MENU
@ SS_TRIG_MAIN_MENU
Definition: SoundScriptManager.h:119
RoR::SS_MOD_AEROENGINE2
@ SS_MOD_AEROENGINE2
Definition: SoundScriptManager.h:128
RoR::SoundScriptTemplate::file_name
Ogre::String file_name
Definition: SoundScriptManager.h:209
RoR::SoundScriptTemplate::start_sound_pitch
float start_sound_pitch
Definition: SoundScriptManager.h:230
RoR::SoundScriptInstance::setGain
void setGain(float value)
Definition: SoundScriptManager.cpp:1287
RoR::SS_MOD_MUSIC_VOLUME
@ SS_MOD_MUSIC_VOLUME
Definition: SoundScriptManager.h:154
RoR::SoundScriptManager::getTemplate
SoundScriptTemplatePtr getTemplate(Ogre::String name)
Definition: SoundScriptManager.h:308
RefCountingObjectPtr< SoundScriptTemplate >
RoR::SoundScriptManager::setLoadingBaseSounds
void setLoadingBaseSounds(bool value)
Definition: SoundScriptManager.h:330
RoR::SS_TRIG_SCREETCH
@ SS_TRIG_SCREETCH
Definition: SoundScriptManager.h:83
RoR::SS_TRIG_TURN_SIGNAL_WARN_TICK
@ SS_TRIG_TURN_SIGNAL_WARN_TICK
Definition: SoundScriptManager.h:102
RoR::SS_TRIG_AFTERBURNER4
@ SS_TRIG_AFTERBURNER4
Definition: SoundScriptManager.h:88
RoR::SoundScriptTemplate::sound_names
Ogre::String sound_names[MAX_SOUNDS_PER_SCRIPT]
Definition: SoundScriptManager.h:227
RoR::SS_MOD_INJECTOR
@ SS_MOD_INJECTOR
Definition: SoundScriptManager.h:132
RoR::SS_TRIG_REVERSE_GEAR
@ SS_TRIG_REVERSE_GEAR
Definition: SoundScriptManager.h:99
RoR::SoundScriptTemplate::gain_source
int gain_source
Definition: SoundScriptManager.h:220
RoR::SoundScriptManager::getAllTemplates
std::map< Ogre::String, SoundScriptTemplatePtr > & getAllTemplates()
Definition: SoundScriptManager.h:309
RoR::SoundScriptInstance::getActorInstanceId
int getActorInstanceId()
Definition: SoundScriptManager.h:264
RoR::SoundScriptManager::createTemplate
SoundScriptTemplatePtr createTemplate(Ogre::String name, Ogre::String groupname, Ogre::String filename)
Definition: SoundScriptManager.cpp:342
RoR::SL_FLEXBODIES
@ SL_FLEXBODIES
Definition: SoundScriptManager.h:170
RoR::SoundScriptTemplate::getGroupName
Ogre::String getGroupName()
Definition: SoundScriptManager.h:200
RoR::SoundScriptManager::~SoundScriptManager
~SoundScriptManager()
Definition: SoundScriptManager.cpp:97
RoR::SoundScriptTemplate::base_template
bool base_template
Definition: SoundScriptManager.h:212
RoR::SoundScriptInstance::kill
void kill()
Definition: SoundScriptManager.cpp:1420
RoR::SoundScriptInstance::PITCHDOWN_CUTOFF_FACTOR
static const float PITCHDOWN_CUTOFF_FACTOR
Definition: SoundScriptManager.h:268
RoR::SoundScriptManager::rolloff_factor
float rolloff_factor
Definition: SoundScriptManager.h:348
RoR::SS_TRIG_GPWS_10
@ SS_TRIG_GPWS_10
Definition: SoundScriptManager.h:70
RoR::SS_TRIG_PARK
@ SS_TRIG_PARK
Definition: SoundScriptManager.h:84
RoR::SL_EXHAUSTS
@ SL_EXHAUSTS
Definition: SoundScriptManager.h:171
RoR::SS_TRIG_LINKED_COMMAND
@ SS_TRIG_LINKED_COMMAND
Definition: SoundScriptManager.h:118
RoR::SS_TRIG_AVICHAT13
@ SS_TRIG_AVICHAT13
Definition: SoundScriptManager.h:117
RoR::SoundScriptManager::parseScript
void parseScript(Ogre::DataStreamPtr &stream, const Ogre::String &groupName)
Definition: SoundScriptManager.cpp:474
RoR::SoundScriptTemplate::SoundScriptTemplate
SoundScriptTemplate(Ogre::String name, Ogre::String groupname, Ogre::String filename, bool baseTemplate)
Definition: SoundScriptManager.cpp:559
RoR::SS_MOD_TURBO
@ SS_MOD_TURBO
Definition: SoundScriptManager.h:126
RoR::SoundScriptTemplate::unpitchable
bool unpitchable
Definition: SoundScriptManager.h:215
RoR::SoundScriptTemplate::pitch_source
int pitch_source
Definition: SoundScriptManager.h:225
RoR::SoundScriptInstance::getStartSoundPitchgain
float getStartSoundPitchgain()
Definition: SoundScriptManager.h:261
RoR::SS_TRIG_AIR_PURGE
@ SS_TRIG_AIR_PURGE
Definition: SoundScriptManager.h:78
RoR::SoundScriptManager::disabled
bool disabled
Definition: SoundScriptManager.h:344
RoR::SoundScriptTemplate::gain_offset
float gain_offset
Definition: SoundScriptManager.h:218
RoR::SS_MOD_THROTTLE1
@ SS_MOD_THROTTLE1
Definition: SoundScriptManager.h:139
RoR::SoundScriptTemplate::getName
Ogre::String getName()
Definition: SoundScriptManager.h:198
RoR::SoundScriptTemplate::sound_pitches
float sound_pitches[MAX_SOUNDS_PER_SCRIPT]
Definition: SoundScriptManager.h:228
RoR::SL_SHOCKS
@ SL_SHOCKS
Definition: SoundScriptManager.h:163
RoR::SS_TRIG_AEROENGINE1
@ SS_TRIG_AEROENGINE1
Definition: SoundScriptManager.h:55
RoR::SoundScriptInstance::getSoundPitchgain
float getSoundPitchgain(int pos)
Definition: SoundScriptManager.h:263
RoR::SoundScriptManager::skipToNextCloseBrace
void skipToNextCloseBrace(Ogre::DataStreamPtr &chunk)
Definition: SoundScriptManager.cpp:529
RoR::SoundScriptTemplate::free_sound
int free_sound
Definition: SoundScriptManager.h:235
RoR::SoundScriptTemplate::pitch_multiplier
float pitch_multiplier
Definition: SoundScriptManager.h:222
RoR::SS_MAX_MOD
@ SS_MAX_MOD
Definition: SoundScriptManager.h:155
RoR::SoundScriptTemplate::stop_sound_name
Ogre::String stop_sound_name
Definition: SoundScriptManager.h:231
RoR::SS_TRIG_AIR
@ SS_TRIG_AIR
Definition: SoundScriptManager.h:68
RoR::SoundTriggers
SoundTriggers
Definition: SoundScriptManager.h:52
RoR::SS_TRIG_AVICHAT01
@ SS_TRIG_AVICHAT01
Definition: SoundScriptManager.h:105
RoR::SS_TRIG_ALWAYSON
@ SS_TRIG_ALWAYSON
Definition: SoundScriptManager.h:66
RoR::SS_MOD_WHEELSPEED
@ SS_MOD_WHEELSPEED
Definition: SoundScriptManager.h:131
RoR::SS_TRIG_GPWS_50
@ SS_TRIG_GPWS_50
Definition: SoundScriptManager.h:74
RoR::SoundScriptTemplate::getNumSounds
int getNumSounds()
Definition: SoundScriptManager.h:187
RoR::SoundScriptManager::createInstance
SoundScriptInstancePtr createInstance(Ogre::String templatename, int actor_id, int soundLinkType=SL_DEFAULT, int soundLinkItemId=-1)
Definition: SoundScriptManager.cpp:356
RoR::SoundScriptTemplate::getSoundName
Ogre::String getSoundName(int pos)
Definition: SoundScriptManager.h:188
RoR::SoundScriptInstance::runOnce
void runOnce()
Definition: SoundScriptManager.cpp:1352
Application.h
Central state/object manager and communications hub.
RoR::SoundScriptTemplate::getFileName
Ogre::String getFileName()
Definition: SoundScriptManager.h:199
RoR::SS_MOD_THROTTLE3
@ SS_MOD_THROTTLE3
Definition: SoundScriptManager.h:141
RoR::SoundScriptTemplate::stop_sound_pitch
float stop_sound_pitch
Definition: SoundScriptManager.h:232
RoR::SoundScriptInstance::getInstanceName
const Ogre::String & getInstanceName()
Definition: SoundScriptManager.h:265
RoR::SoundScriptInstance::setEnabled
void setEnabled(bool e)
Definition: SoundScriptManager.cpp:1438
RoR::SS_MOD_NONE
@ SS_MOD_NONE
Definition: SoundScriptManager.h:124
RoR::SoundScriptInstance::getStopSound
const SoundPtr & getStopSound()
Definition: SoundScriptManager.h:259
RoR::SS_TRIG_AEROENGINE4
@ SS_TRIG_AEROENGINE4
Definition: SoundScriptManager.h:58
RoR::SoundScriptTemplate::getStartSoundName
Ogre::String getStartSoundName()
Definition: SoundScriptManager.h:192
RoR::SS_MOD_LINKED_COMMANDRATE
@ SS_MOD_LINKED_COMMANDRATE
Definition: SoundScriptManager.h:153
RoR::SS_MOD_SCREETCH
@ SS_MOD_SCREETCH
Definition: SoundScriptManager.h:137
RoR::SoundScriptTemplate::isBaseTemplate
bool isBaseTemplate()
Definition: SoundScriptManager.h:201
RoR::SS_TRIG_GPWS_30
@ SS_TRIG_GPWS_30
Definition: SoundScriptManager.h:72
RoR::SS_MAX_TRIG
@ SS_MAX_TRIG
Definition: SoundScriptManager.h:120
RoR::SoundScriptTemplate::pitch_offset
float pitch_offset
Definition: SoundScriptManager.h:223
RoR::SS_TRIG_GPWS_20
@ SS_TRIG_GPWS_20
Definition: SoundScriptManager.h:71
RoR::SoundScriptTemplate::has_stop_sound
bool has_stop_sound
Definition: SoundScriptManager.h:214
RoR::SS_MOD_AEROENGINE7
@ SS_MOD_AEROENGINE7
Definition: SoundScriptManager.h:149
RoR::SoundScriptManager::free_trigs
std::array< int, SS_MAX_TRIG > free_trigs
Definition: SoundScriptManager.h:356
RoR::SoundScriptInstance::~SoundScriptInstance
virtual ~SoundScriptInstance() override
Definition: SoundScriptManager.h:245
RoR::SS_TRIG_TURBOBOV
@ SS_TRIG_TURBOBOV
Definition: SoundScriptManager.h:63
RoR::SoundScriptTemplate::gain_multiplier
float gain_multiplier
Definition: SoundScriptManager.h:217
RoR::SS_TRIG_HORN
@ SS_TRIG_HORN
Definition: SoundScriptManager.h:59
RoR::SoundScriptInstance::getStartSound
const SoundPtr & getStartSound()
Definition: SoundScriptManager.h:258
RoR::SS_TRIG_AVICHAT05
@ SS_TRIG_AVICHAT05
Definition: SoundScriptManager.h:109
RoR::SoundScriptInstance::stop_sound
SoundPtr stop_sound
Definition: SoundScriptManager.h:281
RoR::SS_TRIG_GPWS_100
@ SS_TRIG_GPWS_100
Definition: SoundScriptManager.h:75
RoR::SS_TRIG_AVICHAT08
@ SS_TRIG_AVICHAT08
Definition: SoundScriptManager.h:112
RoR::SoundScriptTemplate::name
Ogre::String name
Definition: SoundScriptManager.h:208
RoR::SoundScriptInstance::start_sound
SoundPtr start_sound
Definition: SoundScriptManager.h:280
RoR::SS_TRIG_AEROENGINE5
@ SS_TRIG_AEROENGINE5
Definition: SoundScriptManager.h:93
RoR::SS_TRIG_BREAK
@ SS_TRIG_BREAK
Definition: SoundScriptManager.h:82
RoR::SoundScriptTemplate::getStopSoundPitch
float getStopSoundPitch()
Definition: SoundScriptManager.h:195
RoR::SoundScriptTemplate::start_sound_name
Ogre::String start_sound_name
Definition: SoundScriptManager.h:229
RoR::SoundScriptInstance::sounds_pitchgain
float sounds_pitchgain[MAX_SOUNDS_PER_SCRIPT]
Definition: SoundScriptManager.h:285
RoR::SoundScriptTemplate::~SoundScriptTemplate
virtual ~SoundScriptTemplate() override
Definition: SoundScriptManager.h:184
RoR::SoundScriptTemplate::pitch_square
float pitch_square
Definition: SoundScriptManager.h:224
RoR::SS_MOD_AIRSPEED
@ SS_MOD_AIRSPEED
Definition: SoundScriptManager.h:151
RoR::SoundScriptInstance::start_sound_pitchgain
float start_sound_pitchgain
Definition: SoundScriptManager.h:283
RoR::SoundScriptManager::trigStart
void trigStart(int actor_id, int trig, int linkType=SL_DEFAULT, int linkItemID=-1)
Definition: SoundScriptManager.cpp:142
RoR::SS_MOD_THROTTLE5
@ SS_MOD_THROTTLE5
Definition: SoundScriptManager.h:143
RoR::SoundScriptInstance
Definition: SoundScriptManager.h:238
RoR::SoundScriptManager::free_pitches
std::array< int, SS_MAX_MOD > free_pitches
Definition: SoundScriptManager.h:359
RoR::SL_VIDEOCAMERA
@ SL_VIDEOCAMERA
Definition: SoundScriptManager.h:172
RoR::SS_MOD_THROTTLE4
@ SS_MOD_THROTTLE4
Definition: SoundScriptManager.h:142
RoR::SS_TRIG_SHIFT
@ SS_TRIG_SHIFT
Definition: SoundScriptManager.h:79
RoR::SS_TRIG_AVICHAT12
@ SS_TRIG_AVICHAT12
Definition: SoundScriptManager.h:116
RoR::SoundScriptTemplate::has_start_sound
bool has_start_sound
Definition: SoundScriptManager.h:213
RoR::SoundScriptManager::loading_base
bool loading_base
Definition: SoundScriptManager.h:345
RoR::SS_TRIG_GEARSLIDE
@ SS_TRIG_GEARSLIDE
Definition: SoundScriptManager.h:80
RoR::SS_MOD_CREAK
@ SS_MOD_CREAK
Definition: SoundScriptManager.h:135
RoR::SoundScriptTemplate::parseModulation
int parseModulation(Ogre::String str)
Definition: SoundScriptManager.cpp:1023
RoR::SS_TRIG_AEROENGINE7
@ SS_TRIG_AEROENGINE7
Definition: SoundScriptManager.h:95
RefCountingObjectPtr.h
RoR::SoundScriptManager::max_distance
float max_distance
Definition: SoundScriptManager.h:346
RoR::SoundScriptInstance::sounds
SoundPtr sounds[MAX_SOUNDS_PER_SCRIPT]
Definition: SoundScriptManager.h:282
RoR::SoundScriptTemplate::trigger_source
int trigger_source
Definition: SoundScriptManager.h:234
RoR::SoundScriptTemplate::setParameter
bool setParameter(Ogre::StringVector vec)
Definition: SoundScriptManager.cpp:582
RoR::SS_TRIG_TURN_SIGNAL
@ SS_TRIG_TURN_SIGNAL
Definition: SoundScriptManager.h:100
RoR::SL_TIES
@ SL_TIES
Definition: SoundScriptManager.h:166
RoR::SoundScriptTemplate::getStartSoundPitch
float getStartSoundPitch()
Definition: SoundScriptManager.h:193
RoR::SoundScriptManager::pitches
std::array< SoundScriptInstancePtr, SS_MAX_MOD *MAX_INSTANCES_PER_GROUP > pitches
Definition: SoundScriptManager.h:360
RoR::SoundScriptManager::modulate
void modulate(int actor_id, int mod, float value, int linkType=SL_DEFAULT, int linkItemID=-1)
Definition: SoundScriptManager.cpp:274
RoR::SS_MOD_ENGINE
@ SS_MOD_ENGINE
Definition: SoundScriptManager.h:125
RoR::SL_BRAKES
@ SL_BRAKES
Definition: SoundScriptManager.h:164
RoR::SoundScriptInstance::getSound
const SoundPtr & getSound(int pos)
Definition: SoundScriptManager.h:260
RoR::SS_MOD_BREAK
@ SS_MOD_BREAK
Definition: SoundScriptManager.h:136
RoR::SS_TRIG_REPAIR
@ SS_TRIG_REPAIR
Definition: SoundScriptManager.h:67
RoR::SS_TRIG_AVICHAT02
@ SS_TRIG_AVICHAT02
Definition: SoundScriptManager.h:106
RefCountingObject
Self reference-counting objects, as requred by AngelScript garbage collector.
Definition: RefCountingObject.h:26
RoR::SS_TRIG_AFTERBURNER7
@ SS_TRIG_AFTERBURNER7
Definition: SoundScriptManager.h:91
RoR::SoundScriptManager::update
void update(float dt_sec)
Definition: SoundScriptManager.cpp:308
RoR::SoundScriptTemplate::getStopSoundName
Ogre::String getStopSoundName()
Definition: SoundScriptManager.h:194
RoR::SoundScriptTemplate::group_name
Ogre::String group_name
Definition: SoundScriptManager.h:210
RoR::SS_TRIG_IGNITION
@ SS_TRIG_IGNITION
Definition: SoundScriptManager.h:98
RoR::SS_TRIG_AVICHAT10
@ SS_TRIG_AVICHAT10
Definition: SoundScriptManager.h:114
RoR::SoundScriptManager::getScriptPatterns
const Ogre::StringVector & getScriptPatterns(void) const
Definition: SoundScriptManager.cpp:331
RoR::SS_MOD_AEROENGINE6
@ SS_MOD_AEROENGINE6
Definition: SoundScriptManager.h:148
RoR::SS_TRIG_AVICHAT07
@ SS_TRIG_AVICHAT07
Definition: SoundScriptManager.h:111
RoR::SS_TRIG_AFTERBURNER3
@ SS_TRIG_AFTERBURNER3
Definition: SoundScriptManager.h:87
RoR::SoundScriptInstance::stop_sound_pitchgain
float stop_sound_pitchgain
Definition: SoundScriptManager.h:284
RoR::ModulationSources
ModulationSources
Definition: SoundScriptManager.h:123
RoR::SoundScriptManager::skipToNextOpenBrace
void skipToNextOpenBrace(Ogre::DataStreamPtr &chunk)
Definition: SoundScriptManager.cpp:539
RoR::SS_TRIG_NONE
@ SS_TRIG_NONE
Definition: SoundScriptManager.h:53
RoR::SS_MOD_THROTTLE2
@ SS_MOD_THROTTLE2
Definition: SoundScriptManager.h:140
RoR::SS_MOD_AEROENGINE3
@ SS_MOD_AEROENGINE3
Definition: SoundScriptManager.h:129
RoR::SS_TRIG_AFTERBURNER8
@ SS_TRIG_AFTERBURNER8
Definition: SoundScriptManager.h:92
RoR::SoundScriptManager::getLoadingOrder
Ogre::Real getLoadingOrder(void) const
Definition: SoundScriptManager.cpp:336
RoR
Definition: AppContext.h:36
RoR::SS_MOD_TORQUE
@ SS_MOD_TORQUE
Definition: SoundScriptManager.h:133
RoR::SL_FLARES
@ SL_FLARES
Definition: SoundScriptManager.h:169
RoR::SoundScriptInstance::templ
SoundScriptTemplatePtr templ
Definition: SoundScriptManager.h:278
RoR::SoundScriptInstance::setPosition
void setPosition(Ogre::Vector3 pos)
Definition: SoundScriptManager.cpp:1310
RoR::SoundScriptManager::trigToggle
void trigToggle(int actor_id, int trig, int linkType=SL_DEFAULT, int linkItemID=-1)
Definition: SoundScriptManager.cpp:233
RoR::SoundScriptInstance::getTemplate
SoundScriptTemplatePtr getTemplate()
Definition: SoundScriptManager.h:257
RoR::SoundScriptManager::state_map
std::map< int, std::map< int, std::map< int, std::map< int, bool > > > > state_map
Definition: SoundScriptManager.h:367
RoR::SoundScriptManager::trigStop
void trigStop(int actor_id, int trig, int linkType=SL_DEFAULT, int linkItemID=-1)
Definition: SoundScriptManager.cpp:173
RoR::SS_MOD_THROTTLE8
@ SS_MOD_THROTTLE8
Definition: SoundScriptManager.h:146
RoR::SoundScriptInstance::SOUNDPTR_NULL
static const SoundPtr SOUNDPTR_NULL
Definition: SoundScriptManager.h:271
RoR::SS_TRIG_STARTER
@ SS_TRIG_STARTER
Definition: SoundScriptManager.h:62
RoR::SS_TRIG_AFTERBURNER1
@ SS_TRIG_AFTERBURNER1
Definition: SoundScriptManager.h:85
RoR::SoundScriptInstance::SoundScriptInstance
SoundScriptInstance(int actor_id, SoundScriptTemplatePtr templ, SoundManager *sm, Ogre::String instancename, int soundLinkType=SL_DEFAULT, int soundLinkItemId=-1)
Definition: SoundScriptManager.cpp:1093
RoR::SoundScriptInstance::instance_name
Ogre::String instance_name
Definition: SoundScriptManager.h:277
RoR::SoundScriptInstance::actor_id
int actor_id
Definition: SoundScriptManager.h:288
RoR::SoundLinkTypes
SoundLinkTypes
Definition: SoundScriptManager.h:158
RoR::SoundScriptManager::trigs
std::array< SoundScriptInstancePtr, SS_MAX_TRIG *MAX_INSTANCES_PER_GROUP > trigs
Definition: SoundScriptManager.h:357
RoR::SS_TRIG_AOA
@ SS_TRIG_AOA
Definition: SoundScriptManager.h:97
RoR::SoundScriptManager::SoundScriptManager
SoundScriptManager()
Definition: SoundScriptManager.cpp:41
RoR::SoundScriptManager::isDisabled
bool isDisabled()
Definition: SoundScriptManager.h:332
RoR::SoundScriptManager::script_patterns
Ogre::StringVector script_patterns
Definition: SoundScriptManager.h:350
RoR::SoundScriptManager::instances
std::vector< SoundScriptInstancePtr > instances
Definition: SoundScriptManager.h:353