Skip to content

Commit

Permalink
Add support for new combined waveforms strength parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
drfiemost committed Jan 14, 2024
1 parent 54a25d4 commit 7d1f317
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
5 changes: 5 additions & 0 deletions doc/en/sidplayfp.ini.pod
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ Controls the filter curve for the 8580 model in the ReSIDfp
emulation. Ranges from 0.0 (light) to 1.0 (dark), the default
value is 0.5.

=item B<CombinedWaveforms>=I<< <AVERAGE|WEAK|STRONG> >>

Controls the combined waveforms strength in the ReSIDfp
emulation. The default value is AVERAGE.

=item B<PowerOnDelay>=I<< <number> >>

The c64 power on delay as number of cpu cycles.
Expand Down
16 changes: 15 additions & 1 deletion src/IniConfig.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 @@ -123,6 +123,7 @@ void IniConfig::clear()
emulation_s.filterRange6581 = 0.5;
#endif
emulation_s.filterCurve8580 = 0.5;
emulation_s.combinedWaveformsStrength = SidConfig::AVERAGE;
emulation_s.powerOnDelay = -1;
emulation_s.samplingMethod = SidConfig::RESAMPLE_INTERPOLATE;
emulation_s.fastSampling = false;
Expand Down Expand Up @@ -434,6 +435,19 @@ void IniConfig::readEmulation(iniHandler &ini)
#endif
readDouble(ini, TEXT("FilterCurve8580"), emulation_s.filterCurve8580);

{
SID_STRING str = readString(ini, TEXT("CombinedWaveforms"));
if (!str.empty())
{
if (str.compare(TEXT("AVERAGE")) == 0)
emulation_s.combinedWaveformsStrength = SidConfig::AVERAGE;
else if (str.compare(TEXT("WEAK")) == 0)
emulation_s.combinedWaveformsStrength = SidConfig::WEAK;
else if (str.compare(TEXT("STRONG")) == 0)
emulation_s.combinedWaveformsStrength = SidConfig::STRONG;
}
}

readInt(ini, TEXT("PowerOnDelay"), emulation_s.powerOnDelay);

{
Expand Down
1 change: 1 addition & 0 deletions src/IniConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class IniConfig
double filterRange6581;
#endif
double filterCurve8580;
SidConfig::sid_cw_t combinedWaveformsStrength;
int powerOnDelay;
SidConfig::sampling_method_t samplingMethod;
bool fastSampling;
Expand Down
3 changes: 3 additions & 0 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ ConsolePlayer::ConsolePlayer (const char * const name) :
m_filter.filterRange6581 = emulation.filterRange6581;
#endif
m_filter.filterCurve8580 = emulation.filterCurve8580;
m_combinedWaveformsStrength = emulation.combinedWaveformsStrength;

if (emulation.powerOnDelay >= 0)
m_engCfg.powerOnDelay = emulation.powerOnDelay;
Expand Down Expand Up @@ -595,6 +596,8 @@ bool ConsolePlayer::createSidEmu (SIDEMUS emu, const SidTuneInfo *tuneInfo)
rs->create ((m_engine.info ()).maxsids());
if (!rs->getStatus()) goto createSidEmu_error;

rs->combinedWaveformsStrength(m_combinedWaveformsStrength);

#ifdef FEAT_FILTER_RANGE
double frange = -1.0;
if (m_autofilter && (tuneInfo->numberOfInfoStrings() == 3))
Expand Down
2 changes: 2 additions & 0 deletions src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ class ConsolePlayer

double m_fcurve;

SidConfig::sid_cw_t m_combinedWaveformsStrength;

uint8_t m_registers[3][32];
uint16_t* m_freqTable;

Expand Down
3 changes: 2 additions & 1 deletion src/sidlib_features.h
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 2024 Leandro Nini
* Copyright 2021-2024 Leandro Nini
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -41,6 +41,7 @@

#if LIBSIDPLAYFP_VERSION_MAJ > 2 || (LIBSIDPLAYFP_VERSION_MAJ == 2 && LIBSIDPLAYFP_VERSION_MIN >= 7)
# define FEAT_FILTER_RANGE
# define FEAT_CW_STRENGTH
#endif

#endif

0 comments on commit 7d1f317

Please sign in to comment.