How j-bresson/sdif-edit works
Project type and purpose
• SDIF-Edit is a native C++ desktop application with an OpenGL/GLUT GUI.
• It also provides an optional Lisp-based plugin (SDIF-Edit4OM) to integrate with OpenMusic.
File structure
Top-level:
• README.md, LICENSE, .gitignore
• / (C headers for SDIF API)
• macos/ (platform Makefile)
• source/ (all C++ source and headers)
• OM/SDIF-Edit4OM/ (Lisp wrapper for OpenMusic)
Key source subcomponents:
• main.cpp – application entry point
• EventManager* – input/event dispatch
• GUI* and Window* – windowing and UI components
• SDIFDescriptor, SVStream, SVMatrix – internal data model for SDIF structures
• SDIFViewerWindow_Draw – rendering routines
• Various specialized windows: Sonagram, SliceView, SplineEditor, ColorChooser, etc.
Extract insights from the README
• Dependencies: static SDIF library, dynamic OpenGL/GLUT
• Build: simple Makefile invocation (platform-specific in macos/)
• Runtime: command-line binary that opens a .sdif file
• OM integration: Lisp scripts in OM/SDIF-Edit4OM that load this tool into OpenMusic
Main components
a. External Libraries (third-party)
• SDIF C library (parsing & I/O)
• OpenGL/GLUT (rendering & windowing)
b. Core Application
1. Entry Point (main.cpp)
2. Event Manager – captures user input & window events
3. Data Model – SDIFDescriptor → SVStream → SVMatrix hierarchy
4. GUI Layer – GUIComponent, Window, and specialized Window subclasses (SonagramWindow, SplineEditorWindow, etc.)
5. Rendering Engine – drawing routines in SDIFViewerWindow_Draw using OpenGL calls
6. Preferences & Configuration – Preferences module manages user settings
7. Plugin Interface (optional) – OM/SDIF-Edit4OM Lisp scripts that invoke or embed the core app in OpenMusic
c. Build System
• Makefile (macos/) with targets to compile and link all .cpp via g++ (including static link to SDIF, dynamic link to OpenGL/GLUT)
Relationships and interactions
• User → GUI Layer: mouse/keyboard events → Event Manager
• Event Manager ↔ GUI Components: dispatch events → component methods
• GUI Components ↔ Data Model: request SDIFDescriptor to retrieve streams/matrices → display data
• Data Model ← SDIF Library: parser reads .sdif file into descriptor/streams/matrices
• Core Application ↔ Preferences: on startup/load settings, on exit/save settings
• OM Plugin → Core Application: Lisp code loads and controls the binary or embeds its API
Architectural patterns & design principles
• MVC-like separation: Data Model (SDIFDescriptor/SV*), View (Window classes), Controller (EventManager)
• Plugin/extensibility point: OM/SDIF-Edit4OM directory provides Lisp extension interface
• Layered design: third-party libs at bottom, core logic in middle, UI on top