Program Listing for File AudioPlayer.hpp

↰ Return to documentation for file (engine/include/Cacao/AudioPlayer.hpp)

#pragma once

#include "DllHelper.hpp"
#include "Actor.hpp"
#include "Sound.hpp"

namespace Cacao {
    class CACAO_API ASTRA_REFLECT AudioPlayer final : public Component {
      public:
        AudioPlayer();

        ASTRA_IGNORE void Play();

        ASTRA_IGNORE void Pause();

        ASTRA_IGNORE void Stop();

        enum class ASTRA_IGNORE State {
            Playing,
            Paused,
            Stopped
        };

        ASTRA_IGNORE State GetState() const;

        ASTRA_IGNORE void SetLooping(bool val);

        ASTRA_IGNORE void SetGain(float val);

        ASTRA_IGNORE void SetPitchMultiplier(float val);

        ASTRA_IGNORE void SetPosition(float position);

        ASTRA_IGNORE void SetSound(std::shared_ptr<Sound> sound);

        ASTRA_IGNORE bool GetLooping() const;

        ASTRA_IGNORE float GetGain() const;

        ASTRA_IGNORE float GetPitchMultiplier() const;

        ASTRA_IGNORE float GetPosition() const;

        ASTRA_IGNORE std::shared_ptr<Sound> GetSound() const {
            return sound;
        }

        bool autoplay;

        void OnEnable() override;
        void OnDisable() override;

        ASTRASETUP(AudioPlayer)
        virtual ~AudioPlayer();

        struct Impl;

      private:
        ASTRA_IGNORE std::unique_ptr<Impl> impl;
        friend class ImplAccessor;

        ASTRA_IGNORE std::shared_ptr<Sound> sound;
    };
}