mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Miniaudio Implementation
This commit is contained in:
parent
eed770b121
commit
3cdc974af4
|
|
@ -15,7 +15,6 @@
|
||||||
#define _SEKRIT
|
#define _SEKRIT
|
||||||
#include "..\..\Durango\Miles\include\mss.h"
|
#include "..\..\Durango\Miles\include\mss.h"
|
||||||
#elif defined _WINDOWS64
|
#elif defined _WINDOWS64
|
||||||
#include "..\..\windows64\Miles\include\mss.h"
|
|
||||||
#else // PS4
|
#else // PS4
|
||||||
// 4J Stu - Temp define to get Miles to link, can likely be removed when we get a new version of Miles
|
// 4J Stu - Temp define to get Miles to link, can likely be removed when we get a new version of Miles
|
||||||
#define _SEKRIT2
|
#define _SEKRIT2
|
||||||
|
|
@ -97,4 +96,4 @@ private:
|
||||||
bool m_bIsPlayingStreamingGameMusic;
|
bool m_bIsPlayingStreamingGameMusic;
|
||||||
bool m_bIsPlayingEndMusic;
|
bool m_bIsPlayingEndMusic;
|
||||||
bool m_bIsPlayingNetherMusic;
|
bool m_bIsPlayingNetherMusic;
|
||||||
};
|
};
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -4,6 +4,8 @@ class Options;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#include "..\..\Minecraft.World\SoundTypes.h"
|
#include "..\..\Minecraft.World\SoundTypes.h"
|
||||||
|
|
||||||
|
#include "miniaudio.h"
|
||||||
|
|
||||||
enum eMUSICFILES
|
enum eMUSICFILES
|
||||||
{
|
{
|
||||||
eStream_Overworld_Calm1 = 0,
|
eStream_Overworld_Calm1 = 0,
|
||||||
|
|
@ -76,7 +78,11 @@ enum MUSIC_STREAMSTATE
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
#ifndef _WINDOWS64
|
||||||
F32 x,y,z,volume,pitch;
|
F32 x,y,z,volume,pitch;
|
||||||
|
#else
|
||||||
|
float x,y,z,volume,pitch;
|
||||||
|
#endif
|
||||||
int iSound;
|
int iSound;
|
||||||
bool bIs3D;
|
bool bIs3D;
|
||||||
bool bUseSoundsPitchVal;
|
bool bUseSoundsPitchVal;
|
||||||
|
|
@ -86,6 +92,17 @@ typedef struct
|
||||||
}
|
}
|
||||||
AUDIO_INFO;
|
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
|
class SoundEngine : public ConsoleSoundEngine
|
||||||
{
|
{
|
||||||
static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added
|
static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added
|
||||||
|
|
@ -112,7 +129,7 @@ public:
|
||||||
int getMusicID(int iDomain);
|
int getMusicID(int iDomain);
|
||||||
int getMusicID(const wstring& name);
|
int getMusicID(const wstring& name);
|
||||||
void SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1);
|
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
|
void updateMiniAudio();
|
||||||
void playMusicUpdate();
|
void playMusicUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -126,9 +143,10 @@ private:
|
||||||
|
|
||||||
int GetRandomishTrack(int iStart,int iEnd);
|
int GetRandomishTrack(int iStart,int iEnd);
|
||||||
|
|
||||||
HMSOUNDBANK m_hBank;
|
ma_engine m_engine;
|
||||||
HDIGDRIVER m_hDriver;
|
ma_engine_config m_engineConfig;
|
||||||
HSTREAM m_hStream;
|
ma_sound m_musicStream;
|
||||||
|
bool m_musicStreamActive;
|
||||||
|
|
||||||
static char m_szSoundPath[];
|
static char m_szSoundPath[];
|
||||||
static char m_szMusicPath[];
|
static char m_szMusicPath[];
|
||||||
|
|
@ -165,4 +183,4 @@ private:
|
||||||
#ifdef __ORBIS__
|
#ifdef __ORBIS__
|
||||||
int32_t m_hBGMAudio;
|
int32_t m_hBGMAudio;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
95844
Minecraft.Client/Common/Audio/miniaudio.h
Normal file
95844
Minecraft.Client/Common/Audio/miniaudio.h
Normal file
File diff suppressed because it is too large
Load diff
74
Minecraft.Client/Common/Filesystem/Filesystem.cpp
Normal file
74
Minecraft.Client/Common/Filesystem/Filesystem.cpp
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "Filesystem.h"
|
||||||
|
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
#include <windows.h>
|
||||||
|
#endif // TODO: More os' filesystem handling for when the project moves away from only Windows
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
bool FileOrDirectoryExists(const char* path)
|
||||||
|
{
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
DWORD attribs = GetFileAttributesA(path);
|
||||||
|
return (attribs != INVALID_FILE_ATTRIBUTES);
|
||||||
|
#else
|
||||||
|
#error "FileOrDirectoryExists not implemented for this platform"
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FileExists(const char* path)
|
||||||
|
{
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
DWORD attribs = GetFileAttributesA(path);
|
||||||
|
return (attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY));
|
||||||
|
#else
|
||||||
|
#error "FileExists not implemented for this platform"
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DirectoryExists(const char* path)
|
||||||
|
{
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
DWORD attribs = GetFileAttributesA(path);
|
||||||
|
return (attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY));
|
||||||
|
#else
|
||||||
|
#error "DirectoryExists not implemented for this platform"
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetFirstFileInDirectory(const char* directory, char* outFilePath, size_t outFilePathSize)
|
||||||
|
{
|
||||||
|
#ifdef _WINDOWS64
|
||||||
|
char searchPath[MAX_PATH];
|
||||||
|
snprintf(searchPath, MAX_PATH, "%s\\*", directory);
|
||||||
|
|
||||||
|
WIN32_FIND_DATAA findData;
|
||||||
|
HANDLE hFind = FindFirstFileA(searchPath, &findData);
|
||||||
|
|
||||||
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
|
{
|
||||||
|
// Found a file, copy its path to the output buffer
|
||||||
|
snprintf(outFilePath, outFilePathSize, "%s\\%s", directory, findData.cFileName);
|
||||||
|
FindClose(hFind);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} while (FindNextFileA(hFind, &findData) != 0);
|
||||||
|
|
||||||
|
FindClose(hFind);
|
||||||
|
return false; // No files found in the directory
|
||||||
|
#else
|
||||||
|
#error "GetFirstFileInDirectory not implemented for this platform"
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
6
Minecraft.Client/Common/Filesystem/Filesystem.h
Normal file
6
Minecraft.Client/Common/Filesystem/Filesystem.h
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
bool FileOrDirectoryExists(const char* path);
|
||||||
|
bool FileExists(const char* path);
|
||||||
|
bool DirectoryExists(const char* path);
|
||||||
|
bool GetFirstFileInDirectory(const char* directory, char* outFilePath, size_t outFilePathSize);
|
||||||
|
|
@ -5698,6 +5698,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||||
<ClInclude Include="Common\App_enums.h" />
|
<ClInclude Include="Common\App_enums.h" />
|
||||||
<ClInclude Include="Common\App_structs.h" />
|
<ClInclude Include="Common\App_structs.h" />
|
||||||
<ClInclude Include="Common\Audio\Consoles_SoundEngine.h" />
|
<ClInclude Include="Common\Audio\Consoles_SoundEngine.h" />
|
||||||
|
<ClInclude Include="Common\Audio\miniaudio.h" />
|
||||||
<ClInclude Include="Common\Audio\SoundEngine.h" />
|
<ClInclude Include="Common\Audio\SoundEngine.h" />
|
||||||
<ClInclude Include="Common\BuildVer.h" />
|
<ClInclude Include="Common\BuildVer.h" />
|
||||||
<ClInclude Include="Common\Colours\ColourTable.h" />
|
<ClInclude Include="Common\Colours\ColourTable.h" />
|
||||||
|
|
@ -5715,6 +5716,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||||
<ClInclude Include="Common\DLC\DLCSkinFile.h" />
|
<ClInclude Include="Common\DLC\DLCSkinFile.h" />
|
||||||
<ClInclude Include="Common\DLC\DLCTextureFile.h" />
|
<ClInclude Include="Common\DLC\DLCTextureFile.h" />
|
||||||
<ClInclude Include="Common\DLC\DLCUIDataFile.h" />
|
<ClInclude Include="Common\DLC\DLCUIDataFile.h" />
|
||||||
|
<ClInclude Include="Common\Filesystem\Filesystem.h" />
|
||||||
<ClInclude Include="Common\GameRules\AddEnchantmentRuleDefinition.h" />
|
<ClInclude Include="Common\GameRules\AddEnchantmentRuleDefinition.h" />
|
||||||
<ClInclude Include="Common\GameRules\AddItemRuleDefinition.h" />
|
<ClInclude Include="Common\GameRules\AddItemRuleDefinition.h" />
|
||||||
<ClInclude Include="Common\GameRules\ApplySchematicRuleDefinition.h" />
|
<ClInclude Include="Common\GameRules\ApplySchematicRuleDefinition.h" />
|
||||||
|
|
@ -28470,6 +28472,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||||
<ClCompile Include="Common\DLC\DLCSkinFile.cpp" />
|
<ClCompile Include="Common\DLC\DLCSkinFile.cpp" />
|
||||||
<ClCompile Include="Common\DLC\DLCTextureFile.cpp" />
|
<ClCompile Include="Common\DLC\DLCTextureFile.cpp" />
|
||||||
<ClCompile Include="Common\DLC\DLCUIDataFile.cpp" />
|
<ClCompile Include="Common\DLC\DLCUIDataFile.cpp" />
|
||||||
|
<ClCompile Include="Common\Filesystem\Filesystem.cpp" />
|
||||||
<ClCompile Include="Common\GameRules\AddEnchantmentRuleDefinition.cpp" />
|
<ClCompile Include="Common\GameRules\AddEnchantmentRuleDefinition.cpp" />
|
||||||
<ClCompile Include="Common\GameRules\AddItemRuleDefinition.cpp" />
|
<ClCompile Include="Common\GameRules\AddItemRuleDefinition.cpp" />
|
||||||
<ClCompile Include="Common\GameRules\ApplySchematicRuleDefinition.cpp" />
|
<ClCompile Include="Common\GameRules\ApplySchematicRuleDefinition.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -729,6 +729,9 @@
|
||||||
<Filter Include="Windows64\Source Files\Network">
|
<Filter Include="Windows64\Source Files\Network">
|
||||||
<UniqueIdentifier>{e5d7fb24-25b8-413c-84ec-974bf0d4a3d1}</UniqueIdentifier>
|
<UniqueIdentifier>{e5d7fb24-25b8-413c-84ec-974bf0d4a3d1}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Common\Source Files\Filesystem">
|
||||||
|
<UniqueIdentifier>{c79fd64d-7529-4da4-b5f3-2541e084932b}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="ReadMe.txt" />
|
<None Include="ReadMe.txt" />
|
||||||
|
|
@ -3778,6 +3781,12 @@
|
||||||
<ClInclude Include="Windows64\Network\WinsockNetLayer.h">
|
<ClInclude Include="Windows64\Network\WinsockNetLayer.h">
|
||||||
<Filter>Windows64\Source Files\Network</Filter>
|
<Filter>Windows64\Source Files\Network</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Common\Filesystem\Filesystem.h">
|
||||||
|
<Filter>Common\Source Files\Filesystem</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Common\Audio\miniaudio.h">
|
||||||
|
<Filter>Common\Source Files\Audio</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
|
|
@ -5931,6 +5940,9 @@
|
||||||
<ClCompile Include="Windows64\Network\WinsockNetLayer.cpp">
|
<ClCompile Include="Windows64\Network\WinsockNetLayer.cpp">
|
||||||
<Filter>Windows64\Source Files\Network</Filter>
|
<Filter>Windows64\Source Files\Network</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Common\Filesystem\Filesystem.cpp">
|
||||||
|
<Filter>Common\Source Files\Filesystem</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Library Include="Xbox\4JLibs\libs\4J_Render_d.lib">
|
<Library Include="Xbox\4JLibs\libs\4J_Render_d.lib">
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ set(MINECRAFT_CLIENT_SOURCES
|
||||||
"Common/DLC/DLCSkinFile.cpp"
|
"Common/DLC/DLCSkinFile.cpp"
|
||||||
"Common/DLC/DLCTextureFile.cpp"
|
"Common/DLC/DLCTextureFile.cpp"
|
||||||
"Common/DLC/DLCUIDataFile.cpp"
|
"Common/DLC/DLCUIDataFile.cpp"
|
||||||
|
"Common/Filesystem/Filesystem.cpp"
|
||||||
"Common/GameRules/AddEnchantmentRuleDefinition.cpp"
|
"Common/GameRules/AddEnchantmentRuleDefinition.cpp"
|
||||||
"Common/GameRules/AddItemRuleDefinition.cpp"
|
"Common/GameRules/AddItemRuleDefinition.cpp"
|
||||||
"Common/GameRules/ApplySchematicRuleDefinition.cpp"
|
"Common/GameRules/ApplySchematicRuleDefinition.cpp"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue