decoder/sidplay: require libsidplayfp (drop support for the original sidplay)
The original sidplay project has been mostly unmaintained for nearly 12 years, and the most recent release was in 2016, while the libsidplayfp project has been actively maintained all the time.
This commit is contained in:
parent
851fcf4823
commit
7e2538e07a
1
NEWS
1
NEWS
@ -19,6 +19,7 @@ ver 0.24 (not yet released)
|
|||||||
- gme: require GME 0.6 or later
|
- gme: require GME 0.6 or later
|
||||||
- hybrid_dsd: remove
|
- hybrid_dsd: remove
|
||||||
- opus: implement bitrate calculation
|
- opus: implement bitrate calculation
|
||||||
|
- sidplay: require libsidplayfp (drop support for the original sidplay)
|
||||||
- wavpack: require libwavpack version 5
|
- wavpack: require libwavpack version 5
|
||||||
* player
|
* player
|
||||||
- add option "mixramp_analyzer" to scan MixRamp tags on-the-fly
|
- add option "mixramp_analyzer" to scan MixRamp tags on-the-fly
|
||||||
|
@ -12,16 +12,13 @@
|
|||||||
#include "lib/fmt/PathFormatter.hxx"
|
#include "lib/fmt/PathFormatter.hxx"
|
||||||
#include "lib/fmt/RuntimeError.hxx"
|
#include "lib/fmt/RuntimeError.hxx"
|
||||||
#include "lib/icu/Converter.hxx"
|
#include "lib/icu/Converter.hxx"
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
#include "io/FileReader.hxx"
|
#include "io/FileReader.hxx"
|
||||||
#endif
|
|
||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
#include "util/AllocatedString.hxx"
|
#include "util/AllocatedString.hxx"
|
||||||
#include "util/CharUtil.hxx"
|
#include "util/CharUtil.hxx"
|
||||||
#include "util/ByteOrder.hxx"
|
#include "util/ByteOrder.hxx"
|
||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
#include <sidplayfp/sidplayfp.h>
|
#include <sidplayfp/sidplayfp.h>
|
||||||
#include <sidplayfp/SidInfo.h>
|
#include <sidplayfp/SidInfo.h>
|
||||||
#include <sidplayfp/SidConfig.h>
|
#include <sidplayfp/SidConfig.h>
|
||||||
@ -30,12 +27,6 @@
|
|||||||
#include <sidplayfp/builders/resid.h>
|
#include <sidplayfp/builders/resid.h>
|
||||||
#include <sidplayfp/builders/residfp.h>
|
#include <sidplayfp/builders/residfp.h>
|
||||||
#include <sidplayfp/SidDatabase.h>
|
#include <sidplayfp/SidDatabase.h>
|
||||||
#else
|
|
||||||
#include <sidplay/sidplay2.h>
|
|
||||||
#include <sidplay/builders/resid.h>
|
|
||||||
#include <sidplay/utils/SidTuneMod.h>
|
|
||||||
#include <sidplay/utils/SidDatabase.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
@ -57,16 +48,13 @@ struct SidplayGlobal {
|
|||||||
|
|
||||||
bool filter_setting;
|
bool filter_setting;
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
std::unique_ptr<uint8_t[]> kernal, basic;
|
std::unique_ptr<uint8_t[]> kernal, basic;
|
||||||
#endif
|
|
||||||
|
|
||||||
explicit SidplayGlobal(const ConfigBlock &block);
|
explicit SidplayGlobal(const ConfigBlock &block);
|
||||||
};
|
};
|
||||||
|
|
||||||
static SidplayGlobal *sidplay_global;
|
static SidplayGlobal *sidplay_global;
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
static constexpr unsigned rom_size = 8192;
|
static constexpr unsigned rom_size = 8192;
|
||||||
|
|
||||||
static void loadRom(const Path rom_path, uint8_t *dump)
|
static void loadRom(const Path rom_path, uint8_t *dump)
|
||||||
@ -75,7 +63,6 @@ static void loadRom(const Path rom_path, uint8_t *dump)
|
|||||||
if (romDump.Read(dump, rom_size) != rom_size)
|
if (romDump.Read(dump, rom_size) != rom_size)
|
||||||
throw FmtRuntimeError("Could not load rom dump '{}'", rom_path);
|
throw FmtRuntimeError("Could not load rom dump '{}'", rom_path);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws on error.
|
* Throws on error.
|
||||||
@ -84,11 +71,7 @@ static std::unique_ptr<SidDatabase>
|
|||||||
sidplay_load_songlength_db(const Path path)
|
sidplay_load_songlength_db(const Path path)
|
||||||
{
|
{
|
||||||
auto db = std::make_unique<SidDatabase>();
|
auto db = std::make_unique<SidDatabase>();
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
bool error = !db->open(path.c_str());
|
bool error = !db->open(path.c_str());
|
||||||
#else
|
|
||||||
bool error = db->open(path.c_str()) < 0;
|
|
||||||
#endif
|
|
||||||
if (error)
|
if (error)
|
||||||
throw FmtRuntimeError("unable to read songlengths file {}: {}",
|
throw FmtRuntimeError("unable to read songlengths file {}: {}",
|
||||||
path, db->error());
|
path, db->error());
|
||||||
@ -113,7 +96,6 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block)
|
|||||||
|
|
||||||
filter_setting = block.GetBlockValue("filter", true);
|
filter_setting = block.GetBlockValue("filter", true);
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
/* read kernal rom dump file */
|
/* read kernal rom dump file */
|
||||||
const auto kernal_path = block.GetPath("kernal");
|
const auto kernal_path = block.GetPath("kernal");
|
||||||
if (!kernal_path.IsNull())
|
if (!kernal_path.IsNull())
|
||||||
@ -129,7 +111,6 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block)
|
|||||||
basic = std::make_unique<uint8_t[]>(rom_size);
|
basic = std::make_unique<uint8_t[]>(rom_size);
|
||||||
loadRom(basic_path, basic.get());
|
loadRom(basic_path, basic.get());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -224,17 +205,9 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
|
|||||||
/* load the tune */
|
/* load the tune */
|
||||||
|
|
||||||
const auto container = ParseContainerPath(path_fs);
|
const auto container = ParseContainerPath(path_fs);
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
SidTune tune(container.path.c_str());
|
SidTune tune(container.path.c_str());
|
||||||
#else
|
|
||||||
SidTuneMod tune(container.path.c_str());
|
|
||||||
#endif
|
|
||||||
if (!tune.getStatus()) {
|
if (!tune.getStatus()) {
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
const char *error = tune.statusString();
|
const char *error = tune.statusString();
|
||||||
#else
|
|
||||||
const char *error = tune.getInfo().statusString;
|
|
||||||
#endif
|
|
||||||
FmtWarning(sidplay_domain, "failed to load file: {}", error);
|
FmtWarning(sidplay_domain, "failed to load file: {}", error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -248,21 +221,12 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
|
|||||||
|
|
||||||
/* initialize the player */
|
/* initialize the player */
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
sidplayfp player;
|
sidplayfp player;
|
||||||
|
|
||||||
player.setRoms(sidplay_global->kernal.get(),
|
player.setRoms(sidplay_global->kernal.get(),
|
||||||
sidplay_global->basic.get(),
|
sidplay_global->basic.get(),
|
||||||
nullptr);
|
nullptr);
|
||||||
#else
|
if (!player.load(&tune)) {
|
||||||
sidplay2 player;
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
bool error = !player.load(&tune);
|
|
||||||
#else
|
|
||||||
bool error = player.load(&tune) < 0;
|
|
||||||
#endif
|
|
||||||
if (error) {
|
|
||||||
FmtWarning(sidplay_domain,
|
FmtWarning(sidplay_domain,
|
||||||
"sidplay2.load() failed: {}", player.error());
|
"sidplay2.load() failed: {}", player.error());
|
||||||
return;
|
return;
|
||||||
@ -270,7 +234,6 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
|
|||||||
|
|
||||||
/* initialize the builder */
|
/* initialize the builder */
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
ReSIDfpBuilder builder("ReSID");
|
ReSIDfpBuilder builder("ReSID");
|
||||||
if (!builder.getStatus()) {
|
if (!builder.getStatus()) {
|
||||||
FmtWarning(sidplay_domain,
|
FmtWarning(sidplay_domain,
|
||||||
@ -286,88 +249,33 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
|
|||||||
builder.error());
|
builder.error());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
ReSIDBuilder builder("ReSID");
|
|
||||||
builder.create(player.info().maxsids);
|
|
||||||
if (!builder) {
|
|
||||||
FmtWarning(sidplay_domain, "ReSIDBuilder.create() failed: {}",
|
|
||||||
builder.error());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
builder.filter(sidplay_global->filter_setting);
|
builder.filter(sidplay_global->filter_setting);
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
if (!builder.getStatus()) {
|
if (!builder.getStatus()) {
|
||||||
FmtWarning(sidplay_domain,
|
FmtWarning(sidplay_domain,
|
||||||
"ReSIDfpBuilder.filter() failed: {}",
|
"ReSIDfpBuilder.filter() failed: {}",
|
||||||
builder.error());
|
builder.error());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (!builder) {
|
|
||||||
FmtWarning(sidplay_domain, "ReSIDBuilder.filter() failed: {}",
|
|
||||||
builder.error());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* configure the player */
|
/* configure the player */
|
||||||
|
|
||||||
auto config = player.config();
|
auto config = player.config();
|
||||||
|
|
||||||
#ifndef HAVE_SIDPLAYFP
|
|
||||||
config.clockDefault = SID2_CLOCK_PAL;
|
|
||||||
config.clockForced = true;
|
|
||||||
config.clockSpeed = SID2_CLOCK_CORRECT;
|
|
||||||
#endif
|
|
||||||
config.frequency = 48000;
|
config.frequency = 48000;
|
||||||
#ifndef HAVE_SIDPLAYFP
|
|
||||||
config.optimisation = SID2_DEFAULT_OPTIMISATION;
|
|
||||||
|
|
||||||
config.precision = 16;
|
|
||||||
config.sidDefault = SID2_MOS6581;
|
|
||||||
#endif
|
|
||||||
config.sidEmulation = &builder;
|
config.sidEmulation = &builder;
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
config.samplingMethod = SidConfig::INTERPOLATE;
|
config.samplingMethod = SidConfig::INTERPOLATE;
|
||||||
config.fastSampling = false;
|
config.fastSampling = false;
|
||||||
#else
|
|
||||||
config.sidModel = SID2_MODEL_CORRECT;
|
|
||||||
config.sidSamples = true;
|
|
||||||
config.sampleFormat = IsLittleEndian()
|
|
||||||
? SID2_LITTLE_SIGNED
|
|
||||||
: SID2_BIG_SIGNED;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
if (tune.getInfo()->sidChips() >= 2) {
|
||||||
const bool stereo = tune.getInfo()->sidChips() >= 2;
|
|
||||||
#else
|
|
||||||
const bool stereo = tune.isStereo();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (stereo) {
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
config.playback = SidConfig::STEREO;
|
config.playback = SidConfig::STEREO;
|
||||||
#else
|
|
||||||
config.playback = sid2_stereo;
|
|
||||||
#endif
|
|
||||||
channels = 2;
|
channels = 2;
|
||||||
} else {
|
} else {
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
config.playback = SidConfig::MONO;
|
config.playback = SidConfig::MONO;
|
||||||
#else
|
|
||||||
config.playback = sid2_mono;
|
|
||||||
#endif
|
|
||||||
channels = 1;
|
channels = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
if (!player.config(config)) {
|
||||||
error = !player.config(config);
|
|
||||||
#else
|
|
||||||
error = player.config(config) < 0;
|
|
||||||
#endif
|
|
||||||
if (error) {
|
|
||||||
FmtWarning(sidplay_domain,
|
FmtWarning(sidplay_domain,
|
||||||
"sidplay2.config() failed: {}", player.error());
|
"sidplay2.config() failed: {}", player.error());
|
||||||
return;
|
return;
|
||||||
@ -382,11 +290,7 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
|
|||||||
|
|
||||||
/* .. and play */
|
/* .. and play */
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
constexpr unsigned timebase = 1;
|
constexpr unsigned timebase = 1;
|
||||||
#else
|
|
||||||
const unsigned timebase = player.timebase();
|
|
||||||
#endif
|
|
||||||
const unsigned end = duration.IsNegative()
|
const unsigned end = duration.IsNegative()
|
||||||
? 0U
|
? 0U
|
||||||
: duration.ToScale<uint64_t>(timebase);
|
: duration.ToScale<uint64_t>(timebase);
|
||||||
@ -399,13 +303,8 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
|
|||||||
if (result <= 0)
|
if (result <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
/* libsidplayfp returns the number of samples */
|
/* libsidplayfp returns the number of samples */
|
||||||
const size_t n_samples = result;
|
const size_t n_samples = result;
|
||||||
#else
|
|
||||||
/* libsidplay2 returns the number of bytes */
|
|
||||||
const size_t n_samples = result / sizeof(buffer[0]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
client.SubmitTimestamp(FloatDuration(player.time()) / timebase);
|
client.SubmitTimestamp(FloatDuration(player.time()) / timebase);
|
||||||
|
|
||||||
@ -463,15 +362,9 @@ Windows1252ToUTF8(const char *s) noexcept
|
|||||||
static AllocatedString
|
static AllocatedString
|
||||||
GetInfoString(const SidTuneInfo &info, unsigned i) noexcept
|
GetInfoString(const SidTuneInfo &info, unsigned i) noexcept
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
const char *s = info.numberOfInfoStrings() > i
|
const char *s = info.numberOfInfoStrings() > i
|
||||||
? info.infoString(i)
|
? info.infoString(i)
|
||||||
: "";
|
: "";
|
||||||
#else
|
|
||||||
const char *s = info.numberOfInfoStrings > i
|
|
||||||
? info.infoString[i]
|
|
||||||
: "";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return Windows1252ToUTF8(s);
|
return Windows1252ToUTF8(s);
|
||||||
}
|
}
|
||||||
@ -542,23 +435,14 @@ sidplay_scan_file(Path path_fs, TagHandler &handler) noexcept
|
|||||||
const auto container = ParseContainerPath(path_fs);
|
const auto container = ParseContainerPath(path_fs);
|
||||||
const unsigned song_num = container.track;
|
const unsigned song_num = container.track;
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
SidTune tune(container.path.c_str());
|
SidTune tune(container.path.c_str());
|
||||||
#else
|
|
||||||
SidTuneMod tune(container.path.c_str());
|
|
||||||
#endif
|
|
||||||
if (!tune.getStatus())
|
if (!tune.getStatus())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
tune.selectSong(song_num);
|
tune.selectSong(song_num);
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
const SidTuneInfo &info = *tune.getInfo();
|
const SidTuneInfo &info = *tune.getInfo();
|
||||||
const unsigned n_tracks = info.songs();
|
const unsigned n_tracks = info.songs();
|
||||||
#else
|
|
||||||
const SidTuneInfo &info = tune.getInfo();
|
|
||||||
const unsigned n_tracks = info.songs;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ScanSidTuneInfo(info, song_num, n_tracks, handler);
|
ScanSidTuneInfo(info, song_num, n_tracks, handler);
|
||||||
|
|
||||||
@ -575,21 +459,12 @@ sidplay_container_scan(Path path_fs)
|
|||||||
{
|
{
|
||||||
std::forward_list<DetachedSong> list;
|
std::forward_list<DetachedSong> list;
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
SidTune tune(path_fs.c_str());
|
SidTune tune(path_fs.c_str());
|
||||||
#else
|
|
||||||
SidTuneMod tune(path_fs.c_str());
|
|
||||||
#endif
|
|
||||||
if (!tune.getStatus())
|
if (!tune.getStatus())
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
#ifdef HAVE_SIDPLAYFP
|
|
||||||
const SidTuneInfo &info = *tune.getInfo();
|
const SidTuneInfo &info = *tune.getInfo();
|
||||||
const unsigned n_tracks = info.songs();
|
const unsigned n_tracks = info.songs();
|
||||||
#else
|
|
||||||
const SidTuneInfo &info = tune.getInfo();
|
|
||||||
const unsigned n_tracks = info.songs;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Don't treat sids containing a single tune
|
/* Don't treat sids containing a single tune
|
||||||
as containers */
|
as containers */
|
||||||
|
@ -156,27 +156,7 @@ if wildmidi_dep.found()
|
|||||||
decoder_plugins_sources += 'WildmidiDecoderPlugin.cxx'
|
decoder_plugins_sources += 'WildmidiDecoderPlugin.cxx'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if not get_option('sidplay').disabled()
|
libsidplay_dep = dependency('libsidplayfp', version: '>= 1.8', required: get_option('sidplay'))
|
||||||
libsidplayfp_dep = dependency('libsidplayfp', version: '>= 1.8', required: false)
|
|
||||||
decoder_features.set('HAVE_SIDPLAYFP', libsidplayfp_dep.found())
|
|
||||||
|
|
||||||
if libsidplayfp_dep.found()
|
|
||||||
libsidplay_dep = libsidplayfp_dep
|
|
||||||
else
|
|
||||||
libsidplay2_dep = dependency('libsidplay2', required: false)
|
|
||||||
if libsidplay2_dep.found()
|
|
||||||
libsidutils_dep = dependency('libsidutils')
|
|
||||||
libresid_builder_dep = compiler.find_library('resid-builder')
|
|
||||||
libsidplay_dep = declare_dependency(dependencies: [libsidplay2_dep, libsidutils_dep, libresid_builder_dep])
|
|
||||||
elif get_option('sidplay').enabled()
|
|
||||||
error('Neither libsidplayfp nor libsidplay2 found')
|
|
||||||
else
|
|
||||||
libsidplay_dep = libsidplay2_dep
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
libsidplay_dep = dependency('', required: false)
|
|
||||||
endif
|
|
||||||
decoder_features.set('ENABLE_SIDPLAY', libsidplay_dep.found())
|
decoder_features.set('ENABLE_SIDPLAY', libsidplay_dep.found())
|
||||||
if libsidplay_dep.found()
|
if libsidplay_dep.found()
|
||||||
decoder_plugins_sources += 'SidplayDecoderPlugin.cxx'
|
decoder_plugins_sources += 'SidplayDecoderPlugin.cxx'
|
||||||
|
Loading…
Reference in New Issue
Block a user