Python3 scons branch#3
Open
vokimon wants to merge 117 commits into
Open
Conversation
Add a top-level CMake entrypoint for the imported CLAM tree, build the core/audio/processing libraries, and enable the NetworkEditor Qt targets with Qt6 compatibility headers. Remove C++ constructs rejected by C++17 and update the NetworkEditor/monitor sources for Qt6 APIs.
Replace SMSTools-qt4/ with a Qt6-only SMSTools/ tree built by CMake. All Q3* widgets are swapped for their modern equivalents (Q3FileDialog, Q3ListBox, Q3Frame, Q3Process, Q3WhatsThis, Q3PopupMenu, Q3ButtonGroup, Q3TextBrowser, Q3MainWindow), removed-in-Qt6 helpers are replaced (QGLColormap is shimmed in QtPalette.hxx, setPaletteBackgroundColor / setPaletteForegroundColor become a small QPalette helper in PaletteHelpers.hxx, QToolTip::add/remove become setToolTip, QPushButton::setPixmap becomes setIcon, QFontMetrics::width becomes horizontalAdvance, QString::sprintf becomes QString::asprintf, QPainter::resetXForm becomes resetTransform, QGLWidget OpenGL widgets inherit from QOpenGLWidget), and Qt3-style API calls are replaced (ascii -> toStdString, setOn/isOn -> setChecked/isChecked, setMargin -> setContentsMargins, currentItem/setCurrentItem -> currentIndex/setCurrentIndex on QComboBox, setMaxValue/maxValue -> setMaximum/maximum, setSteps -> setSingleStep + setPageStep, QTimer::start(ms,true) -> setSingleShot + start(ms), reparent -> setParent + move, QGridLayout addMultiCell* -> addLayout/addWidget, new QHBoxLayout(parentLayout) -> new QHBoxLayout + parent->addLayout). uic-generated connections in QtSMSTools.ui, SMSConfigDlg.ui and ScoreEditorDlg.ui have been moved into the dialog constructors so the typed-pointer connect() resolves against the QtSMS form class rather than QMainWindow / QDialog. SMSTools/CMakeLists.txt produces three executables (SMSConsole and SMSBatch with no Qt dependency; SMSTools as the Qt GUI) plus three static helper libraries. The top-level build opts in via -DCLAM_BUILD_SMSTOOLS=ON. CMAKE-MIGRATION.md is updated to describe the new target and drop SMSTools from the remaining-work list. Assisted by Claude Opus 4.7
Wrap each engine call (LoadConfiguration / LoadAnalysis / LoadTransformationScore / Store* / Analyze / Transform / Synthesize / ExtractMelody) in a small guard() helper that catches std::exception and surfaces the message via QMessageBox::critical instead of letting an unhandled CLAM::Err abort the process. The previous behaviour aborted the GUI with a terminate() backtrace when, for example, a transformation-score XML used an unexpected element. Assisted by Claude Opus 4.7
Rewrite ~234 legacy Qt3-style includes across 87 NetworkEditor sources to their Qt6 forms: <QtGui/QFoo> -> <QFoo> <QtOpenGL/QGLWidget> -> <QOpenGLWidget> <QtSvg/QSvgWidget> -> <QSvgWidget> <QtDesigner/QDesignerExportWidget> -> <QtUiPlugin/QDesignerExportWidget> Inheriting widgets renamed accordingly (QGLWidget -> QOpenGLWidget in Spectrogram, Tonnetz, KeySpace, QFirstPerson). With every consumer migrated, cmake/ClamQtCompat.cmake and the clam_generate_qt_compat_headers() calls in the top-level, NetworkEditor and SMSTools CMakeLists are removed; the build no longer generates the fake QtGui/QtOpenGL/QtSvg/QtDesigner forward-header tree. Assisted by Claude Opus 4.7
Add a GitHub Actions workflow that, on push / PR / manual dispatch,
installs the project's apt build dependencies on ubuntu-latest
(xerces-c, fftw3, sndfile, vorbis, mad, jack, portaudio, alsa, GLU,
LADSPA SDK, Qt6 base + svg + opengl + tools), then runs:
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCLAM_BUILD_LIBRARIES=ON -DCLAM_BUILD_GUI_APPS=ON \
-DCLAM_BUILD_SMSTOOLS=ON
cmake --build build
so both the GUI applications (NetworkEditor, SMSTools) and the
non-Qt console tools (SMSBatch, SMSConsole) are exercised by CI.
Assisted by Claude Opus 4.7
…STools
Address the warning categories surfaced by the Ubuntu CI build.
Real bugs uncovered by warnings:
- Stats.hxx: `if (mCenterOfGravities[order-1] = NULL)` was an
assignment (always-false truth value) so the body never ran and the
per-order CenterOfGravity was never lazily allocated. Switched to
`== nullptr` and use nullptr in the surrounding loop too.
- Navigator.hxx: header guard typo `#ifndef __NAVIGATOR__ / #define
__NAVEGATOR__` corrected so the include guard actually works.
- ProcessingBox::mousePressEvent had the precedence trap
`!event->modifiers() & Qt::ControlModifier`; now uses the existing
controlPressed flag.
Unused / unused-but-set variables: marked [[maybe_unused]] with a
brief comment when they look like vestiges of an incomplete feature
(Vocoder bin-domain partners, SpectralCombDelta/Partializer outMag,
Deesser maxMag, SpectralNotch harmonic, CleanTracks contAt,
ChordSegmentator underMaxIndex, AudioBufferMixer portSize,
BufferedSDIFFileReader iterationsSinceLastExecution, SMSBase
"old segmentator" defaults, KeySpace::DrawLabels missing-render-call
hint, TextBox::itemChange dead local, etc.). CircularPeakPicking
restored `c = y0` and uses `c` in the ymax formula so code and comment
agree.
catch-value: every `catch (Foo e)` → `catch (const Foo&)` in CLAM core
(Flags, LadspaNetworkExporter, BinaryAudioOp, SegmentSMSMorph,
LV2NetworkPlayer) and SMSTools (SDIFSerializer, SMSBase, SMS, SMSBatch).
sign-compare: signed/unsigned loop variables converted to `auto` so
the type matches the size() / Size() expression they compare against
(AudioMixer, AudioBufferMixer, EnvelopeExtractor, FDCombFilter,
LoopingSDIFFileReader). ProcessingBox::getItemRegion uses
static_cast<int> on the unsigned member counts;
BufferedSDIFFileReader and MultiChannelAudioFileReader use std::size_t
casts.
unused-function: ProcessingBox debug-helper statics and
vmqt/Message.hxx tagged [[maybe_unused]].
reorder: SDIFOut constructor's initialiser list reordered to match the
header (and mpFile = nullptr).
parentheses: BufferedSDIFFileReader::Configure assignment wrapped in
explicit parens.
return-type: SDIFOut::Do() returns false explicitly with a TODO noting
the stream-mode path was never finished.
switch: QSynthKnob::mouseMoveEvent's switch handles QDialMode.
format-security: MIDIReader::Error uses printf("%s", str).
unused-result: NetworkEditor main checks QTranslator::load before
installing the translator.
extern-init: LadspaNetworkExporter's clam_library_marker wrapped in an
extern "C" block.
overloaded-virtual: added `using Processing::Do;` /
`using FrameTransformation::Do;` /
`using SMSBase::StoreOutputSound{,Residual,Sinusoidal};` so derived
classes do not silently hide their base-class overloads.
deprecated-declarations:
- QKeyCombination: Qt::CTRL + Qt::Key_X → Qt::CTRL | Qt::Key_X across
RichTextEditor (8 shortcuts).
- QTextCharFormat::setFontFamily → setFontFamilies({...}).
- QMessageBox positional-int constructor and 8-arg static question()
replaced with the StandardButtons overloads (Message.hxx,
ShowMessage.cxx, MainWindow::askUserSaveChanges).
- QMouseEvent::x()/y() → position() (PlotController::GetXY,
DisplaySurface).
AutoGen: removed the empty NetworkEditor/src/widgets/Configurator.cxx
placeholder. Configurator is a header-only Q_OBJECT class; AUTOMOC
picks the header up directly, so the empty .cxx had no purpose since
its 2011 SVN move.
Also dropped the C-style functional casts I introduced earlier in the
Qt6 port (BPFEditorDisplaySurface, DisplaySurface, ScoreEditorDlg,
Ruler) in favour of static_cast<T>(...), const auto and structured
bindings; factored the duplicated mouse-event-to-view-coords math in
BPFEditorDisplaySurface into a single helper.
Assisted by Claude Opus 4.7
Summarises what CLAM is, lists the libraries (clam_core / clam_processing / clam_audioio) and the four applications produced by this branch's build (NetworkEditor, SMSTools, SMSBatch, SMSConsole), and documents: - the apt dependency list that mirrors the CI workflow - cmake / cmake --build incantations for the three build profiles (libraries only / +NetworkEditor / +SMSTools) - the CLAM_BUILD_* and CLAM_WITH_* CMake option matrix - a manual quick-test recipe for the SMSTools GUI against the bundled example-data - pointers to the CI workflow and to CMAKE-MIGRATION.md
Drop the in-house threading wrappers in CLAM/src/System/Threads/
and switch every consumer to <mutex>, <thread>, <chrono> directly.
- CLAM::Mutex / TryMutex / ScopedLock -> std::mutex + std::lock_guard /
std::unique_lock(std::try_to_lock).
- CLAM::Thread (Start/Stop/IsRunning/SetThreadCode) -> std::thread
with lambda callables; cooperative cancellation via existing flags.
- xtime_get -> std::chrono::steady_clock.
- CBL::Functor0 method-binding dropped in favor of [this]{ ... } lambdas.
- BufferedSDIFFileReader takes ownership of its worker thread instead
of receiving an external Thread*.
- FileSystem singleton: =default ctor/dtor, std::mutex guard, range-for
in callers.
- Range-based for loops where iterator/index was unused.
Removes 17 files under CLAM/src/System/Threads/. CMake glob no longer
points at the deleted directory. No remaining consumer of the old
headers in the buildable tree.
Assisted by Claude Opus 4.7
Mechanical sweep across the buildable tree. Diagnostic strings that embedded the word NULL are rewritten as "null" to read naturally after the swap. Also remove the legacy '#define NULL (0L)' shim from OSDefines.hxx. The shim's symmetric mate '#define nullptr (0L)' was getting picked up after this rename and broke std::list::push_back on libstdc++ 15 by deducing nullptr_t as long int inside __exchange/release. Assisted by Claude Opus 4.7
First batch of iterator-pattern -> range-based for-loop conversions. Also opportunistically replaces explicit iterator types with auto. CLAM/src/Processing/Plugins/RunTimeLibraryLoader.cxx CLAM/src/Processing/SDIFIO/LoopingSDIFFileReader.cxx NetworkEditor/src/MainWindow.hxx NetworkEditor/src/ProcessingTree.cxx More files to follow. Assisted by Claude Opus 4.7
Convert empty Foo::Foo() / Foo::~Foo() bodies to =default, where no member initializers or side effects are present. Assisted by Claude Opus 4.7
Adds an optional CppUnit detection path and registers test/NonPortedTests/TestThreading.cxx (already rewritten to use std::mutex/std::thread/std::chrono) as a ctest-runnable target, gated on BUILD_TESTING. Assisted by Claude Opus 4.7
include(CTest) at the top-level defaults BUILD_TESTING=ON, which triggers the cppunit detection branch in CLAM/CMakeLists.txt and fails configure on a fresh ubuntu-latest image. Assisted by Claude Opus 4.7
- TraverseDirectory: rewrite on top of std::filesystem::recursive_ directory_iterator. Drops the WIN32 vs POSIX split entirely (FindFirstFile/dirent.h gone), drops the dead Skip* declarations that never had a definition, =defaults the ctor/dtor. - RunTimeLibraryLoader: opendir/readdir/closedir -> directory_iterator; CompletePathFor()'s opendir+fopen probes -> is_directory + is_regular_file; range-for over environment paths. - RunTimeLadspaLibraryLoader / RunTimeFaustLibraryLoader: drop dead <dirent.h> include. - MpegCodec: stat()/struct stat -> std::filesystem::file_size(). Assisted by Claude Opus 4.7
ExecState only appears in equality comparisons and switches, never gets implicitly converted to int, and the unscoped names (Ready, Running, Unconfigured) crowd Processing's public namespace. Convert to scoped enum class and qualify the call sites. Assisted by Claude Opus 4.7
In C, 'enum X { ... }' makes the type 'enum X', so the typedef
trick to drop the 'enum' tag was necessary. In C++, 'enum X { ... }'
is already the type name. Rewrite all 20 occurrences to the plain
C++ form.
Not promoted to 'enum class' here because the values participate in
CLAM::Enum / CLAM::Flags / bitwise ops that require implicit int
conversion. Just the C-ism is removed.
Assisted by Claude Opus 4.7
throw() and noexcept have identical observable behaviour on violation (program terminates), but throw() is deprecated in C++11, removed in C++17, banned in C++20. Replace empty dynamic-exception specifications across the project. Only the empty form was used -- no throw(SomeType) specs to translate. Assisted by Claude Opus 4.7
Thirteen files in CLAM/src, CLAM/examples, CLAM/plugins, CLAM/test and SMSTools/test were still encoded in ISO-8859-1 with raw 0xB2 / 0xB3 (superscript 2 / 3) bytes in comments. Convert in place to UTF-8 with iconv so the rest of the tree -- and any tooling that edits files via a UTF-8 layer -- stops mangling those bytes to U+FFFD. No content change beyond the encoding; the visible characters (superscripts in math comments, etc.) remain the same. Assisted by Claude Opus 4.7
QFirstPerson was the only caller of glu*. Replace: - gluPerspective() -> QMatrix4x4::perspective() + glLoadMatrixf(). - gluSphere() / GLUquadric -> small inline drawSphere() helper that emits the same GL_QUAD_STRIP geometry with outward normals, matching the fixed-function style of the rest of the file. The CLAMGL.hxx shim in SMSTools/vmqt also pulled in <GL/glu.h> / <OpenGL/glu.h>, but no SMSTools translation unit calls any glu* symbol; the include was dead and is dropped. CMake no longer searches for libGLU in NetworkEditor or SMSTools; README's apt-install list drops libglu1-mesa-dev. With GLU gone, the macOS and Windows builds can enable CLAM_BUILD_GUI_APPS without needing a GLU package. Assisted by Claude Opus 4.7
Compile and link on clang/libc++ (macOS) and MSVC (Windows) without
regressing GCC/Linux:
- Source: drop libc++-removed std::mem_fun; replace VLAs with
std::vector; list::remove(&x) -> find+erase (MSVC 14.44 STL bug);
drop out-of-class default args (clang strict); namespace-wrap an
explicit template instantiation; rewrite the pthread_t-based
AudioPlayer with std::thread.
- Platform gates: x87 inline asm to _MSC_VER && _M_IX86; legacy
<cmath> shims to _MSC_VER < 1900; pthread / sched code to !_WIN32;
AudioFile's MpegCodec dispatch to USE_MAD && USE_ID3; MIDISettings'
portmidi block to USE_PORTMIDI (not WIN32).
- CMake: cppunit detection with find_path/library fallback on
Windows + vcpkg; vorbis transitive deps on macOS / Windows
(pkg-config there doesn't chase Requires.private); sndfile include
propagated publicly on Windows only; clam_qtmonitors STATIC on
Windows to dodge the AutoRCC / WINDOWS_EXPORT_ALL_SYMBOLS race;
OpenGL::GL paired with Qt6::OpenGL via
$<$<PLATFORM_ID:Windows>:OpenGL::GL> so Qt6::OpenGL's missing
opengl32 linkage is repaired only on Windows.
- Windows DLL boundary: move static class data members to headers
as 'static inline' (SpecTypeFlags::sFlagValues,
OutControlSenderConfig::E{ControlRepresentation,Mapping}::s{EnumValues,
Default}, ErrAssertionFailed::breakpointInCLAMAssertEnabled) --
CMake's WINDOWS_EXPORT_ALL_SYMBOLS does not auto-export those.
- Tidy: TestThreading uses an init-capture for nthreads; remove the
dead InitAudioIO / InitProcessing stubs from four main.cxx files
(the actual headers and types were deleted in 2008 along with the
old VisualC support).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- ClamNetworkCanvas: bind ProcessingDataPlugin::colorFor()'s temporary std::string before calling .c_str() so QColor doesn't read freed memory (-Wdangling-gsl). - OneOverF: bit-equality test used '&&' where '&' was meant, so each iteration compared the same boolean instead of bit i (-Wconstant-logical-operand). - SpectralPeakArray, FDFilterGen: compare against TData(0.0001) so the comparison isn't always false because float can't represent 0.0001 exactly (-Wliteral-range). - SMSBase: initialise ePercentil/eThr/fPercentil/fThr/minLength at declaration so they are defined on every path the optimiser cannot prove unreachable (-Wsometimes-uninitialized). Cleanups that also remove warnings: - SinTrackVClipper: '!outcodei & 0x01' -> 'outcodei == Inside'. - Spectrum::SetTypeSynchronize: '|' on bool flags -> '||'. - TonalAnalysis / Segmentator / SpectralPeakDescriptors: explicit conversions where pair<double,double> / int / 0. meets pair<TData, TData> / TData (silences MSVC C4244). - ScopePool: three iterator for-loops -> range-for, dropping the dead loop counter. - MIDIDispatcher / MIDITempo / OfflineNetworkPlayer: remove counters whose only readers were commented-out code. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- macOS-latest: brew-install cppunit + the audio deps; disable CLAM_WITH_LADSPA and CLAM_WITH_ALSA (Linux-only). - windows-latest: vcpkg for xerces-c, fftw3, libsndfile, libvorbis, libmad, cppunit, portaudio; Qt 6.8.3 via jurplel/install-qt-action; disable CLAM_WITH_LADSPA / LV2 / JACK / ALSA / ID3. - vcpkg binary cache: Microsoft removed the 'x-gha' backend, so persist a files-backed cache via actions/cache@v4 keyed on triplet + vcpkg commit + dep list. First run still does a full vcpkg build (~15 min); subsequent runs unpack archives instead of compiling. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
cStringIO -> io.StringIO long() -> int() types.FloatType/IntType/LongType -> float/int map() needs list() wrapper xrange() -> range() raw_input() -> input() unicode() -> str() basestring -> str .iteritems() -> .items() has_key() -> in string.split/join/strip -> str methods from commands import getoutput -> from subprocess import getoutput reduce() -> add from functools import reduce filter() -> list(filter()) import string removed
generated collissions of global vars (global vars are also evil) with std symbols. Also converted defines into typedefs
- Qt Headers without module path - ui generated headers .hxx -> .h - Null QStrings
- catching refrence to errors - no throw declarations - no register variables - proper scoped local variables - proper signedness for indexes
It accepted Mp3 and Ogg since libsndfile now supports them but the codec was not ready to handle and it crashed.
- bump qt4 -> qt6 - missing qt dependencies - relocatable instalation prefix - reactivated sipunwrap - wip: multiplatform build
py3 returns views in insertion order, turn them into sorted lists
was based on tokenizer.Name but in py3 names can start with numbers
this is to have receive only real red notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trying to have all projects working again on scons in parallel to porting to CMake, just to bring the code base to the point it was in 2014.