aboutsummaryrefslogtreecommitdiffstats
path: root/src/platform
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2024-12-20 22:31:20 +0100
committerDaniil Cherednik <dan.cherednik@gmail.com>2024-12-21 16:30:07 +0100
commit74d6e04c21bddd435bd74c34dbe027b883772a76 (patch)
tree4221df9da5a17897296e5f7f841f01b1f6428c74 /src/platform
parent78649b2f5941e0649db960cafb2997b5ca432be1 (diff)
downloadatracdenc-74d6e04c21bddd435bd74c34dbe027b883772a76.tar.gz
[refactoring] Get rid of TFloat parameter. Use float.HEADmaster
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/win/pcm_io/mf/pcm_io_mf.cpp10
-rw-r--r--src/platform/win/pcm_io/pcm_io.cpp16
-rw-r--r--src/platform/win/pcm_io/pcm_io_impl.h4
-rw-r--r--src/platform/win/pcm_io/win32/pcm_io_win32.cpp4
4 files changed, 17 insertions, 17 deletions
diff --git a/src/platform/win/pcm_io/mf/pcm_io_mf.cpp b/src/platform/win/pcm_io/mf/pcm_io_mf.cpp
index 3f9ff3a..a4e550b 100644
--- a/src/platform/win/pcm_io/mf/pcm_io_mf.cpp
+++ b/src/platform/win/pcm_io/mf/pcm_io_mf.cpp
@@ -69,8 +69,8 @@ static std::wstring Utf8ToMultiByte(const std::string& in) {
}
// TODO: add dither, noise shape?
-static inline int16_t FloatToInt16(TFloat in) {
- return std::min((int)INT16_MAX, std::max((int)INT16_MIN, (int)lrint(in * (TFloat)INT16_MAX)));
+static inline int16_t FloatToInt16(float in) {
+ return std::min((int)INT16_MAX, std::max((int)INT16_MIN, (int)lrint(in * (float)INT16_MAX)));
}
static HRESULT WriteToFile(HANDLE hFile, void* p, DWORD cb) {
@@ -350,7 +350,7 @@ public:
return static_cast<size_t>(totalSamples);
}
- size_t Read(TPCMBuffer<TFloat>& buf, size_t sz) override {
+ size_t Read(TPCMBuffer& buf, size_t sz) override {
HRESULT hr = S_OK;
const size_t sizeBytes = sz * BytesPerSample_;
@@ -447,7 +447,7 @@ public:
return curPos;
}
- size_t Write(const TPCMBuffer<TFloat>& buf, size_t sz) override {
+ size_t Write(const TPCMBuffer& buf, size_t sz) override {
const size_t samples = ChannelsNum_ * sz;
Buf_.resize(samples * 2);
for (size_t i = 0; i < samples; i++) {
@@ -480,4 +480,4 @@ IPCMProviderImpl* CreatePCMIOMFReadImpl(const std::string& path) {
IPCMProviderImpl* CreatePCMIOMFWriteImpl(const std::string& path, int channels, int sampleRate) {
return new TPCMIOMediaFoundationFile(path, channels, sampleRate);
-} \ No newline at end of file
+}
diff --git a/src/platform/win/pcm_io/pcm_io.cpp b/src/platform/win/pcm_io/pcm_io.cpp
index bd266ea..452036d 100644
--- a/src/platform/win/pcm_io/pcm_io.cpp
+++ b/src/platform/win/pcm_io/pcm_io.cpp
@@ -26,28 +26,28 @@
#include <windows.h>
-void ConvertToPcmBufferFromLE(const BYTE* audioData, TPCMBuffer<TFloat>& buf, size_t sz, size_t shift, size_t channelsNum) {
+void ConvertToPcmBufferFromLE(const BYTE* audioData, TPCMBuffer& buf, size_t sz, size_t shift, size_t channelsNum) {
if (channelsNum == 1) {
for (size_t i = 0; i < sz; i++) {
- *(buf[i + shift] + 0) = (*(int16_t*)(audioData + i * 2 + 0)) / (TFloat)32768.0;
+ *(buf[i + shift] + 0) = (*(int16_t*)(audioData + i * 2 + 0)) / (float)32768.0;
}
} else {
for (size_t i = 0; i < sz; i++) {
- *(buf[i + shift] + 0) = (*(int16_t*)(audioData + i * 4 + 0)) / (TFloat)32768.0;
- *(buf[i + shift] + 1) = (*(int16_t*)(audioData + i * 4 + 2)) / (TFloat)32768.0;
+ *(buf[i + shift] + 0) = (*(int16_t*)(audioData + i * 4 + 0)) / (float)32768.0;
+ *(buf[i + shift] + 1) = (*(int16_t*)(audioData + i * 4 + 2)) / (float)32768.0;
}
}
}
-void ConvertToPcmBufferFromBE(const BYTE* audioData, TPCMBuffer<TFloat>& buf, size_t sz, size_t shift, size_t channelsNum) {
+void ConvertToPcmBufferFromBE(const BYTE* audioData, TPCMBuffer& buf, size_t sz, size_t shift, size_t channelsNum) {
if (channelsNum == 1) {
for (size_t i = 0; i < sz; i++) {
- *(buf[i + shift] + 0) = conv_ntoh((*(int16_t*)(audioData + i * 2 + 0))) / (TFloat)32768.0;
+ *(buf[i + shift] + 0) = conv_ntoh((*(int16_t*)(audioData + i * 2 + 0))) / (float)32768.0;
}
} else {
for (size_t i = 0; i < sz; i++) {
- *(buf[i + shift] + 0) = conv_ntoh((*(int16_t*)(audioData + i * 4 + 0))) / (TFloat)32768.0;
- *(buf[i + shift] + 1) = conv_ntoh((*(int16_t*)(audioData + i * 4 + 2))) / (TFloat)32768.0;
+ *(buf[i + shift] + 0) = conv_ntoh((*(int16_t*)(audioData + i * 4 + 0))) / (float)32768.0;
+ *(buf[i + shift] + 1) = conv_ntoh((*(int16_t*)(audioData + i * 4 + 2))) / (float)32768.0;
}
}
}
diff --git a/src/platform/win/pcm_io/pcm_io_impl.h b/src/platform/win/pcm_io/pcm_io_impl.h
index 117ebe0..6c7d840 100644
--- a/src/platform/win/pcm_io/pcm_io_impl.h
+++ b/src/platform/win/pcm_io/pcm_io_impl.h
@@ -22,5 +22,5 @@
#include <windows.h>
-void ConvertToPcmBufferFromLE(const BYTE* audioData, TPCMBuffer<TFloat>& buf, size_t sz, size_t shift, size_t channelsNum);
-void ConvertToPcmBufferFromBE(const BYTE* audioData, TPCMBuffer<TFloat>& buf, size_t sz, size_t shift, size_t channelsNum); \ No newline at end of file
+void ConvertToPcmBufferFromLE(const BYTE* audioData, TPCMBuffer& buf, size_t sz, size_t shift, size_t channelsNum);
+void ConvertToPcmBufferFromBE(const BYTE* audioData, TPCMBuffer& buf, size_t sz, size_t shift, size_t channelsNum);
diff --git a/src/platform/win/pcm_io/win32/pcm_io_win32.cpp b/src/platform/win/pcm_io/win32/pcm_io_win32.cpp
index 7eee5b0..bd1849c 100644
--- a/src/platform/win/pcm_io/win32/pcm_io_win32.cpp
+++ b/src/platform/win/pcm_io/win32/pcm_io_win32.cpp
@@ -82,7 +82,7 @@ public:
}
}
- size_t Read(TPCMBuffer<TFloat>& buf, size_t sz) override {
+ size_t Read(TPCMBuffer& buf, size_t sz) override {
if (Finished_)
return 0;
@@ -108,7 +108,7 @@ public:
return toConvert;
}
- size_t Write(const TPCMBuffer<TFloat>& buf, size_t sz) override {
+ size_t Write(const TPCMBuffer& buf, size_t sz) override {
abort();
return 0;
}