How bingmann/sound-of-sorting works
Project type and purpose
• This is a native desktop demo application written in C++ that visualizes and “audibilizes” sorting algorithms in real time. It uses wxWidgets for GUI/dialogs/painting and SDL for audio output.
File structure
• Top-level files (configure, Makefile.am/in, aclocal.m4, etc.): an Autotools-based build system for cross-platform compilation.
• /src: all application sources.
• WMain.{cpp,h} and generated wxGlade files (/src/wxg/*): the main window, menu, controls, and event wiring.
• SortAlgo.{cpp,h}: orchestration of all sorting algorithm implementations (calls into the instrumented array).
• algorithms/*.cpp: individual algorithm variants (timsort, wikisort, etc.).
• SortSound.cpp: the SDL-based audio oscillator/mixing classes that turn comparisons into beeps.
• wxClickText.*, resources.rc, sos.xcf, sos.xpm: auxiliary UI/image resources.
• Tests (SortTest.cpp) and utility scripts (acscripts/*).
Key insights from README
• MVC-style separation:
• Model: the instrumented array (WSortView) + ArrayItem that counts accesses/comparisons.
• Controller: user events—Run, Step, Reset, Speed, Algorithm selection, Sound on/off—handled in WMain.
• Sorting algorithms call into WSortView, triggering painting and sound via ArrayItem overrides.
• Sound engine: Oscillator objects generate triangular waveforms via SDL audio callbacks.
Detail
• Event flow for Run/Step/Reset and how speed slider influences delay in the Sorting Engine.
• That ArrayItem overloads are the interception points for both counters and audio triggers.
• Resource files (images, dialogs) feeding into the GUI.