Skip to content

Commit

Permalink
Add IsPlaying to AudioSource
Browse files Browse the repository at this point in the history
  • Loading branch information
KredeGC committed Sep 4, 2024
1 parent 29d82bf commit 746a6b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Mahakam/src/Mahakam/Audio/AudioSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Mahakam

virtual void Play() = 0;
virtual void Stop() = 0;

virtual bool IsPlaying() const = 0;

virtual void SetDataSource(Scope<AudioDataSource> dataSource) = 0;
virtual AudioDataSource* GetDataSource() const = 0;
Expand Down
8 changes: 8 additions & 0 deletions Mahakam/src/Platform/SteamAudio/MiniAudioSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ namespace Mahakam
ma_sound_stop(&m_MaSound);
}

bool MiniAudioSource::IsPlaying() const
{
if (m_DataSource)
return ma_sound_is_playing(&m_MaSound);

return false;
}

void MiniAudioSource::SetDataSource(Scope<AudioDataSource> dataSource)
{
if (m_DataSource)
Expand Down
2 changes: 2 additions & 0 deletions Mahakam/src/Platform/SteamAudio/MiniAudioSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ namespace Mahakam
virtual void Play() override;
virtual void Stop() override;

virtual bool IsPlaying() const override;

virtual void SetDataSource(Scope<AudioDataSource> dataSource) override;
virtual AudioDataSource* GetDataSource() const override { return m_DataSource.get(); }

Expand Down

0 comments on commit 746a6b4

Please sign in to comment.