Feature/code quality improvements#29
Merged
davidirvine merged 7 commits intodevelopfrom Jul 21, 2025
Merged
Conversation
- Replace std::vector with std::array for oscillators storage - Add MAX_OSCILLATORS constant to prevent unbounded allocation - Eliminate dynamic memory allocation in audio processing path - Add oscillator_count member to track active oscillators - Update all oscillator iteration to use index-based loops This improves real-time audio performance by avoiding heap allocation during audio processing, which is critical for maintaining low latency.
- Add validation for sample rate, frequencies, and oscillator count - Throw std::invalid_argument with descriptive messages for invalid parameters - Validate non-negative frequencies and positive sample rates - Check oscillator count bounds against MAX_OSCILLATORS - Add validation for animation multiplier - Include <stdexcept> for exception handling This prevents undefined behavior from invalid parameters and provides clear error messages to help developers identify configuration issues.
- Add noexcept to getter methods and simple setters that cannot throw - Mark const methods with noexcept where appropriate - Update Range class methods with noexcept specifications - Improve exception safety guarantees for performance-critical operations This helps the compiler optimize better and provides clearer contract specifications for API consumers about which operations can throw.
- Create deepnote::constants namespace for configuration values - Define DEFAULT_LFO_AMPLITUDE, DEFAULT_DETUNE_HZ, TARGET_FREQUENCY_TOLERANCE - Replace hard-coded magic numbers with named constants - Update init_voice function to use DEFAULT_DETUNE_HZ constant - Update target frequency tolerance in process_voice function This improves code maintainability by centralizing configuration values and making their purpose explicit through naming.
…tions - Extract calculate_shaped_frequency for LFO processing and scaling - Extract update_voice_state for state transition logic - Extract constrain_frequency for frequency bounds checking - Simplify main process_voice function to focus on orchestration - Improve code readability and testability by separation of concerns - Use anonymous namespace for helper functions to limit scope This makes the code more maintainable and easier to understand by breaking complex logic into focused, single-responsibility functions.
- Add detailed class documentation for DeepnoteVoice with usage instructions - Document BezierUnitShaper with mathematical formula and purpose - Add comprehensive function documentation with parameter descriptions - Document the detuning algorithm with clear explanation - Add examples and usage patterns in docstrings - Explain the state machine and animation system This improves code maintainability and helps developers understand the complex audio processing algorithms and their intended usage.
- Add comprehensive compiler warning flags (-Wall, -Wextra, -Wpedantic, -Werror) - Enable AddressSanitizer and UndefinedBehaviorSanitizer in debug builds - Add optimized release builds with -O3 - Create .clang-format configuration for consistent code formatting - Enhance .gitignore with comprehensive build artifact exclusions - Add static analysis script for clang-format, clang-tidy, and cppcheck - Improve development workflow with automated code quality checks This establishes better development practices and helps catch bugs early through static analysis and runtime sanitizers.
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.
No description provided.