Skip to content

Commit

Permalink
snd meh
Browse files Browse the repository at this point in the history
  • Loading branch information
cryham committed Nov 11, 2024
1 parent 1bda027 commit 5a60c5e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/sound/SoundBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ bool SoundBase::isPlaying()

void SoundBase::setEnabled(bool e)
{
if (enabled == e)
return;
enabled = e;
sound_mgr->recomputeSource(source_id, REASON_PLAY, 0.0f, NULL);
}
Expand All @@ -97,30 +99,40 @@ void SoundBase::stop()

void SoundBase::setGain(float gain1)
{
if (gain == gain1)
return;
gain = gain1;
sound_mgr->recomputeSource(source_id, REASON_GAIN, gain, NULL);
}

void SoundBase::setLoop(bool loop1)
{
if (loop == loop1)
return;
loop = loop1;
sound_mgr->recomputeSource(source_id, REASON_LOOP, loop ? 1.0f : 0.0f, NULL);
}

void SoundBase::setPitch(float pitch1)
{
if (pitch == pitch1)
return;
pitch = pitch1;
sound_mgr->recomputeSource(source_id, REASON_PTCH, pitch, NULL);
}

void SoundBase::setPosition(Ogre::Vector3 pos1)
{
if (pos == pos1)
return;
pos = pos1;
sound_mgr->recomputeSource(source_id, REASON_POS, 0.0f, &pos);
}

void SoundBase::setVelocity(Ogre::Vector3 vel1)
{
if (vel == vel1)
return;
vel = vel1;
sound_mgr->recomputeSource(source_id, REASON_VEL, 0.0f, &vel);
}
Expand All @@ -129,3 +141,4 @@ void SoundBase::seek(float pos) // [0..1)
{
sound_mgr->recomputeSource(source_id, REASON_SEEK, pos * samples, NULL);
}

4 changes: 2 additions & 2 deletions src/sound/SoundBaseMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ using namespace Ogre;


const float SoundBaseMgr::MAX_DISTANCE = 500.f; // 500
const float SoundBaseMgr::REF_DISTANCE = 1.0f; // 1
const float SoundBaseMgr::ROLLOFF_FACTOR = 0.05f; // 0.05 0.1
const float SoundBaseMgr::REF_DISTANCE = 1.0f; // 1 7.5 new
const float SoundBaseMgr::ROLLOFF_FACTOR = 0.05f; // 0.05 0.1 1.0 new


// Init
Expand Down

0 comments on commit 5a60c5e

Please sign in to comment.