From b6bb86a9c111199952ce72a61227dfae9851e0e3 Mon Sep 17 00:00:00 2001 From: AdventureT Date: Sun, 10 Dec 2023 14:54:12 +0100 Subject: [PATCH] Some minor changes --- Dependencies.lua | 4 ++-- OpenJPOG/Source/ASoundManager.cpp | 6 ++++-- OpenJPOG/Source/ASoundManager.h | 25 +++++++++++++++++++++---- Toshi/Source/TKernel/TMemory.cpp | 3 ++- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/Dependencies.lua b/Dependencies.lua index 8cc5de7..f0d7f70 100644 --- a/Dependencies.lua +++ b/Dependencies.lua @@ -1,5 +1,5 @@ IncludeDir = {} -IncludeDir.fmod = "%{wks.location}/Toshi/Vendor/fmod/include" +IncludeDir.fmod = "%{wks.location}/Toshi/vendor/fmod/include" IncludeDir.libogg = "%{wks.location}/Toshi/Vendor/libogg/include" IncludeDir.libvorbis = "%{wks.location}/Toshi/Vendor/libvorbis/include" IncludeDir.libtheora = "%{wks.location}/Toshi/Vendor/libtheora/include" @@ -8,7 +8,7 @@ IncludeDir.stb = "%{wks.location}/Toshi/Vendor/stb" IncludeDir.catch2 = "%{wks.location}/Tools/Vendor/Catch2/include" LibDir = {} -LibDir.fmod = "%{wks.location}/Toshi/Vendor/fmod/lib" +LibDir.fmod = "%{wks.location}/Toshi/vendor/fmod/lib" LibDir.catch2 = "%{wks.location}/Tools/Vendor/Catch2/lib" -- content of these folders should be copied to any client application diff --git a/OpenJPOG/Source/ASoundManager.cpp b/OpenJPOG/Source/ASoundManager.cpp index a07e7dc..03418cb 100644 --- a/OpenJPOG/Source/ASoundManager.cpp +++ b/OpenJPOG/Source/ASoundManager.cpp @@ -2,6 +2,8 @@ TOSHI_NAMESPACE_USING +IMPLEMENT_DYNCREATE(ASoundManager, TObject); + TFLOAT ASoundManager::GetPitch(TINT a_iChannel) const { TINT freq; @@ -9,8 +11,8 @@ TFLOAT ASoundManager::GetPitch(TINT a_iChannel) const FSOUND_SAMPLE* pSample = FSOUND_GetCurrentSample(a_iChannel); if (pSample) { FSOUND_Sample_GetDefaults(pSample, &freq, NULL, NULL, NULL); - return FSOUND_GetFrequency(a_iChannel) / a_iChannel; + return FSOUND_GetFrequency(a_iChannel) / freq; } } return 0.0f; -} +} \ No newline at end of file diff --git a/OpenJPOG/Source/ASoundManager.h b/OpenJPOG/Source/ASoundManager.h index 1c74c17..be7fca6 100644 --- a/OpenJPOG/Source/ASoundManager.h +++ b/OpenJPOG/Source/ASoundManager.h @@ -1,13 +1,30 @@ #pragma once #include "TKernel/TDebug.h" +#include "TKernel/TObject.h" #include "fmod.h" -TOSHI_NAMESPACE_BEGIN +TOSHI_NAMESPACE_USING -class ASoundManager +class ASample { + +}; + +class ASoundManager : public TObject +{ + DECLARE_DYNAMIC(ASoundManager); + + struct AChannel + { + + }; + +protected: + inline static ASample** s_aSamples = TNULL; + public: TFLOAT GetPitch(TINT a_iChannel) const; + TBOOL GetPaused(TINT a_iChannel) const { return a_iChannel != -1 ? FSOUND_GetPaused(a_iChannel) : TFALSE; } + TFLOAT GetPan(TINT a_iChannel) const { return a_iChannel != -1 ? -1.0f + (FSOUND_GetPan(a_iChannel) / 127.5f) : 0.0f; } + TFLOAT GetSFXVolume() { return 1.0f; }; }; - -TOSHI_NAMESPACE_END \ No newline at end of file diff --git a/Toshi/Source/TKernel/TMemory.cpp b/Toshi/Source/TKernel/TMemory.cpp index c54c528..ced4577 100644 --- a/Toshi/Source/TKernel/TMemory.cpp +++ b/Toshi/Source/TKernel/TMemory.cpp @@ -66,7 +66,8 @@ TBOOL TMemory::Free(TPVOID a_pMem) TMutexLock lock; Initialise(); lock.Create(g_pMutex); - if (a_pMem) { + TUINT uiMem = reinterpret_cast(a_pMem); + if ((uiMem & 3) == 0 && a_pMem) { Initialise(); } return TBOOL();