gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit b088b732f2a0318a7e39b03db249924ca9d509d4
parent 51d0c204301c193782fdc82803e1d047ba08b838
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Wed,  1 May 2024 13:47:23 +0200

use tool function to read file data

Diffstat:
Msource/wLib/wRom.cpp | 17++---------------
1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/source/wLib/wRom.cpp b/source/wLib/wRom.cpp @@ -11,26 +11,13 @@ namespace wLib bool ROM::loadFromFile(const std::string& _filename, const uint32_t _expectedSize) { - FILE* hFile = fopen(_filename.c_str(), "rb"); - if(!hFile) + if(!synthLib::readFile(m_buffer, _filename)) return false; - (void)fseek(hFile, 0, SEEK_END); - const auto size = ftell(hFile); - (void)fseek(hFile, 0, SEEK_SET); - - m_buffer.resize(size); - const auto numRead = fread(m_buffer.data(), 1, size, hFile); - (void)fclose(hFile); - - if(numRead != static_cast<size_t>(size)) + if(m_buffer.size() != _expectedSize) { m_buffer.clear(); - return false; - } - if(numRead != _expectedSize) - { loadFromMidi(m_buffer, _filename); if (!m_buffer.empty() && m_buffer.size() < _expectedSize)