Skip to content

Commit

Permalink
Some minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AdventureT committed Dec 10, 2023
1 parent 0fc3ebe commit b6bb86a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Dependencies.lua
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions OpenJPOG/Source/ASoundManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

TOSHI_NAMESPACE_USING

IMPLEMENT_DYNCREATE(ASoundManager, TObject);

TFLOAT ASoundManager::GetPitch(TINT a_iChannel) const
{
TINT freq;
if (a_iChannel != -1) {
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;
}
}
25 changes: 21 additions & 4 deletions OpenJPOG/Source/ASoundManager.h
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion Toshi/Source/TKernel/TMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ TBOOL TMemory::Free(TPVOID a_pMem)
TMutexLock lock;
Initialise();
lock.Create(g_pMutex);
if (a_pMem) {
TUINT uiMem = reinterpret_cast<TUINT>(a_pMem);
if ((uiMem & 3) == 0 && a_pMem) {
Initialise();
}
return TBOOL();
Expand Down

0 comments on commit b6bb86a

Please sign in to comment.