Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libresidfp for openSUSE:Factory 
checked in at 2026-11-16 09:07:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libresidfp (Old)
 and      /work/SRC/openSUSE:Factory/.libresidfp.new.1251 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libresidfp"

Mon Nov 16 09:07:45 2026 rev:10 rq:1397472 version:1.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/libresidfp/libresidfp.changes    2026-10-03 
20:15:36.387807880 +0200
+++ /work/SRC/openSUSE:Factory/.libresidfp.new.1251/libresidfp.changes  
2026-11-16 09:13:05.876439192 +0100
@@ -1,0 +2,6 @@
+Fri Nov 13 17:13:02 UTC 2026 - Илья Индиго <[email protected]>
+
+- Updated to 1.3.0
+  * https://github.com/libsidplayfp/libresidfp/releases/tag/v1.3.0
+
+-------------------------------------------------------------------

Old:
----
  libresidfp-1.2.3.tar.gz

New:
----
  libresidfp-1.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libresidfp.spec ++++++
--- /var/tmp/diff_new_pack.UrUnlK/_old  2026-11-16 09:13:06.606469799 +0100
+++ /var/tmp/diff_new_pack.UrUnlK/_new  2026-11-16 09:13:06.608469883 +0100
@@ -17,7 +17,7 @@
 
 %define sover 0
 Name:           libresidfp
-Version:        1.2.3
+Version:        1.3.0
 Release:        0
 Summary:        Cycle exact SID emulation
 License:        GPL-2.0-or-later

++++++ libresidfp-1.2.3.tar.gz -> libresidfp-1.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/Makefile.am 
new/libresidfp-1.3.0/Makefile.am
--- old/libresidfp-1.2.3/Makefile.am    2026-10-02 20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/Makefile.am    2026-11-13 16:13:45.000000000 +0100
@@ -69,7 +69,8 @@
 src/WaveformCalculator.h \
 src/WaveformGenerator.cpp \
 src/WaveformGenerator.h \
-src/resample/Limiter.h \
+src/Limiter.h \
+src/Noise.h \
 src/resample/Resampler.h \
 src/resample/PassThrough.h \
 src/resample/ZeroOrderResampler.h \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/Makefile.in 
new/libresidfp-1.3.0/Makefile.in
--- old/libresidfp-1.2.3/Makefile.in    2026-10-02 20:14:16.000000000 +0200
+++ new/libresidfp-1.3.0/Makefile.in    2026-11-13 16:13:50.000000000 +0100
@@ -572,7 +572,8 @@
 src/WaveformCalculator.h \
 src/WaveformGenerator.cpp \
 src/WaveformGenerator.h \
-src/resample/Limiter.h \
+src/Limiter.h \
+src/Noise.h \
 src/resample/Resampler.h \
 src/resample/PassThrough.h \
 src/resample/ZeroOrderResampler.h \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/NEWS.md new/libresidfp-1.3.0/NEWS.md
