ShitEngine
基于 C++20 与 SDL3 的轻量级 2D 游戏引擎
载入中...
搜索中...
未找到
AudioTrack.h
浏览该文件的文档.
1#pragma once
2#include "../Core/Core.h"
3
4struct MIX_Track;
5
6namespace Shit {
7
9
11public:
12 AudioTrack(const AudioTrack&) = delete;
13 AudioTrack& operator=(const AudioTrack&) = delete;
15 AudioTrack& operator=(AudioTrack&&) noexcept;
17
18 void pause();
19 void resume();
20 void stop();
21 void setVolume(float gain);
22 float getVolume() const;
23 void setLooping(int loopCount); // -1 = 无限, 0 = 不循环, N = N 次
24 int getLooping() const { return m_loops; }
25
26 bool isPlaying() const;
27 bool isPaused() const;
28 bool isFinished() const;
29
30private:
31 friend class AudioPlayer;
32 friend class AudioTrackGroup;
33 AudioTrack() = default;
34 explicit AudioTrack(MIX_Track* handle);
35
36 MIX_Track* m_handle = nullptr;
37 float m_gain = 1.0f;
38 int m_loops = 0;
39 AudioTrackGroup* m_group = nullptr;
40 bool m_started = false;
41 bool m_paused = false;
42};
43
44} // namespace Shit
定义 AudioPlayer.h:11
void setLooping(int loopCount)
friend class AudioTrackGroup
定义 AudioTrack.h:32
bool isPlaying() const
bool isFinished() const
bool isPaused() const
friend class AudioPlayer
定义 AudioTrack.h:31
AudioTrack(AudioTrack &&) noexcept
void setVolume(float gain)
float getVolume() const
AudioTrack(const AudioTrack &)=delete
int getLooping() const
定义 AudioTrack.h:24
AudioTrack & operator=(const AudioTrack &)=delete
定义 AudioPlayer.h:9