Skip to content

Commit c7a70df

Browse files
committed
change 8580 filter curve range
1 parent 098be8e commit c7a70df

File tree

3 files changed

+58
-28
lines changed

3 files changed

+58
-28
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
May 1st, 2025:
2+
- The filter curve value for the 6581 chip still ranges from
3+
-2.0 to 2.0. However, for the 8580 it now ranges from 0.0
4+
to 1.0.
5+
- This is because anything beyond the 0.0-1.0 range breaks
6+
that chip's sound. So it's kinda useless to leave it that
7+
way.
8+
- I've actually wanting to do this for a while, but only now
9+
I figured out how to do so x)
10+
111
April 28, 2025:
212
- C++17 is now the minimum version required for C64play to
313
compile.

doc/c64play.pod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,14 @@ which is the default.
179179
=item B<--curve=>I<< <num> >>
180180

181181
Sets the filter curve on the reSIDfp emulation engine. Ranges
182-
from -2.0 ("light") to 2.0 ("dark"). Defaults to 0.5.
182+
from -2.0 ("light") to 2.0 ("dark") for the 6581 chip and from
183+
0.0 to 1.0 for the 8580 one. Defaults to 0.5 on both.
183184

184185
=item B<--range=>I<< <num> >>
185186

186187
For libsidplayfp v2.7.0 and higher. Controls the filter range
187-
value for the 6581 chip under the reSIDfp emulation.
188+
value for the 6581 chip under the reSIDfp emulation. Same
189+
default as above.
188190

189191
=item B<--no-audio>
190192

src/player.cpp

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -390,43 +390,61 @@ bool ConsolePlayer::createSidEmu(SIDEMUS emu, const SidTuneInfo *tuneInfo) {
390390
rs->combinedWaveformsStrength(m_combinedWaveformsStrength);
391391
#endif
392392

393+
bool is6581 = (
394+
(m_engCfg.defaultSidModel == SidConfig::MOS6581)
395+
&& (m_engCfg.forceSidModel ||
396+
(tuneInfo->sidModel(0) != SidTuneInfo::SIDMODEL_8580))
397+
|| (tuneInfo->sidModel(0) == SidTuneInfo::SIDMODEL_6581)
398+
);
399+
393400
#ifdef FEAT_FILTER_RANGE
394401
// 6581 filter range control
395-
if (m_frange.has_value()) {
396-
m_filter.filterRange6581 = m_frange.value();
397-
}
402+
if (is6581) {
403+
if (m_frange.has_value()) {
404+
m_filter.filterRange6581 = m_frange.value();
405+
}
398406

399-
if ((m_filter.filterRange6581 < 0.0) || (m_filter.filterRange6581 > 1.0)) {
400-
cerr << "Invalid 6581 filter range: " << m_filter.filterRange6581 << endl;
401-
exit(EXIT_FAILURE);
402-
}
407+
if ((m_filter.filterRange6581 < 0.0)
408+
|| (m_filter.filterRange6581 > 1.0)) {
409+
cerr << "Invalid 6581 filter range: "
410+
<< m_filter.filterRange6581 << endl;
403411

404-
rs->filter6581Range(m_filter.filterRange6581);
412+
exit(EXIT_FAILURE);
413+
}
414+
415+
rs->filter6581Range(m_filter.filterRange6581);
405416
#endif
406417

407-
// 6581 filter curve control
408-
if (m_fcurve.has_value()) {
409-
m_filter.filterCurve6581 = m_fcurve.value();
410-
}
418+
// 6581 filter curve control
419+
if (m_fcurve.has_value()) {
420+
m_filter.filterCurve6581 = m_fcurve.value();
421+
}
411422

412-
if ((m_filter.filterCurve6581 < -2.0) || (m_filter.filterCurve6581 > 2.0)) {
413-
cerr << "Invalid 6581 filter curve: " << m_filter.filterCurve6581 << endl;
414-
exit(EXIT_FAILURE);
415-
}
423+
if ((m_filter.filterCurve6581 < -2.0)
424+
|| (m_filter.filterCurve6581 > 2.0)) {
425+
cerr << "Invalid 6581 filter curve: "
426+
<< m_filter.filterCurve6581 << endl;
416427

417-
rs->filter6581Curve(m_filter.filterCurve6581);
428+
exit(EXIT_FAILURE);
429+
}
418430

419-
// 8580 filter curve control
420-
if (m_fcurve.has_value()) {
421-
m_filter.filterCurve8580 = m_fcurve.value();
422-
}
431+
rs->filter6581Curve(m_filter.filterCurve6581);
432+
} else {
433+
// 8580 filter curve control
434+
if (m_fcurve.has_value()) {
435+
m_filter.filterCurve8580 = m_fcurve.value();
436+
}
423437

424-
if ((m_filter.filterCurve8580 < -2.0) || (m_filter.filterCurve8580 > 2.0)) {
425-
cerr << "Invalid 8580 filter curve: " << m_filter.filterCurve8580 << endl;
426-
exit(EXIT_FAILURE);
427-
}
438+
if ((m_filter.filterCurve8580 < 0.0)
439+
|| (m_filter.filterCurve8580 > 1.0)) {
440+
cerr << "Invalid 8580 filter curve: "
441+
<< m_filter.filterCurve8580 << endl;
428442

429-
rs->filter8580Curve(m_filter.filterCurve8580);
443+
exit(EXIT_FAILURE);
444+
}
445+
446+
rs->filter8580Curve(m_filter.filterCurve8580);
447+
}
430448
}
431449

432450
catch (std::bad_alloc const &ba) {}

0 commit comments

Comments
 (0)