Skip to content

Commit

Permalink
Allow setting filter range from command line (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
drfiemost committed Sep 27, 2024
1 parent bc52993 commit 00bcd6d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
10 changes: 9 additions & 1 deletion doc/en/sidplayfp.pod
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,15 @@ This is the default.

=item B<--fcurve=>I<< <num>|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<< <num>|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.
Expand Down
19 changes: 17 additions & 2 deletions src/args.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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')
{
Expand Down Expand Up @@ -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=<num>|auto Controls the filter curve in the ReSIDfp emulation (0.0 to 1.0, default: 0.5)" << endl

#ifdef FEAT_FILTER_RANGE
<< " --frange=<num>|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: <datafile>[n].wav)" << endl
<< " --au[name] create au file (default: <datafile>[n].au)" << endl
<< " --info add metadata to wav file" << endl;
Expand Down
6 changes: 6 additions & 0 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ ConsolePlayer::ConsolePlayer (const char * const name) :
m_outfile(nullptr),
m_filename(""),
m_fcurve(-1.0),
m_frange(-1.0),
m_quietLevel(0),
songlengthDB(sldb_t::NONE),
m_cpudebug(false),
Expand Down Expand Up @@ -622,6 +623,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;
Expand Down
3 changes: 3 additions & 0 deletions src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 00bcd6d

Please sign in to comment.