Skip to content

Commit 6099f8d

Browse files
committed
Add Agents.md
1 parent 3513dc7 commit 6099f8d

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

Agents.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Noteahead: Agent Guide
2+
3+
Noteahead is a MIDI tracker and sequencer for Linux, written in **Qt/QML** and **C++20**. It follows modern software engineering practices, prioritizing performance, accuracy, and maintainability.
4+
5+
## 🏗 Architecture
6+
7+
The project follows a layered architecture to ensure separation of concerns:
8+
9+
- **`src/domain`**: The "Heart" of the application. Contains pure business logic and data structures (e.g., `Song`, `Track`, `Pattern`, `Arpeggiator`). It should remain as independent of the UI and infrastructure as possible.
10+
- **`src/application`**: The "Brain". Orchestrates domain objects and provides services for the UI.
11+
- **`services/`**: High-level logic (e.g., `MidiService`, `EditorService`).
12+
- **`models/`**: `QAbstractListModel` and other QML-facing models.
13+
- **`command/`**: Implementation of the Command Pattern for Undo/Redo functionality.
14+
- **`src/infra`**: The "Hands". Handles external systems:
15+
- **`midi/`**: RtMidi backend and MIDI file export/import.
16+
- **`audio/`**: RtAudio backend and audio recording.
17+
- **`video/`**: ffmpeg-based video generation.
18+
- **`settings/`**: Persistent configuration management.
19+
- **`src/view`**: The "Face". Pure QML-based UI, communicating with the application layer via models and services.
20+
- **`src/common`**: Shared constants and utilities.
21+
- **`src/contrib`**: External dependencies bundled with the source (`Argengine`, `SimpleLogger`).
22+
23+
## 🛠 Technology Stack
24+
25+
- **Language**: C++20 (Standard strictly required).
26+
- **UI Framework**: Qt 6 (6.4+).
27+
- **Build System**: CMake with Ninja.
28+
- **Backend**:
29+
- **MIDI**: RtMidi.
30+
- **Audio**: RtAudio / JACK.
31+
- **File IO**: libsndfile, Qt XML.
32+
- **Testing**: CTest + Qt Test.
33+
34+
## 📜 Coding Standards & Style
35+
36+
Adherence to these standards is mandatory for all contributions:
37+
38+
### General Principles
39+
- **Clean Code**: Prioritize readability and self-documenting code.
40+
- **Const-Correctness**: Embrace `const` everywhere. Methods that do not modify state MUST be marked `const`.
41+
- **Memory Management**: Use smart pointers (`std::unique_ptr`, `std::shared_ptr`) and avoid raw `new`/`delete`.
42+
- **RAII**: Resource acquisition is initialization.
43+
44+
### C++ Specifics
45+
- **Braced Initializers**: Use `{}` for initialization to avoid narrowing conversions and the "most vexing parse".
46+
- **Namespace**: All code belongs in the `noteahead` namespace.
47+
- **Formatting**: Strictly follow the project's `.clang-format` located in the root.
48+
- **Header Guards**: Use `#ifndef FILENAME_HPP` style instead of `#pragma once`.
49+
- **Standard Library**: Prefer `std::` containers and algorithms where appropriate.
50+
51+
### Qt & QML
52+
- **Model/View**: Keep logic in C++ models and services; QML should only handle presentation.
53+
- **Properties**: Use `Q_PROPERTY` with `READ`, `WRITE`, and `NOTIFY` signals correctly.
54+
- **Signals/Slots**: Prefer the modern `connect` syntax (`&Sender::signal, receiver, &Receiver::slot`).
55+
56+
## 🧪 Testing Strategy
57+
58+
- **Unit Tests**: Located in `src/unit_tests`. Every new feature or bug fix should include a test.
59+
- **Execution**: Run tests using `ctest` from the build directory.
60+
- **Framework**: Uses the Qt Test framework.
61+
62+
## 🚀 Performance & Timing
63+
64+
- **Accuracy**: Noteahead renders events just before playback to ensure jitter-free, drift-free timing.
65+
- **Thread Safety**: The player runs in a dedicated thread (`PlayerWorker`). Use safe synchronization primitives when interacting between the UI and player threads.

0 commit comments

Comments
 (0)