Added runtime functions

This commit is contained in:
2025-09-08 19:20:10 +03:00
parent 13a21387df
commit 0d2603abf0
2 changed files with 13 additions and 0 deletions

View File

@@ -22,6 +22,8 @@ public:
void Reset(); void Reset();
SoundState GetState(); SoundState GetState();
float GetTotalRuntime();
float GetRuntime();
void SetPosition(Magnum::Vector3 position); void SetPosition(Magnum::Vector3 position);
Magnum::Vector3 GetPosition(); Magnum::Vector3 GetPosition();
void SetVolume(float value); void SetVolume(float value);

View File

@@ -27,6 +27,17 @@ Sound::Sound(Engine *engine, std::function<void(Sound *)> setupFunction,
Sound::~Sound() { ma_sound_uninit(&maSound); } Sound::~Sound() { ma_sound_uninit(&maSound); }
Sound::SoundState Sound::GetState() { return state; } Sound::SoundState Sound::GetState() { return state; }
float Sound::GetTotalRuntime() {
float time;
ma_sound_get_length_in_seconds(&this->maSound, &time);
return time;
}
float Sound::GetRuntime() {
float time;
ma_sound_get_cursor_in_seconds(&this->maSound, &time);
return time;
}
// Controls // Controls
void Sound::Play() { void Sound::Play() {
ma_sound_start(&maSound); ma_sound_start(&maSound);