From 1c785178b16f36a2eabf41ed23e3e591dc10ddd3 Mon Sep 17 00:00:00 2001 From: Leandro Nini Date: Sun, 29 Sep 2024 17:26:44 +0200 Subject: [PATCH] Allow setting filter range from command line (#47) --- doc/en/sidplayfp.pod | 10 +++++++++- src/args.cpp | 19 +++++++++++++++++-- src/player.cpp | 8 ++++++++ src/player.h | 3 +++ 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/doc/en/sidplayfp.pod b/doc/en/sidplayfp.pod index 2ada63b..e7ba896 100644 --- a/doc/en/sidplayfp.pod +++ b/doc/en/sidplayfp.pod @@ -186,7 +186,15 @@ This is the default. =item B<--fcurve=>I<< |auto >> -Controls the filter curve in the ReSIDfp mulation. +Controls the filter curve in the ReSIDfp emulation. +Ranges from 0.0 (light) to 1.0 (dark), the default +value is 0.5. If set to auto it will choose a +predefined value for 6581 depending on the tune author. + +=item B<--frange=>I<< |auto >> + +If available controls the filter range for the 6581 +in the ReSIDfp emulation. Ranges from 0.0 (light) to 1.0 (dark), the default value is 0.5. If set to auto it will choose a predefined value for 6581 depending on the tune author. diff --git a/src/args.cpp b/src/args.cpp index 8bb5c4f..ad3a2ad 100644 --- a/src/args.cpp +++ b/src/args.cpp @@ -1,7 +1,7 @@ /* * This file is part of sidplayfp, a console SID player. * - * Copyright 2011-2023 Leandro Nini + * Copyright 2011-2024 Leandro Nini * Copyright 2000-2001 Simon White * * This program is free software; you can redistribute it and/or modify @@ -401,6 +401,19 @@ int ConsolePlayer::args(int argc, const char *argv[]) m_fcurve = atof(&argv[i][9]); } } +#ifdef FEAT_FILTER_RANGE + else if (strncmp (&argv[i][1], "-frange=", 8) == 0) + { + if (strncmp (&argv[i][9], "auto", 4) == 0) + { + m_autofilter = true; + } + else + { + m_frange = atof(&argv[i][9]); + } + } +#endif // File format conversions else if (argv[i][1] == 'w') { @@ -676,7 +689,9 @@ void ConsolePlayer::displayArgs (const char *arg) << " -r[i|r][f] set resampling method (default: resample interpolate)" << endl << " Use 'f' to enable fast resampling (only for reSID)" << endl << " --fcurve=|auto Controls the filter curve in the ReSIDfp emulation (0.0 to 1.0, default: 0.5)" << endl - +#ifdef FEAT_FILTER_RANGE + << " --frange=|auto Controls the filter range in the ReSIDfp emulation (0.0 to 1.0, default: 0.5)" << endl +#endif << " -w[name] create wav file (default: [n].wav)" << endl << " --au[name] create au file (default: [n].au)" << endl << " --info add metadata to wav file" << endl; diff --git a/src/player.cpp b/src/player.cpp index 1497630..fc600fa 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -331,6 +331,9 @@ ConsolePlayer::ConsolePlayer (const char * const name) : m_outfile(nullptr), m_filename(""), m_fcurve(-1.0), +#ifdef FEAT_FILTER_RANGE + m_frange(-1.0), +#endif m_quietLevel(0), songlengthDB(sldb_t::NONE), m_cpudebug(false), @@ -622,6 +625,11 @@ bool ConsolePlayer::createSidEmu (SIDEMUS emu, const SidTuneInfo *tuneInfo) cerr << "Recommended filter range: " << frange << endl; } + if (m_frange >= 0.0) + { + frange = m_frange; + } + if ((frange < 0.0) || (frange > 1.0)) { cerr << "Invalid 6581 filter range: " << frange << endl; diff --git a/src/player.h b/src/player.h index ec14c98..a5c6f71 100644 --- a/src/player.h +++ b/src/player.h @@ -154,6 +154,9 @@ class ConsolePlayer SidDatabase m_database; double m_fcurve; +#ifdef FEAT_FILTER_RANGE + double m_frange; +#endif #ifdef FEAT_CW_STRENGTH SidConfig::sid_cw_t m_combinedWaveformsStrength;