11#ifndef INCGUARD_MGL_AUDIO_SOURCE_INSTANCE_H_1610735558
12#define INCGUARD_MGL_AUDIO_SOURCE_INSTANCE_H_1610735558
45 bool Play(uint32_t trackIndex,
LoopType loopType,
float volume)
noexcept;
46 bool Update(
float &outDataL,
float &outDataR)
noexcept;
54 void Pause(
bool isEnabled)
noexcept
56 _isPaused = isEnabled;
78 const std::lock_guard<std::mutex> lock(_mutex);
80 _status = Status::Remove;
92 const std::lock_guard<std::mutex> lock(_mutex);
108 void SetVolume(
float volume,
float fadeTimeSec,
float samplesPerSec,
bool isAutoStop)
noexcept
110 const std::lock_guard<std::mutex> lock(_mutex);
112 _fade.
Start(_volume, volume, fadeTimeSec, samplesPerSec, isAutoStop);
135 return _status == Status::Play;
158 _isAutoRemove = isEnabled;
164 uint32_t _trackIndex{0};
165 size_t _currentFrame{0};
166 std::atomic<LoopType> _loopType{LoopType::ResourceDefault};
168 std::atomic<bool> _isAutoRemove;
169 std::atomic<bool> _isPaused{
false};
170 std::atomic<float> _volume{0.0f};
173 enum class Status : uint8_t
179 std::atomic<Status> _status{Status::Standby};
void Cancel() noexcept
キャンセル
Definition mgl_audio_fade.cc:83
void Start(float currentVolume, float targetVolume, float fadeTimeSec, float samplesPerSec, bool isAutoStop) noexcept
開始
Definition mgl_audio_fade.cc:27
constexpr bool IsActive() const noexcept
有効状態を取得
Definition mgl_audio_fade.h:36
MGL オーディオソースインスタンス
Definition mgl_audio_source_instance.h:24
bool Play(uint32_t trackIndex, LoopType loopType, float volume) noexcept
再生開始
Definition mgl_audio_source_instance.cc:37
void SetAutoRemove(bool isEnabled) noexcept
再生終了後に自動で削除するかの設定
Definition mgl_audio_source_instance.h:156
~SourceInstance() noexcept
デストラクタ
Definition mgl_audio_source_instance.h:40
bool Update(float &outDataL, float &outDataR) noexcept
ソースの更新処理
Definition mgl_audio_source_instance.cc:91
bool IsPlaying() const noexcept
再生中かどうかを取得
Definition mgl_audio_source_instance.h:133
SourceInstance(SharedVoice &voice, bool isAutoRemove) noexcept
コンストラクタ
Definition mgl_audio_source_instance.cc:20
bool IsPaused() const noexcept
一時停止の状態を取得
Definition mgl_audio_source_instance.h:66
constexpr bool IsFading() const noexcept
フェード中かどうかを取得
Definition mgl_audio_source_instance.h:145
float GetVolume() const noexcept
音量を取得
Definition mgl_audio_source_instance.h:121
void SetVolume(float volume) noexcept
音量の設定
Definition mgl_audio_source_instance.h:90
void Pause(bool isEnabled) noexcept
一時停止
Definition mgl_audio_source_instance.h:54
void SetVolume(float volume, float fadeTimeSec, float samplesPerSec, bool isAutoStop) noexcept
変化時間を指定して音量を設定
Definition mgl_audio_source_instance.h:108
void Remove() noexcept
削除要求
Definition mgl_audio_source_instance.h:76
LoopType
ループタイプ
Definition mgl_audio_defs.h:71
std::weak_ptr< SourceInstance > WeakSourceInstance
弱参照のソースインスタンス
Definition mgl_audio_source_instance.h:190
std::shared_ptr< SourceInstance > SharedSourceInstance
共有ソースインスタンス
Definition mgl_audio_source_instance.h:187
std::shared_ptr< Voice > SharedVoice
共有ボイスの型
Definition mgl_audio_voice.h:251