aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/Audio/SoundEngine.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-08 19:08:36 -0400
committerGitHub <noreply@github.com>2026-03-08 18:08:36 -0500
commit28614b922fb77149a54da1a87bebfbc98736f296 (patch)
tree7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.Client/Common/Audio/SoundEngine.cpp
parent88798b501d0cf6287b6f87acb2592676e3cec58d (diff)
Modernize project codebase (#906)
* Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides * Add safety checks and fix a issue with vector going OOR
Diffstat (limited to 'Minecraft.Client/Common/Audio/SoundEngine.cpp')
-rw-r--r--Minecraft.Client/Common/Audio/SoundEngine.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp
index 4b8f5f5b..24cb7bf4 100644
--- a/Minecraft.Client/Common/Audio/SoundEngine.cpp
+++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp
@@ -57,7 +57,7 @@ void SoundEngine::updateSoundEffectVolume(float fVal) {}
void SoundEngine::add(const wstring& name, File *file) {}
void SoundEngine::addMusic(const wstring& name, File *file) {}
void SoundEngine::addStreaming(const wstring& name, File *file) {}
-char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) { return NULL; }
+char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) { return nullptr; }
bool SoundEngine::isStreamingWavebankReady() { return true; }
void SoundEngine::playMusicTick() {};
@@ -334,7 +334,7 @@ void SoundEngine::tick(shared_ptr<Mob> *players, float a)
bool bListenerPostionSet = false;
for( size_t i = 0; i < MAX_LOCAL_PLAYERS; i++ )
{
- if( players[i] != NULL )
+ if( players[i] != nullptr )
{
m_ListenerA[i].bValid=true;
F32 x,y,z;
@@ -401,7 +401,7 @@ SoundEngine::SoundEngine()
m_iMusicDelay=0;
m_validListenerCount=0;
- m_bHeardTrackA=NULL;
+ m_bHeardTrackA=nullptr;
// Start the streaming music playing some music from the overworld
SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
@@ -547,8 +547,8 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
&m_engine,
finalPath,
MA_SOUND_FLAG_ASYNC,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&s->sound) != MA_SUCCESS)
{
app.DebugPrintf("Failed to initialize sound from file: %s\n", finalPath);
@@ -631,8 +631,8 @@ void SoundEngine::playUI(int iSound, float volume, float pitch)
&m_engine,
finalPath,
MA_SOUND_FLAG_ASYNC,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&s->sound) != MA_SUCCESS)
{
delete s;
@@ -700,7 +700,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y , float z,
for(unsigned int i=0;i<MAX_LOCAL_PLAYERS;i++)
{
- if(pMinecraft->localplayers[i]!=NULL)
+ if(pMinecraft->localplayers[i]!=nullptr)
{
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
{
@@ -794,7 +794,7 @@ int SoundEngine::getMusicID(int iDomain)
Minecraft *pMinecraft=Minecraft::GetInstance();
// Before the game has started?
- if(pMinecraft==NULL)
+ if(pMinecraft==nullptr)
{
// any track from the overworld
return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max);
@@ -927,8 +927,8 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter)
&soundEngine->m_engine,
soundEngine->m_szStreamName,
MA_SOUND_FLAG_STREAM,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&soundEngine->m_musicStream);
if (result != MA_SUCCESS)
@@ -1186,7 +1186,7 @@ void SoundEngine::playMusicUpdate()
if( !m_openStreamThread->isRunning() )
{
delete m_openStreamThread;
- m_openStreamThread = NULL;
+ m_openStreamThread = nullptr;
app.DebugPrintf("OpenStreamThreadProc finished. m_musicStreamActive=%d\n", m_musicStreamActive);
@@ -1243,7 +1243,7 @@ void SoundEngine::playMusicUpdate()
if( !m_openStreamThread->isRunning() )
{
delete m_openStreamThread;
- m_openStreamThread = NULL;
+ m_openStreamThread = nullptr;
m_StreamState = eMusicStreamState_Stop;
}
break;
@@ -1279,14 +1279,14 @@ void SoundEngine::playMusicUpdate()
}
if(GetIsPlayingStreamingGameMusic())
{
- //if(m_MusicInfo.pCue!=NULL)
+ //if(m_MusicInfo.pCue!=nullptr)
{
bool playerInEnd = false;
bool playerInNether=false;
Minecraft *pMinecraft = Minecraft::GetInstance();
for(unsigned int i = 0; i < MAX_LOCAL_PLAYERS; ++i)
{
- if(pMinecraft->localplayers[i]!=NULL)
+ if(pMinecraft->localplayers[i]!=nullptr)
{
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
{
@@ -1417,7 +1417,7 @@ void SoundEngine::playMusicUpdate()
for(unsigned int i=0;i<MAX_LOCAL_PLAYERS;i++)
{
- if(pMinecraft->localplayers[i]!=NULL)
+ if(pMinecraft->localplayers[i]!=nullptr)
{
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
{