Miniaudio Implementation (+stb_vorbis) (#624)
* Miniaudio Implementation * Do not link miles + remove miles lib
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
#define _SEKRIT
|
||||
#include "..\..\Durango\Miles\include\mss.h"
|
||||
#elif defined _WINDOWS64
|
||||
#include "..\..\windows64\Miles\include\mss.h"
|
||||
#else // PS4
|
||||
// 4J Stu - Temp define to get Miles to link, can likely be removed when we get a new version of Miles
|
||||
#define _SEKRIT2
|
||||
@@ -97,4 +96,4 @@ private:
|
||||
bool m_bIsPlayingStreamingGameMusic;
|
||||
bool m_bIsPlayingEndMusic;
|
||||
bool m_bIsPlayingNetherMusic;
|
||||
};
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,8 @@ class Options;
|
||||
using namespace std;
|
||||
#include "..\..\Minecraft.World\SoundTypes.h"
|
||||
|
||||
#include "miniaudio.h"
|
||||
|
||||
enum eMUSICFILES
|
||||
{
|
||||
eStream_Overworld_Calm1 = 0,
|
||||
@@ -76,7 +78,11 @@ enum MUSIC_STREAMSTATE
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#ifndef _WINDOWS64
|
||||
F32 x,y,z,volume,pitch;
|
||||
#else
|
||||
float x,y,z,volume,pitch;
|
||||
#endif
|
||||
int iSound;
|
||||
bool bIs3D;
|
||||
bool bUseSoundsPitchVal;
|
||||
@@ -86,6 +92,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 +129,7 @@ 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
|
||||
void updateMiniAudio();
|
||||
void playMusicUpdate();
|
||||
|
||||
private:
|
||||
@@ -126,9 +143,10 @@ private:
|
||||
|
||||
int GetRandomishTrack(int iStart,int iEnd);
|
||||
|
||||
HMSOUNDBANK m_hBank;
|
||||
HDIGDRIVER m_hDriver;
|
||||
HSTREAM m_hStream;
|
||||
ma_engine m_engine;
|
||||
ma_engine_config m_engineConfig;
|
||||
ma_sound m_musicStream;
|
||||
bool m_musicStreamActive;
|
||||
|
||||
static char m_szSoundPath[];
|
||||
static char m_szMusicPath[];
|
||||
@@ -165,4 +183,4 @@ private:
|
||||
#ifdef __ORBIS__
|
||||
int32_t m_hBGMAudio;
|
||||
#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
5580
Minecraft.Client/Common/Audio/stb_vorbis.h
Normal file
5580
Minecraft.Client/Common/Audio/stb_vorbis.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);
|
||||
Reference in New Issue
Block a user