- consolidated the different file access interfaces in the backends into one shared version.

This was getting a bit unwieldy. The include path setup is not perfect yet, that's work for later.
(It's about time we're getting C++20 with modules so that this include path madness can be put to an end.)
This commit is contained in:
Christoph Oelckers 2019-09-28 23:17:16 +02:00
commit 7468c0f36d
28 changed files with 504 additions and 634 deletions

View file

@ -32,7 +32,6 @@
#include "timidity.h"
#include "gf1patch.h"
#include "timidity_file.h"
#include "t_swap.h"
#include "common.h"
@ -164,18 +163,18 @@ Instrument *Renderer::load_instrument(const char *name, int percussion,
if (!name || reader == nullptr) return nullptr;
/* Open patch file */
auto fp = reader->open_timidity_file(name);
auto fp = reader->open_file(name);
if (!fp)
{
/* Try with various extensions */
std::string tmp = name;
tmp += ".pat";
fp = reader->open_timidity_file(tmp.c_str());
fp = reader->open_file(tmp.c_str());
if (!fp)
{
#ifndef _WIN32 // Windows isn't case-sensitive.
std::transform(tmp.begin(), tmp.end(), tmp.begin(), [](unsigned char c){ return toupper(c); } );
fp = reader->open_timidity_file(tmp.c_str());
fp = reader->open_file(tmp.c_str());
if (!fp)
#endif
{
@ -680,7 +679,7 @@ void Instruments::free_instruments()
}
}
Instruments::Instruments(SoundFontReaderInterface *reader)
Instruments::Instruments(MusicIO::SoundFontReaderInterface *reader)
{
sfreader = reader;
tonebank[0] = new ToneBank;