--- old/libresidfp-1.2.3/NEWS.md        2026-10-02 20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/NEWS.md        2026-11-13 16:13:45.000000000 +0100
@@ -1,3 +1,10 @@
+1.3.0 2026-11-13
+* Allow choosing 330pF caps on the 6581 for brighter "Galway sounding" filter 
(#50)
+* Replace dithering with high-passed noise with adjustable level (#40)
+* Minor resampler optimizations
+
+
+
 1.2.3 2026-10-02
 * Fixed sanitizer warning (#47)
 * Adjusted 6581 combined waveforms (#54) (#55)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/README.md 
new/libresidfp-1.3.0/README.md
--- old/libresidfp-1.2.3/README.md      2026-10-02 20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/README.md      2026-11-13 16:13:45.000000000 +0100
@@ -80,7 +80,7 @@
 compile for debugging with inlining disabled, asserts and warnings
 (disabled by default)
 
-* `--enable-branch-hints`:
+* `--disable-branch-hints`:
 disable branch hints optimizations
 (enabled by default)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/configure 
new/libresidfp-1.3.0/configure
--- old/libresidfp-1.2.3/configure      2026-10-02 20:14:15.000000000 +0200
+++ new/libresidfp-1.3.0/configure      2026-11-13 16:13:49.000000000 +0100
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for libresidfp 1.2.3.
+# Generated by GNU Autoconf 2.71 for libresidfp 1.3.0.
 #
 #
 # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
@@ -618,8 +618,8 @@
 # Identity of this package.
 PACKAGE_NAME='libresidfp'
 PACKAGE_TARNAME='libresidfp'
-PACKAGE_VERSION='1.2.3'
-PACKAGE_STRING='libresidfp 1.2.3'
+PACKAGE_VERSION='1.3.0'
+PACKAGE_STRING='libresidfp 1.3.0'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL='https://github.com/libsidplayfp/libresidfp/'
 
@@ -1397,7 +1397,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libresidfp 1.2.3 to adapt to many kinds of systems.
+\`configure' configures libresidfp 1.3.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1468,7 +1468,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libresidfp 1.2.3:";;
+     short | recursive ) echo "Configuration of libresidfp 1.3.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1591,7 +1591,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libresidfp configure 1.2.3
+libresidfp configure 1.3.0
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2260,7 +2260,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libresidfp $as_me 1.2.3, which was
+It was created by libresidfp $as_me 1.3.0, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3748,7 +3748,7 @@
 
 # Define the identity of the package.
  PACKAGE='libresidfp'
- VERSION='1.2.3'
+ VERSION='1.3.0'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -3895,8 +3895,8 @@
 
 
 LIB_MAJOR=1
-LIB_MINOR=2
-LIB_LEVEL=3
+LIB_MINOR=3
+LIB_LEVEL=0
 
 
 
@@ -22398,9 +22398,9 @@
 #
 # If any interfaces have been removed or changed since the last public 
release, then set age to 0.
 
-LIBRESIDFPCUR=2
-LIBRESIDFPREV=3
-LIBRESIDFPAGE=2
+LIBRESIDFPCUR=3
+LIBRESIDFPREV=0
+LIBRESIDFPAGE=3
 LIBRESIDFPVERSION=$LIBRESIDFPCUR:$LIBRESIDFPREV:$LIBRESIDFPAGE
 
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for debugging" >&5
@@ -23831,7 +23831,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libresidfp $as_me 1.2.3, which was
+This file was extended by libresidfp $as_me 1.3.0, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -23891,7 +23891,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-libresidfp config.status 1.2.3
+libresidfp config.status 1.3.0
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/configure.ac 
new/libresidfp-1.3.0/configure.ac
--- old/libresidfp-1.2.3/configure.ac   2026-10-02 20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/configure.ac   2026-11-13 16:13:45.000000000 +0100
@@ -1,6 +1,6 @@
 m4_define([lib_major], [1])
-m4_define([lib_minor], [2])
-m4_define([lib_level], [3])
+m4_define([lib_minor], [3])
+m4_define([lib_level], [0])
 m4_define([lib_version], [lib_major.lib_minor.lib_level])
 
 AC_PREREQ([2.62])
@@ -93,9 +93,9 @@
 #
 # If any interfaces have been removed or changed since the last public 
release, then set age to 0.
 
-LIBRESIDFPCUR=2
-LIBRESIDFPREV=3
-LIBRESIDFPAGE=2
+LIBRESIDFPCUR=3
+LIBRESIDFPREV=0
+LIBRESIDFPAGE=3
 LIBRESIDFPVERSION=$LIBRESIDFPCUR:$LIBRESIDFPREV:$LIBRESIDFPAGE
 
 AC_MSG_CHECKING([for debugging])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/ExternalFilter.cpp 
new/libresidfp-1.3.0/src/ExternalFilter.cpp
--- old/libresidfp-1.2.3/src/ExternalFilter.cpp 2026-10-02 20:14:11.000000000 
+0200
+++ new/libresidfp-1.3.0/src/ExternalFilter.cpp 2026-11-13 16:13:45.000000000 
+0100
@@ -51,6 +51,7 @@
 
 void ExternalFilter::setExtResistance(double res)
 {
+    // TODO should be logarithmic
     m_ext_res = 1e3 + ((1. - res) * 9e3);
     recalcParams();
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/Filter6581.h 
new/libresidfp-1.3.0/src/Filter6581.h
--- old/libresidfp-1.2.3/src/Filter6581.h       2026-10-02 20:14:11.000000000 
+0200
+++ new/libresidfp-1.3.0/src/Filter6581.h       2026-11-13 16:13:45.000000000 
+0100
@@ -377,13 +377,13 @@
     }
 
     /**
-     * Enable/disable old caps for 6581 model.
+     * Set caps type for 6581 model.
      *
-     * @param enable true to enable old 2200pF caps, false to use new 470pF 
caps.
+     * @param type
      */
-    static void enableOldCaps(bool enable)
+    static void setCaps(CapsType type)
     {
-        FilterModelConfig6581::getInstance()->enableOldCaps(enable);
+        FilterModelConfig6581::getInstance()->setCaps(type);
     }
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/FilterModelConfig.h 
new/libresidfp-1.3.0/src/FilterModelConfig.h
--- old/libresidfp-1.2.3/src/FilterModelConfig.h        2026-10-02 
20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/FilterModelConfig.h        2026-11-13 
16:13:45.000000000 +0100
@@ -54,45 +54,11 @@
     };
 
 protected:
-    static inline uint16_t to_uint16_dither(double x, double d_noise)
-    {
-        const int tmp = static_cast<int>(x + d_noise);
-        assert((tmp >= 0) && (tmp <= USHRT_MAX));
-        return static_cast<uint16_t>(tmp);
-    }
-
     static inline uint16_t to_uint16(double x)
     {
-        return to_uint16_dither(x, 0.5);
+        return static_cast<uint16_t>(x);
     }
 
-private:
-    /*
-     * Hack to add quick dither when converting values from float to int
-     * and avoid quantization noise.
-     * Hopefully this can be removed the day we move all the analog part
-     * processing to floats.
-     *
-     * Not sure about the effect of using such small buffer of numbers
-     * since the random sequence repeats every 1024 values but for
-     * now it seems to do the job.
-     */
-    class Randomnoise
-    {
-    private:
-        double buffer[1024];
-        mutable int index = 0;
-    public:
-        Randomnoise()
-        {
-            std::uniform_real_distribution<double> unif(0., 1.);
-            std::default_random_engine re;
-            for (int i=0; i<1024; i++)
-                buffer[i] = unif(re);
-        }
-        double getNoise() const { index = (index + 1) & 0x3ff; return 
buffer[index]; }
-    };
-
 protected:
     /// Capacitor value.
     const double C;
@@ -135,9 +101,6 @@
     uint16_t opamp_rev[1 << 16]; //-V730_NOINIT this is initialized in the 
derived class constructor
 
 private:
-    Randomnoise rnd;
-
-private:
     FilterModelConfig(const FilterModelConfig&) = delete;
     FilterModelConfig& operator= (const FilterModelConfig&) = delete;
 
@@ -296,7 +259,7 @@
 
     inline uint16_t getNormalizedValue(double value) const
     {
-        return to_uint16_dither(N16 * (value - vmin), rnd.getNoise());
+        return to_uint16(N16 * (value - vmin));
     }
 
     template<int N>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/FilterModelConfig6581.cpp 
new/libresidfp-1.3.0/src/FilterModelConfig6581.cpp
--- old/libresidfp-1.2.3/src/FilterModelConfig6581.cpp  2026-10-02 
20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/FilterModelConfig6581.cpp  2026-11-13 
16:13:45.000000000 +0100
@@ -83,8 +83,9 @@
   { 10.31,  0.81 },  // Approximate end of actual range
 };
 
-constexpr double CAPS_OLD = 2200e-12; // ASSY 326298 uses 2200pF caps
-constexpr double CAPS_NEW =  470e-12; // Standard 470pF caps used on other ASSY
+constexpr double CAPS_OLD    = 2200e-12; // ASSY 326298 uses 2200pF caps
+constexpr double CAPS_NEW    =  470e-12; // Standard 470pF caps used on other 
ASSY
+constexpr double CAPS_GALWAY =  330e-12; // Non-standard 330pF caps
 
 std::unique_ptr<FilterModelConfig6581> 
FilterModelConfig6581::instance(nullptr);
 
@@ -117,12 +118,12 @@
     updateParams();
 }
 
-void FilterModelConfig6581::enableOldCaps(bool enable)
+void FilterModelConfig6581::setCaps(CapsType type)
 {
-    if (m_oldCaps == enable)
+    if (m_capsType == type)
         return;
 
-    m_oldCaps = enable;
+    m_capsType = type;
     updateParams();
 }
 
@@ -131,11 +132,23 @@
     calcCurrFactorCoeff();
     vcr_mult = uCox;
 
-    if (m_oldCaps)
+    switch (m_capsType)
     {
+    case CAPS2200: {
         constexpr double caps_mult = CAPS_NEW/CAPS_OLD;
         currFactorCoeff *= caps_mult;
         vcr_mult *= caps_mult;
+        break;
+    }
+    case CAPS470:
+        // keep parameters unchanged
+        break;
+    case CAPS330: {
+        constexpr double caps_mult = CAPS_NEW/CAPS_GALWAY;
+        currFactorCoeff *= caps_mult;
+        vcr_mult *= caps_mult;
+        break;
+    }
     }
 }
 
@@ -154,7 +167,7 @@
     dac_zero(7.15),
     dac_scale(2.63),
     dac(DAC_BITS),
-    m_oldCaps(false)
+    m_capsType(CAPS470)
 {
     updateParams();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/FilterModelConfig6581.h 
new/libresidfp-1.3.0/src/FilterModelConfig6581.h
--- old/libresidfp-1.2.3/src/FilterModelConfig6581.h    2026-10-02 
20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/FilterModelConfig6581.h    2026-11-13 
16:13:45.000000000 +0100
@@ -84,7 +84,7 @@
     //@}
 
     double vcr_mult;
-    bool m_oldCaps;
+    CapsType m_capsType;
 
     // Voice DC offset LUT
     double voiceDC[256];
@@ -112,7 +112,7 @@
 
     void setFilterRange(double adjustment);
 
-    void enableOldCaps(bool enable);
+    void setCaps(CapsType type);
 
     /**
      * Construct an 11 bit cutoff frequency DAC output voltage table.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/Limiter.h 
new/libresidfp-1.3.0/src/Limiter.h
--- old/libresidfp-1.2.3/src/Limiter.h  1970-01-01 01:00:00.000000000 +0100
+++ new/libresidfp-1.3.0/src/Limiter.h  2026-11-13 16:13:45.000000000 +0100
@@ -0,0 +1,76 @@
+/*
+ * This file is part of libsidplayfp, a SID player engine.
+ *
+ * Copyright 2026 Leandro Nini <[email protected]>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
+ */
+
+#ifndef LIMITER_H
+#define LIMITER_H
+
+#include <cmath>
+#include <cassert>
+#include <cstdint>
+
+#include "siddefs-fp.h"
+
+namespace reSIDfp
+{
+
+namespace Limiter
+{
+
+namespace
+{
+    constexpr int32_t threshold = 28000;
+
+    template<int m>
+    inline int32_t clipper(int32_t x)
+    {
+        static_assert(m > 0, "Clipper range must be a positive value");
+        assert(x >= 0);
+        if (likely(x < threshold))
+            return x;
+
+        constexpr double max_val = static_cast<double>(m);
+        constexpr double max_val_inv = 1. / static_cast<double>(m);
+        constexpr double t = threshold / max_val;
+        constexpr double a = 1. - t;
+        constexpr double b = 1. / a;
+
+        double value = static_cast<double>(x - threshold) * max_val_inv;
+        value = a * std::tanh(b * value);
+        return static_cast<int32_t>(threshold + (value * max_val));
+    }
+
+    /*
+     * Soft Clipping implementation, splitted for test.
+     */
+    inline int32_t softClipImpl(int32_t x)
+    {
+        return x < 0 ? -clipper<32768>(-x) : clipper<32767>(x);
+    }
+} // anon namespace
+
+    /*
+     * Soft Clipping into 16 bit range [-32768,32767]
+     */
+    inline int16_t softClip(int32_t x) { return 
static_cast<int16_t>(softClipImpl(x)); }
+} // namespace Limiter
+
+} // namespace reSIDfp
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/Noise.h 
new/libresidfp-1.3.0/src/Noise.h
--- old/libresidfp-1.2.3/src/Noise.h    1970-01-01 01:00:00.000000000 +0100
+++ new/libresidfp-1.3.0/src/Noise.h    2026-11-13 16:13:45.000000000 +0100
@@ -0,0 +1,66 @@
+/*
+ * This file is part of libsidplayfp, a SID player engine.
+ *
+ * Copyright 2026 Leandro Nini <[email protected]>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
+ */
+
+#ifndef NOISE_H
+#define NOISE_H
+
+namespace reSIDfp
+{
+
+class Noise
+{
+private:
+    mutable uint32_t m_wnoise = 34653463u;
+    mutable int32_t m_hpnoise = 0;
+
+    uint32_t m_mask;
+    int32_t m_middle;
+
+    static constexpr int defLevel = 5;
+public:
+    Noise()
+    {
+        setLevel(defLevel);
+    }
+
+    void setLevel(int level)
+    {
+        m_mask = (1u << level) - 1;
+        m_middle = 1 << (level - 1);
+    }
+
+    inline int32_t output() const
+    {
+        // white noise
+        m_wnoise = m_wnoise * 1664525u + 1013904223u;
+
+        // Reduce to 8bit signed
+        int32_t n = (int32_t)((m_wnoise >> 20) & m_mask) - m_middle;
+
+        // high-passed noise
+        m_hpnoise = m_hpnoise + ((n - m_hpnoise) / 8);
+
+        return n - m_hpnoise;
+    }
+};
+
+} // namespace reSIDfp
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/SID.cpp 
new/libresidfp-1.3.0/src/SID.cpp
--- old/libresidfp-1.2.3/src/SID.cpp    2026-10-02 20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/SID.cpp    2026-11-13 16:13:45.000000000 +0100
@@ -138,13 +138,14 @@
 constexpr int BUS_TTL_8580 = 0xa2000;
 //@}
 
-// Clamp parameter in [0,1] range
-double clamp(double param)
+// Clamp parameter in defined range
+template<typename T, int min, int max>
+T clamp(T param)
 {
 #ifdef HAVE_CXX17
-     return std::clamp(param, 0.0, 1.0);
+     return std::clamp(param, (T)min, (T)max);
 #else
-     return std::max(std::min(param, 1.0), 0.0);
+     return std::max(std::min(param, (T)max), (T)min);
 #endif
 }
 
@@ -174,19 +175,19 @@
 
 void SID::setFilter6581Curve(double filterCurve)
 {
-    p->filterCurve6581 = clamp(filterCurve);
+    p->filterCurve6581 = clamp<double, 0, 1>(filterCurve);
     filter6581->setFilterCurve(filterCurve);
 }
 
 void SID::setFilter6581Range(double adjustment)
 {
-    p->filterRange6581 = clamp(adjustment);
+    p->filterRange6581 = clamp<double, 0, 1>(adjustment);
     filter6581->setFilterRange(adjustment);
 }
 
 void SID::setFilter8580Curve(double filterCurve)
 {
-    p->filterCurve8580 = clamp(filterCurve);
+    p->filterCurve8580 = clamp<double, 0, 1>(filterCurve);
     filter8580->setFilterCurve(filterCurve);
 }
 
@@ -196,12 +197,6 @@
     filter8580->enable(enable);
 }
 
-void SID::enableOld6581caps(bool enable)
-{
-    p->old6581caps = enable;
-    filter6581->enableOldCaps(enable);
-}
-
 void SID::voiceSync(bool sync)
 {
     if (sync)
@@ -627,20 +622,37 @@
 
 void SID::setDacLeakage(double level)
 {
-    dacLeakage = clamp(level);
+    dacLeakage = clamp<double, 0, 1>(level);
     setChipModel(model);
 }
 
 void SID::setOffset6581(double offset)
 {
     // TODO determine a reasonable range
-    offset_6581 = 0x380 + static_cast<unsigned int>((1. - clamp(offset)) * 
0x200);
+    offset_6581 = 0x380 + static_cast<unsigned int>((1. - clamp<double, 0, 
1>(offset)) * 0x200);
     setChipModel(model);
 }
 
 void SID::setDCBRes(double res)
 {
-    externalFilter.setExtResistance(clamp(res));
+    externalFilter.setExtResistance(clamp<double, 0, 1>(res));
+}
+
+void SID::set6581caps(CapsType type)
+{
+    p->caps6581 = type;
+    filter6581->setCaps(type);
+}
+
+void SID::enableStrongPS(bool enable)
+{
+    for (int i = 0; i < 3; i++)
+        voice[i].wave()->setStrongPS(enable);
+}
+
+void SID::setNoiseLevel(int level)
+{
+    m_noise.setLevel(clamp<int, 0, 8>(level));
 }
 
 } // namespace reSIDfp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/SID.h 
new/libresidfp-1.3.0/src/SID.h
--- old/libresidfp-1.2.3/src/SID.h      2026-10-02 20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/SID.h      2026-11-13 16:13:45.000000000 +0100
@@ -33,6 +33,9 @@
 #include "ExternalFilter.h"
 #include "Filter.h"
 #include "Voice.h"
+#include "Limiter.h"
+#include "Noise.h"
+
 #include "State.h"
 
 namespace reSIDfp
@@ -86,6 +89,8 @@
     /// SID voices
     Voice voice[3];
 
+    Noise m_noise;
+
     /// Used to amplify the output by x/2 to get an adequate playback volume
     int scaleFactor;
 
@@ -175,6 +180,13 @@
         return externalFilter.clock(exFiltInput);
     }
 
+    /// scale and limit output
+    inline int16_t getOutput()
+    {
+        const int32_t out = (scaleFactor * resampler->output()) / 2;
+        return Limiter::softClip(out + m_noise.output());
+    }
+
 private:
     SID(const SID&) = delete;
     SID& operator=(const SID&) = delete;
@@ -355,11 +367,6 @@
     void enableFilter(bool enable);
 
     /**
-     * Enable/disable old caps (2200pF) for 6581 model.
-     */
-    void enableOld6581caps(bool enable);
-
-    /**
      * Set paddle coordinates.
      */
     void setPaddle(uint8_t x, uint8_t y);
@@ -378,6 +385,21 @@
      * Set the DC-Blocker resistance.
      */
     void setDCBRes(double res);
+
+    /**
+     * Set caps for 6581 model.
+     */
+    void set6581caps(CapsType type);
+
+    /**
+     * Set strong P+S for 6581 model.
+     */
+    void enableStrongPS(bool enable);
+
+    /*
+     * Set the background noise level.
+     */
+    void setNoiseLevel(int level);
 };
 
 } // namespace reSIDfp
@@ -428,7 +450,7 @@
                 int32_t output = clockFilt();
                 if (unlikely(resampler->input(output)))
                 {
-                    buf[s++] = resampler->getOutput(scaleFactor);
+                    buf[s++] = getOutput();
                 }
             }
 
@@ -469,7 +491,7 @@
                 int32_t output = clockFilt();
                 if (unlikely(resampler->input(output)))
                 {
-                    buf[s++] = resampler->getOutput(scaleFactor);
+                    buf[s++] = getOutput();
                     if (unlikely(s == bufSize))
                     {
                         break;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/State.cpp 
new/libresidfp-1.3.0/src/State.cpp
--- old/libresidfp-1.2.3/src/State.cpp  2026-10-02 20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/State.cpp  2026-11-13 16:13:45.000000000 +0100
@@ -61,6 +61,8 @@
         state.sync[i] = wave->sync;
         state.test_or_reset[i] = wave->test_or_reset;
         state.msb_rising[i] = wave->msb_rising;
+        state.strongPS[i] = wave->strongPS;
+        state.msb_pulldown[i] = wave->msb_pulldown;
 
         EnvelopeGenerator* const envelope = s.voice[i].envelope();
         state.lfsr[i] = envelope->lfsr;
@@ -117,7 +119,7 @@
     state.filterCurve6581 = s.p->filterCurve6581;
     state.filterRange6581 = s.p->filterRange6581;
     state.filterCurve8580 = s.p->filterCurve8580;
-    state.old6581caps = s.p->old6581caps;
+    state.caps6581 = s.p->caps6581;
 
     state.vx[0][0] = s.filter6581->hpIntegrator.vx;
     state.vx[0][1] = s.filter6581->bpIntegrator.vx;
@@ -234,7 +236,7 @@
     s.setFilter6581Curve(state.filterCurve6581);
     s.setFilter6581Range(state.filterRange6581);
     s.setFilter8580Curve(state.filterCurve8580);
-    s.enableOld6581caps(state.old6581caps);
+    s.set6581caps(state.caps6581);
 
     s.filter6581->hpIntegrator.vx = state.vx[0][0];
     s.filter6581->bpIntegrator.vx = state.vx[0][1];
@@ -283,6 +285,8 @@
         wave->sync = state.sync[i];
         wave->test_or_reset = state.test_or_reset[i];
         wave->msb_rising = state.msb_rising[i];
+        wave->strongPS = state.strongPS[i];
+        wave->msb_pulldown = state.msb_pulldown[i];
 
         wave->setWave();
         wave->setPulldown();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/State.h 
new/libresidfp-1.3.0/src/State.h
--- old/libresidfp-1.2.3/src/State.h    2026-10-02 20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/State.h    2026-11-13 16:13:45.000000000 +0100
@@ -39,11 +39,12 @@
     double filterCurve6581;
     double filterRange6581;
     double filterCurve8580;
-    bool   old6581caps;
+    CapsType caps6581;
 };
 
-struct State
+class State
 {
+public:
     /**
      * Save current state.
      */
@@ -59,6 +60,7 @@
      */
     static int size(SID &s);
 
+private:
     // SID
     int bus_value_ttl;
     unsigned int nextVoiceSync;
@@ -92,6 +94,8 @@
     bool sync[3];
     bool test_or_reset[3];
     bool msb_rising[3];
+    bool strongPS[3];
+    bool msb_pulldown[3];
     uint8_t waveform[3];
 
     // Envelope
@@ -136,7 +140,7 @@
     double filterCurve6581;
     double filterRange6581;
     double filterCurve8580;
-    bool   old6581caps;
+    CapsType caps6581;
 
     // Integrators
     int32_t vx[2][2];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/WaveformGenerator.cpp 
new/libresidfp-1.3.0/src/WaveformGenerator.cpp
--- old/libresidfp-1.2.3/src/WaveformGenerator.cpp      2026-10-02 
20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/WaveformGenerator.cpp      2026-11-13 
16:13:45.000000000 +0100
@@ -382,6 +382,12 @@
             // Reset fading time for floating DAC input.
             floating_output_ttl = is6581 ? FLOATING_OUTPUT_TTL_6581R3 : 
FLOATING_OUTPUT_TTL_8580R5;
         }
+
+        // topbit pulldown happens only on 6581 when saw is selected
+        // but not if saw is combined with pulse and strongPS is selected
+        msb_pulldown = is6581
+            && (waveform & 2)
+            && !(strongPS && (waveform == 6));
     }
 
     if (test != test_prev)
@@ -442,6 +448,9 @@
     test = false;
     sync = false;
 
+    strongPS = false;
+    msb_pulldown = false;
+
     wave = model_wave ? (*model_wave)[0] : nullptr;
     pulldown = nullptr;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/WaveformGenerator.h 
new/libresidfp-1.3.0/src/WaveformGenerator.h
--- old/libresidfp-1.2.3/src/WaveformGenerator.h        2026-10-02 
20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/WaveformGenerator.h        2026-11-13 
16:13:45.000000000 +0100
@@ -154,6 +154,9 @@
 
     bool is6581; //-V730_NOINIT this is initialized in the SID constructor
 
+    bool strongPS = false;
+    bool msb_pulldown = false;
+
     /// The other two waveform generators, for syncing and ring-mod.
     //@{
     const WaveformGenerator* prevVoice;
@@ -205,6 +208,8 @@
     void setWaveformModels(rc_matrix_t models);
     void setPulldownModels(rc_matrix_t models);
 
+    inline void setStrongPS(bool sps) { strongPS = sps; }
+
     void setOtherWaveforms(const WaveformGenerator* prev, WaveformGenerator* 
next)
     {
         prevVoice = prev;
@@ -407,9 +412,9 @@
 
         // In the 6581 the top bit of the accumulator may be driven low by 
combined waveforms
         // when the sawtooth is selected
-        if (is6581 && (waveform & 0x2) && ((waveform_output & 0x800) == 0))
+        // On some chips it doesn't happen with P+S
+        if (msb_pulldown && ((waveform_output & 0x800) == 0))
         {
-            // On some chips it doesn't happen with P+S
             msb_rising = false;
             accumulator &= 0x7fffff;
         }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/resample/Limiter.h 
new/libresidfp-1.3.0/src/resample/Limiter.h
--- old/libresidfp-1.2.3/src/resample/Limiter.h 2026-10-02 20:14:11.000000000 
+0200
+++ new/libresidfp-1.3.0/src/resample/Limiter.h 1970-01-01 01:00:00.000000000 
+0100
@@ -1,69 +0,0 @@
-/*
- * This file is part of libsidplayfp, a SID player engine.
- *
- * Copyright 2026 Leandro Nini <[email protected]>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
- */
-
-#ifndef LIMITER_H
-#define LIMITER_H
-
-#include <cmath>
-#include <cassert>
-#include <cstdint>
-
-#include "siddefs-fp.h"
-
-class Limiter
-{
-private:
-    static constexpr int32_t threshold = 28000;
-
-    template<int m>
-    static inline int32_t clipper(int32_t x)
-    {
-        static_assert(m > 0, "Clipper range must be a positive value");
-        assert(x >= 0);
-        if (likely(x < threshold))
-            return x;
-
-        constexpr double max_val = static_cast<double>(m);
-        constexpr double t = threshold / max_val;
-        constexpr double a = 1. - t;
-        constexpr double b = 1. / a;
-
-        double value = static_cast<double>(x - threshold) / max_val;
-        value = a * std::tanh(b * value);
-        return static_cast<int32_t>(threshold + (value * max_val));
-    }
-
-    /*
-     * Soft Clipping implementation, splitted for test.
-     */
-    static inline int32_t softClipImpl(int32_t x)
-    {
-        return x < 0 ? -clipper<32768>(-x) : clipper<32767>(x);
-    }
-
-public:
-    /*
-     * Soft Clipping into 16 bit range [-32768,32767]
-     */
-    static inline int16_t softClip(int32_t x) { return 
static_cast<int16_t>(softClipImpl(x)); }
-
-};
-
-#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/resample/Resampler.h 
new/libresidfp-1.3.0/src/resample/Resampler.h
--- old/libresidfp-1.2.3/src/resample/Resampler.h       2026-10-02 
20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/resample/Resampler.h       2026-11-13 
16:13:45.000000000 +0100
@@ -22,8 +22,6 @@
 #ifndef RESAMPLER_H
 #define RESAMPLER_H
 
-#include "Limiter.h"
-
 #include <cstdint>
 
 namespace reSIDfp
@@ -36,8 +34,6 @@
 class Resampler
 {
 protected:
-    virtual int32_t output() const = 0;
-
     Resampler() = default;
 
 public:
@@ -56,11 +52,7 @@
      *
      * @return resampled sample
      */
-    inline int16_t getOutput(int32_t scaleFactor) const
-    {
-        const int32_t out = (scaleFactor * output()) / 2;
-        return Limiter::softClip(out);
-    }
+    virtual int32_t output() const = 0;
 
     virtual void reset() = 0;
 };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/residfp/residfp.cpp 
new/libresidfp-1.3.0/src/residfp/residfp.cpp
--- old/libresidfp-1.2.3/src/residfp/residfp.cpp        2026-10-02 
20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/residfp/residfp.cpp        2026-11-13 
16:13:45.000000000 +0100
@@ -152,7 +152,7 @@
 
 void residfp::enableOld6581caps(bool enable)
 {
-    sid.enableOld6581caps(enable);
+    sid.set6581caps(enable ? CAPS2200 : CAPS470);
 }
 
 void residfp::setOffset6581(double offset)
@@ -189,3 +189,18 @@
 {
     sid.setDCBRes(res);
 }
+
+void residfp::set6581caps(CapsType type)
+{
+    sid.set6581caps(type);
+}
+
+void residfp::enableStrongPS(bool enable)
+{
+    sid.enableStrongPS(enable);
+}
+
+void residfp::noiseLevel(int level)
+{
+    sid.setNoiseLevel(level);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/residfp/residfp.h 
new/libresidfp-1.3.0/src/residfp/residfp.h
--- old/libresidfp-1.2.3/src/residfp/residfp.h  2026-10-02 20:14:11.000000000 
+0200
+++ new/libresidfp-1.3.0/src/residfp/residfp.h  2026-11-13 16:13:45.000000000 
+0100
@@ -229,7 +229,7 @@
     /**
      * Enable filter emulation.
      *
-     * @param enable false to turn off filter emulation
+     * @param enable false to turn off filter emulation (default enabled)
      */
     void enableFilter(bool enable);
 
@@ -239,8 +239,10 @@
      *
      * @param enable true to enable old 2200pF caps used on ASSY 326298
      *               false to use the standard 470pF caps. (default off)
+     * @deprecated since 1.3
+     * @see #set6581caps(CapsType)
      */
-    void enableOld6581caps(bool enable);
+    RESIDFP_DEPRECATED void enableOld6581caps(bool enable);
 
     /**
      * Set paddle coordinates.
@@ -310,6 +312,42 @@
      * @since 1.2
      */
     void setDCBRes(double res);
+
+    /**
+     * Set caps for 6581 model.
+     * Affects the filter cutoff frequency.
+     * Choose between:
+     * - 2200pF: low cutoff, found on old ASSY 326298
+     * -  470pF: normal cutoff, found on most of the boards
+     * -  330pF: high cutoff, found on some boards and likely on Galway's C128D
+     *
+     * @param type caps type @see #reSIDfp::CapsType
+     *
+     * @since 1.3
+     */
+    void set6581caps(CapsType type);
+
+    /**
+     * Set strong P+S for 6581 model.
+     * If enabled when Pulse and Saw are combined the
+     * topbit is not pulled down, providing a stronger
+     * sound.
+     *
+     * @param enable true to turn on strong PS (default disabled)
+     *
+     * @since 1.3
+     */
+    void enableStrongPS(bool enable);
+
+    /**
+     * Set background noise level.
+     * @note: if noise is disabled there will be audible quantization noise.
+     *
+     * @param level the noise level, between 0 (no noise) and 8 (max level) 
(default 5)
+     *
+     * @since 1.3
+     */
+    void noiseLevel(int level);
 };
 
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/src/residfp/residfp_defs.h 
new/libresidfp-1.3.0/src/residfp/residfp_defs.h
--- old/libresidfp-1.2.3/src/residfp/residfp_defs.h     2026-10-02 
20:14:11.000000000 +0200
+++ new/libresidfp-1.3.0/src/residfp/residfp_defs.h     2026-11-13 
16:13:45.000000000 +0100
@@ -46,6 +46,17 @@
 #  endif
 #endif
 
+/* Deprecated attributes */
+#if __cplusplus >= 201402L
+# define RESIDFP_DEPRECATED [[deprecated]]
+#elif defined(_MSCVER)
+#  define RESIDFP_DEPRECATED __declspec(deprecated)
+#elif defined(__GNUC__) || defined(__clang__)
+#  define RESIDFP_DEPRECATED __attribute__ ((deprecated))
+#else
+#  define RESIDFP_DEPRECATED
+#endif
+
 namespace reSIDfp
 {
     /**
@@ -69,6 +80,15 @@
         RESAMPLE,   ///< Sinc resampling (high quality but CPU intensive)
         NONE        ///< No resampling (raw 1MHz output)
     } SamplingMethod;
+
+    /**
+     *  The SID 6581 caps type
+     */
+    typedef enum {
+        CAPS2200,    ///< Old 2200pF
+        CAPS470,     ///< New 440pF
+        CAPS330      ///< "Galway" 330pF
+    } CapsType;
 }
 
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libresidfp-1.2.3/tests/TestLimiter.cpp 
new/libresidfp-1.3.0/tests/TestLimiter.cpp
--- old/libresidfp-1.2.3/tests/TestLimiter.cpp  2026-10-02 20:14:11.000000000 
+0200
+++ new/libresidfp-1.3.0/tests/TestLimiter.cpp  2026-11-13 16:13:45.000000000 
+0100
@@ -20,14 +20,13 @@
 
 #include "utpp/utpp.h"
 
-#define private public
-
-#include "../src/resample/Limiter.h"
+#include "../src/Limiter.h"
 
 #include <limits>
 #include <cstdint>
 
 using namespace UnitTest;
+using namespace reSIDfp;
 
 SUITE(Limiter)
 {

Reply via email to