6#include "RageSoundPosMap.h"
7#include "RageUtil/Misc/RageThreads.h"
8#include "RageUtil/Misc/RageTimer.h"
9#include "Etterna/Models/Lua/LuaReference.h"
30 virtual void SoundIsFinishedPlaying() = 0;
31 virtual auto GetDataToPlay(
float* buffer,
33 int64_t& iStreamFrame,
34 int& got_bytes) ->
int = 0;
35 virtual void CommitPlayingPosition(int64_t iFrameno,
38 [[nodiscard]]
virtual auto GetStartTime()
const ->
RageTimer
42 [[nodiscard]]
virtual auto GetLoadedFilePath()
const -> std::string = 0;
55 float m_StartSecond{ 0 };
56 float m_LengthSeconds{ -1 };
59 float m_fFadeInSeconds{ 0 };
62 float m_fFadeOutSeconds{ 0 };
64 float m_Volume{ 1.0F };
65 float m_fAttractVolume{ 1.0F };
69 float m_fPitch{ 1.0F };
70 float m_fSpeed{ 1.0F };
73 bool m_bAccurateSync{
false };
92 bool m_bIsCriticalSound{
103 bool m_bSupportRateChanging{
false };
106 bool m_bSupportPan{
false };
113 typedef T value_type;
116 T* allocate(
size_t n) {
return static_cast<T*
>(mufft_alloc(n *
sizeof(T))); }
117 void deallocate(T* p,
size_t n) { mufft_free(p); }
151 auto Load(
const std::string& sFile,
157 auto Load(
const std::string& sFile) -> bool;
168 auto IsLoaded()
const -> bool;
169 void DeleteSelfWhenFinishedPlaying();
171 void StartPlaying(
float fGiven = 0,
bool forcedTime =
false);
174 auto GetError()
const -> std::string {
return m_sError; }
177 void PlayCopy(
bool is_action,
183 auto Pause(
bool bPause) -> bool;
184 bool m_bPaused{
false };
186 auto GetLengthSeconds() -> float;
187 auto GetPositionSeconds(
bool* approximate =
nullptr,
188 RageTimer* Timestamp =
nullptr) -> float;
189 auto GetLoadedFilePath()
const -> std::string
override
193 auto IsPlaying()
const ->
bool {
return m_bPlaying; }
195 auto GetPlaybackRate()
const -> float;
196 auto GetStartTime()
const ->
RageTimer override;
199 auto SetProperty(
const std::string& sProperty,
float fValue) -> bool;
200 void SetStopModeFromString(
const std::string& sStopMode);
201 void SetPositionSeconds(
float fGiven);
203 void SetPlayBackCallback(
const std::shared_ptr<LuaReference>& f,
204 unsigned int bufSize = 1024);
205 std::atomic<bool> pendingPlayBackCall{
false };
206 void ExecutePlayBackCallback(Lua* L);
209 virtual void PushSelf(lua_State* L);
221 std::string m_sFilePath;
228 int64_t m_iStreamFrame;
231 std::mutex recentSamplesMutex;
232 unsigned int recentPCMSamplesBufferSize{ 1024 };
233 std::shared_ptr<LuaReference> soundPlayCallback;
234 std::vector<float, MufftAllocator<float>> recentPCMSamples;
235 std::vector<cfloat, MufftAllocator<cfloat>> fftBuffer;
236 mufft_plan_1d *fftPlan{
nullptr };
245 int m_iStoppedSourceFrame{ 0 };
246 bool m_bPlaying{
false };
247 bool m_bDeleteWhenFinished{
false };
249 std::string m_sError;
253 auto GetSourceFrameFromHardwareFrame(int64_t iHardwareFrame,
254 bool* bApproximate =
nullptr)
const
257 auto SetPositionFrames(
int frames = -1) -> bool;
260 void SoundIsFinishedPlaying()
override;
269 auto GetDataToPlay(
float* pBuffer,
271 int64_t& iStreamFrame,
272 int& iBytesRead) ->
int override;
273 void CommitPlayingPosition(int64_t iHardwareFrame,
274 int64_t iStreamFrame,
275 int iGotFrames)
override;
Definition RageSound.h:111
Definition RageThreads.h:232
Definition RageSound.h:27
Definition RageSoundReader.h:7
Definition RageSound.h:130
Definition RageSoundPosMap.h:8
Definition RageSound.h:16
Definition RageSound.h:98
The parameters to play a sound.
Definition RageSound.h:51
enum RageSoundParams::StopMode_t M_AUTO
How does the sound stop itself, if it does?
StopMode_t
How does the sound stop itself, if it does?
Definition RageSound.h:81
@ M_CONTINUE
Definition RageSound.h:84
@ M_LOOP
Definition RageSound.h:83
@ M_STOP
Definition RageSound.h:82
Definition RageSound.h:124