Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor AmbientSound #2688

Merged
merged 10 commits into from
Jan 4, 2024
Binary file modified data/images/engine/editor/music.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 3 additions & 6 deletions data/images/engine/editor/objects.stoi
Original file line number Diff line number Diff line change
Expand Up @@ -365,24 +365,21 @@
(object
(class "particles-ghosts")
(icon "images/engine/editor/ghostparticles.png"))



;; +-- This should be disabled, as it probably won't support multiple textures
;; | per config object.
;; v ~ Semphris
(object
(class "particles-custom")
(icon "images/engine/editor/particle.png"))



(object
(class "particles-custom-file")
(icon "images/engine/editor/particle_file.png"))
(object
(class "textscroller")
(icon "images/engine/editor/textscroller.png"))
(object
(class "sound-object")
(icon "images/engine/editor/sound.png"))
)

(objectgroup
Expand Down
Binary file added data/images/engine/editor/sound.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/audio/dummy_sound_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DummySoundSource final : public SoundSource
is_playing = true;
}

virtual void stop() override
virtual void stop(bool) override
{
is_playing = false;
}
Expand Down
5 changes: 3 additions & 2 deletions src/audio/openal_sound_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@ OpenALSoundSource::~OpenALSoundSource()
}

void
OpenALSoundSource::stop()
OpenALSoundSource::stop(bool unload_buffer)
{
#ifdef WIN32
// See commit 417a8e7a8c599bfc2dceaec7b6f64ac865318ef1
alSourceRewindv(1, &m_source); // Stops the source
#else
alSourceStop(m_source);
#endif
alSourcei(m_source, AL_BUFFER, AL_NONE);
if (unload_buffer)
alSourcei(m_source, AL_BUFFER, AL_NONE);
try
{
SoundManager::check_al_error("Problem stopping audio source: ");
Expand Down
2 changes: 1 addition & 1 deletion src/audio/openal_sound_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class OpenALSoundSource : public SoundSource
~OpenALSoundSource() override;

virtual void play() override;
virtual void stop() override;
virtual void stop(bool unload_buffer = true) override;
virtual bool playing() const override;

virtual void set_looping(bool looping) override;
Expand Down
2 changes: 1 addition & 1 deletion src/audio/sound_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SoundSource
virtual ~SoundSource() {}

virtual void play() = 0;
virtual void stop() = 0;
virtual void stop(bool unload_buffer = true) = 0;
virtual bool playing() const = 0;

virtual void set_looping(bool looping) = 0;
Expand Down
Loading
Loading