87 if (type ==
"ElevatorCar")
89 else if (type ==
"Floor")
91 else if (type ==
"SBS")
102 FMOD_VECTOR pos = {(float)global_position.x, (
float)global_position.y, (float)global_position.z};
103 FMOD_VECTOR vel = { 0, 0, 0 };
118 channel->set3DAttributes(&pos, &vel);
148 channel->setVolume((
float)value);
165 channel->set3DMinMaxDistance((
float)min, (float)max);
184 FMOD_VECTOR vec = { (float)global_direction.x, (
float)global_direction.y, (float)global_direction.z };
187 channel->set3DConeOrientation(&vec);
200 channel->set3DConeSettings((
float)inside_angle, (
float)outside_angle, (
float)outside_volume);
267 if (result ==
true &&
IsPaused() ==
false)
309 FMOD_RESULT result =
channel->isPlaying(&playing);
310 if (result == FMOD_ERR_INVALID_HANDLE || result == FMOD_ERR_CHANNEL_STOLEN)
393 if (filename ==
Filename && force ==
false)
400 Report(
"Loading sound " + filename);
430 unsigned int position;
431 channel->getPosition(&position, FMOD_TIMEUNIT_MS);
434 Percent = (float)position / (
float)length;
454 unsigned int position = (
unsigned int)(percent * length);
455 channel->setPosition(position, FMOD_TIMEUNIT_MS);
464 if (level < 0 || level > 5)
471 channel->set3DDopplerLevel((
float)level);
497 Report(
"Playing queued sound");
504 queue.emplace_back(snd);
523 else if (snd->
played ==
true)
531 Report(
"Processing queued sound");
567 position = Vector3::ZERO;
570 if (type ==
"ElevatorCar")
579 else if (type ==
"Floor")
582 Real nearest = 99999999;
590 if (distance < nearest)
598 else if (type ==
"SBS")
600 Real nearest = 99999999;
608 if (distance < nearest)
Reverb * GetReverb(const std::string &name)
const std::string & GetName()
virtual bool ReportError(const std::string &message)
virtual void Report(const std::string &message)
virtual Vector3 GetPosition(bool relative=false)
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
Quaternion GetOrientation(bool relative=false)
const std::string & GetType()
virtual void SetPosition(const Vector3 &position)
Vector3 ToGlobal(const Vector3 &position)
void RemoveSound(Sound *sound)
Real GetConfigFloat(const std::string &key, Real default_value)
void IncrementSoundCount()
unsigned long GetElapsedTime()
bool GetConfigBool(const std::string &key, bool default_value)
int GetConfigInt(const std::string &key, int default_value)
Reverb * GetReverb(const std::string &name)
SoundSystem * GetSoundSystem()
void DecrementSoundCount()
SoundData * GetSoundData(std::string filename)
unsigned int GetLength(SoundData *data)
SoundData * Load(const std::string &filename)
FMOD::Channel * Prepare(SoundData *data)
void Pause(bool value=true)
void OnRotate(bool parent)
bool Load(const std::string &filename, bool force=false)
bool ReportError(const std::string &message)
std::vector< SoundEntry > queue
bool GetNearestReverbPosition(Vector3 &position)
Sound(Object *parent, const std::string &name, bool permanent)
bool Play(bool reset=true)
void PlayQueued(const std::string &filename, bool stop=true, bool loop=false)
Real GetMinimumDistance()
void SetSpeed(int percent)
Real GetMaximumDistance()
void SetDopplerLevel(Real level)
void SetLoopState(bool value)
void SetPlayPosition(Real percent)
FMOD::Channel * GetChannel()
void Report(const std::string &message)
void SetConeSettings(Real inside_angle=360.0, Real outside_angle=360.0, Real outside_volume=1.0)
void SetVolume(Real value)
void SetDirection(const Vector3 &direction)
void SetDistances(Real min, Real max)
std::string ToString(int number)
void RemoveChannel(FMOD::Channel *channel)
void AddHandle(Sound *handle)
void RemoveHandle(Sound *handle)