05_11_11_visualization_system - Sistema de VisualizaciΓ³n¶
Estado: π Pendiente Prioridad: MEDIA EstimaciΓ³n: 4-6 semanas Dependencias: Todo el subsistema
π― PROPΓSITO¶
El Visualization System permite ver y depurar el grafo visualmente, esencial para entender flujos complejos:
- ποΈ Renderizado del grafo con layouts inteligentes
- π MΓ©tricas en tiempo real (CPU, levels, latency)
- π¨ Color-coding por tipo y estado
- π±οΈ InteracciΓ³n (select, drag, edit)
- πΈ Export a SVG/PNG
Sin visualizaciΓ³n: Debug con printf, confusiΓ³n Con visualizaciΓ³n: Entendimiento inmediato, debug 10x mΓ‘s rΓ‘pido
π COMPONENTES¶
1. Graph Renderer¶
class GraphRenderer {
enum LayoutAlgorithm {
HIERARCHICAL, // Layered by dependency
FORCE_DIRECTED, // Physics simulation
CIRCULAR // Nodes in circle
};
void setLayout(LayoutAlgorithm algo);
void render(const AudioGraph& graph, RenderTarget& target);
};
Layout Algorithms:
Hierarchical (Sugiyama): - Best for: DAGs with clear flow - Pros: Shows dependencies clearly - Cons: Not for cyclic graphs
Force-Directed (Fruchterman-Reingold): - Best for: General graphs - Pros: Works for any graph - Cons: Slow for >100 nodes
Circular: - Best for: Feedback-heavy graphs - Pros: Shows cycles clearly - Cons: Can be cluttered
2. Visual Elements¶
struct NodeVisual {
Shape shape; // Circle/Rectangle by type
Color color; // By category
std::string label;
Position position;
// Annotations
float cpuUsage; // 0-100%
float peakLevel; // -inf to 0 dB
bool isClipping;
bool isBypassed;
};
struct EdgeVisual {
LineStyle style; // Solid=audio, dashed=control
float width; // Proportional to channels
Color color; // Green=active, gray=muted
bool animated; // Show signal flow
};
Visual Language:
Node Shapes: - π΅ Circle: Sources (input, oscillators) - β Rectangle: Processors (filters, effects) - ⬑ Hexagon: Outputs (DAC, file)
Node Colors: - π΅ Blue: Input/Source - π’ Green: Effects/Processors - π‘ Yellow: Analysis/Meters - π΄ Red: Output/Destination - β« Gray: Bypassed
Edge Styles: - βββ Solid: Audio signal - βββ Dashed: Control signal - βββ Dotted: MIDI - βββ Thick: Multi-channel
Edge Colors: - π’ Green: Active, signal present - β« Gray: Muted or inactive - π΄ Red: Clipping detected
3. Real-Time Monitor¶
class GraphMonitor {
struct NodeMetrics {
float cpuUsage; // % of total
float peakLevel; // dB
int processCallsPerSec;
bool isClipping;
float latencyMs;
};
void updateMetrics();
void renderOverlay(GraphRenderer& renderer);
};
Metrics Displayed: - CPU usage (color intensity) - Audio levels (meter beside node) - Latency (ms on node) - Clipping warnings (red indicator) - Process rate (calls/sec)
4. Interactive Features¶
class GraphInteraction {
NodeID getNodeAtPosition(Point pos);
void selectNode(NodeID node);
void dragNode(NodeID node, Point delta);
void editParameter(NodeID node, const std::string& param);
// Connection editing
void startConnection(NodeID from, PortID port);
void completeConnection(NodeID to, PortID port);
void deleteConnection(EdgeID edge);
};
Interactions: - π±οΈ Click node β Select - π±οΈ Drag node β Move - π±οΈ Double-click β Edit parameters - π±οΈ Drag from port β Create connection - β¨οΈ Delete key β Remove selected - π±οΈ Scroll β Zoom - π±οΈ Middle-drag β Pan
5. Export System¶
class GraphExporter {
void exportToSVG(const std::string& path);
void exportToPNG(const std::string& path, int width, int height);
void exportToJSON(const std::string& path); // Structure only
};
π ESTRUCTURA¶
05_11_11_visualization_system/
βββ include/
β βββ GraphRenderer.h
β βββ LayoutAlgorithm.h
β βββ GraphMonitor.h
β βββ GraphInteraction.h
β βββ GraphExporter.h
β βββ RenderTarget.h # Abstract interface
βββ src/
β βββ GraphRenderer.cpp
β βββ HierarchicalLayout.cpp
β βββ ForceDirectedLayout.cpp
β βββ CircularLayout.cpp
β βββ GraphMonitor.cpp
β βββ GraphInteraction.cpp
β βββ GraphExporter.cpp
βββ backends/
β βββ OpenGLRenderTarget.cpp
β βββ Direct2DRenderTarget.cpp
β βββ SVGRenderTarget.cpp
βββ tests/
β βββ test_layouts.cpp
β βββ test_rendering.cpp
β βββ test_interaction.cpp
β βββ test_export.cpp
βββ examples/
β βββ simple_visualizer.cpp
β βββ interactive_editor.cpp
β βββ metrics_overlay.cpp
βββ docs/
βββ VISUAL_LANGUAGE.md
βββ LAYOUT_ALGORITHMS.md
βββ INTEGRATION_GUIDE.md
π― ENTREGABLES¶
- GraphRenderer with 3 layout algorithms
- NodeVisual and EdgeVisual structures
- GraphMonitor for real-time metrics
- Interactive features (select, edit, drag)
- Export to SVG/PNG
- OpenGL render backend
- 10+ unit tests
- Visual test suite
- Performance benchmarks
- User guide with examples
π MΓTRICAS DE ΓXITO¶
Visual Quality¶
- β Clear node separation (no overlaps)
- β Readable labels at all zoom levels
- β Intuitive color coding
- β Smooth animations (60 FPS)
Performance¶
- β 60 FPS with 100 nodes
- β 30 FPS with 500 nodes
- β <100ms layout calculation (100 nodes)
Usability¶
- β Intuitive without training
- β Fast navigation (zoom, pan)
- β Clear visual hierarchy
- β Helpful tooltips
Accuracy¶
- β Metrics update 10x/sec
- β <10ms latency for interaction
- β Precise export (SVG matches display)
π‘ EJEMPLO VISUAL¶
[Input]βββββββ
β β
β β
[Gain] [Filter]
32% 45% β CPU usage
-12dB -18dB β Peak level
β β
ββββββ¬βββββ
β
[Output]
15%
-6dB
Con colores: - Nodos verdes (procesando) - Edges verdes (seΓ±al activa) - NΓΊmeros en blanco (mΓ©tricas) - Background negro (clarity)
π¨ TEMAS VISUALES¶
Dark Theme (default)¶
Background: #1e1e1e
Nodes: #2d2d2d
Text: #ffffff
Edges: #4a4a4a
Active: #00ff00
Warning: #ffff00
Error: #ff0000
Light Theme¶
Background: #ffffff
Nodes: #e0e0e0
Text: #000000
Edges: #808080
Active: #00aa00
Warning: #ffaa00
Error: #cc0000
High Contrast¶
Background: #000000
Nodes: #ffffff
Text: #000000
Edges: #ffffff
Active: #00ff00
Warning: #ffff00
Error: #ff0000
πΌοΈ SCREENSHOTS (Conceptual)¶
Simple Chain¶
Parallel Effects¶
Feedback Loop¶
Multi-Band¶
ββ [LowBand] ββ
[Input] ββΌβ [MidBand] ββΌβ [Sum] β [Output]
ββ [HiBand] βββ
π§ CONFIGURACIΓN¶
GraphVisualizer visualizer;
// Layout
visualizer.setLayout(LayoutAlgorithm::HIERARCHICAL);
// Visual options
visualizer.showMetrics(true);
visualizer.showEdgeFlow(true); // Animate signal flow
visualizer.setColorScheme(ColorScheme::DARK);
// Interaction
visualizer.enableEditing(true);
visualizer.enableDragging(true);
// Render
while (running) {
visualizer.update(deltaTime);
visualizer.render(renderTarget);
}
π ROADMAP¶
Fase 1 - Basic Visualization (2 weeks)¶
- Static rendering
- Hierarchical layout
- Basic colors
Fase 2 - Metrics & Animation (2 weeks)¶
- Real-time metrics
- Animated signal flow
- CPU/level displays
Fase 3 - Interaction (2 weeks)¶
- Selection
- Dragging
- Basic editing
Fase 4 - Advanced Features (2 weeks)¶
- Additional layouts
- Export
- Themes
- Polish
Creado: 2025-10-14 VersiΓ³n: 1.0.0