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 };
93 bool m_bIsCriticalSound{
false };
96 bool m_bIsAction{
false };
99 bool m_bIsBGM{
false };
108 bool m_bSupportRateChanging{
false };
111 bool m_bSupportPan{
false };
118 typedef T value_type;
121 T* allocate(
size_t n) {
return static_cast<T*
>(mufft_alloc(n *
sizeof(T))); }
122 void deallocate(T* p,
size_t n) { mufft_free(p); }
156 auto Load(
const std::string& sFile,
162 auto Load(
const std::string& sFile) -> bool;
173 auto IsLoaded()
const -> bool;
174 void DeleteSelfWhenFinishedPlaying();
176 void StartPlaying(
float fGiven = 0,
bool forcedTime =
false);
179 auto GetError()
const -> std::string {
return m_sError; }
182 void PlayCopy(
bool is_action,
188 auto Pause(
bool bPause) -> bool;
189 bool m_bPaused{
false };
191 auto GetLengthSeconds() -> float;
192 auto GetPositionSeconds(
bool* approximate =
nullptr,
193 RageTimer* Timestamp =
nullptr) -> float;
194 auto GetLoadedFilePath()
const -> std::string
override
198 auto IsPlaying()
const ->
bool {
return m_bPlaying; }
200 auto GetPlaybackRate()
const -> float;
201 auto GetStartTime()
const ->
RageTimer override;
204 auto SetProperty(
const std::string& sProperty,
float fValue) -> bool;
205 void SetStopModeFromString(
const std::string& sStopMode);
206 void SetPositionSeconds(
float fGiven);
207 void SetIsAction(
bool b);
209 void SetPlayBackCallback(
const std::shared_ptr<LuaReference>& f,
210 unsigned int bufSize = 1024);
211 std::atomic<bool> pendingPlayBackCall{
false };
212 void ExecutePlayBackCallback(Lua* L);
215 virtual void PushSelf(lua_State* L);
227 std::string m_sFilePath;
234 int64_t m_iStreamFrame;
237 std::mutex recentSamplesMutex;
238 unsigned int recentPCMSamplesBufferSize{ 1024 };
239 std::shared_ptr<LuaReference> soundPlayCallback;
240 std::vector<float, MufftAllocator<float>> recentPCMSamples;
241 std::vector<cfloat, MufftAllocator<cfloat>> fftBuffer;
242 mufft_plan_1d *fftPlan{
nullptr };
251 int m_iStoppedSourceFrame{ 0 };
252 bool m_bPlaying{
false };
253 bool m_bDeleteWhenFinished{
false };
255 std::string m_sError;
259 auto GetSourceFrameFromHardwareFrame(int64_t iHardwareFrame,
260 bool* bApproximate =
nullptr)
const
263 auto SetPositionFrames(
int frames = -1) -> bool;
266 void SoundIsFinishedPlaying()
override;
275 auto GetDataToPlay(
float* pBuffer,
277 int64_t& iStreamFrame,
278 int& iBytesRead) ->
int override;
279 void CommitPlayingPosition(int64_t iHardwareFrame,
280 int64_t iStreamFrame,
281 int iGotFrames)
override;
Definition RageSound.h:116
Definition RageThreads.h:232
Definition RageSound.h:27
Definition RageSoundReader.h:7
Definition RageSound.h:135
Definition RageSoundPosMap.h:8
Definition RageSound.h:16
Definition RageSound.h:103
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:129