feat(Windows64): miniaudio

This commit is contained in:
2026-07-23 11:57:04 -04:00
parent 51ee0d8e57
commit 2b051aa038
647 changed files with 103781 additions and 18 deletions
+41 -2
View File
@@ -3,6 +3,17 @@ class Mob;
class Options;
using namespace std;
#include "..\..\Minecraft.World\SoundTypes.h"
#ifdef _WINDOWS64
#include "miniaudio.h"
#include <unordered_map>
#include <string>
const float SFX_3D_MIN_DISTANCE = 1.0f;
const float SFX_3D_MAX_DISTANCE = 16.0f;
const float SFX_3D_ROLLOFF = 0.5f;
const float SFX_VOLUME_MULTIPLIER = 1.5f;
const float SFX_MAX_GAIN = 1.5f;
#endif
enum eMUSICFILES
{
@@ -76,7 +87,11 @@ enum MUSIC_STREAMSTATE
typedef struct
{
F32 x,y,z,volume,pitch;
#ifndef _WINDOWS64
F32 x, y, z, volume, pitch;
#else
float x, y, z, volume, pitch;
#endif
int iSound;
bool bIs3D;
bool bUseSoundsPitchVal;
@@ -86,6 +101,17 @@ typedef struct
}
AUDIO_INFO;
#ifdef _WINDOWS64
struct MiniAudioSound
{
ma_sound sound;
AUDIO_INFO info;
bool active;
};
extern std::vector<MiniAudioSound*> m_activeSounds;
#endif
class SoundEngine : public ConsoleSoundEngine
{
static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added
@@ -112,7 +138,11 @@ public:
int getMusicID(int iDomain);
int getMusicID(const wstring& name);
void SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1);
void updateMiles(); // AP added so Vita can update all the Miles functions during the mixer callback
#ifdef _WINDOWS64
void updateMiniAudio();
#else
void updateMiles(); // AP added so Vita can update all the Miles functions during the mixer callback
#endif
void playMusicUpdate();
private:
@@ -126,9 +156,18 @@ private:
int GetRandomishTrack(int iStart,int iEnd);
#ifdef _WINDOWS64
ma_engine m_engine;
ma_engine_config m_engineConfig;
ma_sound m_musicStream;
bool m_musicStreamActive;
std::unordered_map<int, std::vector<std::string>> m_soundPathCache;
std::unordered_map<int, std::string> m_uiSoundPathCache;
#else
HMSOUNDBANK m_hBank;
HDIGDRIVER m_hDriver;
HSTREAM m_hStream;
#endif
static char m_szSoundPath[];
static char m_szMusicPath[];