From 1fe82ad1311d4d6ea3fa5e97d7aaa362ffac6260 Mon Sep 17 00:00:00 2001 From: AdventureT Date: Sun, 10 Dec 2023 08:40:27 +0100 Subject: [PATCH] Added ASoundManager::GetPitch() INCORRECT --- OpenJPOG/Source/ASoundManager.cpp | 16 ++++++++++++++++ OpenJPOG/Source/ASoundManager.h | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 OpenJPOG/Source/ASoundManager.cpp create mode 100644 OpenJPOG/Source/ASoundManager.h diff --git a/OpenJPOG/Source/ASoundManager.cpp b/OpenJPOG/Source/ASoundManager.cpp new file mode 100644 index 0000000..a07e7dc --- /dev/null +++ b/OpenJPOG/Source/ASoundManager.cpp @@ -0,0 +1,16 @@ +#include "ASoundManager.h" + +TOSHI_NAMESPACE_USING + +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 0.0f; +} diff --git a/OpenJPOG/Source/ASoundManager.h b/OpenJPOG/Source/ASoundManager.h new file mode 100644 index 0000000..1c74c17 --- /dev/null +++ b/OpenJPOG/Source/ASoundManager.h @@ -0,0 +1,13 @@ +#pragma once +#include "TKernel/TDebug.h" +#include "fmod.h" + +TOSHI_NAMESPACE_BEGIN + +class ASoundManager +{ +public: + TFLOAT GetPitch(TINT a_iChannel) const; +}; + +TOSHI_NAMESPACE_END \ No newline at end of file