Skip to content

Commit

Permalink
Traktor: Able to set volume through SoundComponent.
Browse files Browse the repository at this point in the history
  • Loading branch information
apistol78 committed Feb 13, 2024
1 parent 7837e85 commit dcea685
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion code/Spray/SoundComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ SoundComponent::SoundComponent(sound::ISoundPlayer* soundPlayer, const resource:
{
}


void SoundComponent::destroy()
{
stop();
Expand Down Expand Up @@ -66,6 +65,12 @@ void SoundComponent::stop()
m_handle = nullptr;
}

void SoundComponent::setVolume(float volume)
{
if (m_handle != nullptr)
m_handle->setVolume(volume);
}

void SoundComponent::setPitch(float pitch)
{
if (m_handle != nullptr)
Expand Down
2 changes: 2 additions & 0 deletions code/Spray/SoundComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class T_DLLCLASS SoundComponent : public world::IEntityComponent

void stop();

void setVolume(float volume);

void setPitch(float pitch);

void setParameter(int32_t id, float parameter);
Expand Down
1 change: 1 addition & 0 deletions code/Spray/SprayClassFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ void SprayClassFactory::createClasses(IRuntimeClassRegistrar* registrar) const
auto classSoundComponent = new AutoRuntimeClass< SoundComponent >();
classSoundComponent->addMethod("play", &SoundComponent::play);
classSoundComponent->addMethod("stop", &SoundComponent::stop);
classSoundComponent->addMethod("setVolume", &SoundComponent::setVolume);
classSoundComponent->addMethod("setPitch", &SoundComponent::setPitch);
classSoundComponent->addMethod("setParameter", &SoundComponent::setParameter);
registrar->registerClass(classSoundComponent);
Expand Down

0 comments on commit dcea685

Please sign in to comment.