Skip to content

Conversation

@NoNamedCat
Copy link

This set of changes addresses build issues encountered when using Mozzi with Arduino CLI and strictly structured 3rd party cores (specifically for the CH32 architecture).

The Problem:
In the original codebase, files like 'Oscil.h' and 'Line.h' included both 'mozzi_fixmath.h' (Mozzi's math abstraction) and 'FixMath.h' (the external library) explicitly. On some platforms/build systems, if the include paths are not resolved in a specific order, or if a user includes a Mozzi header that relies on FixMath types without including FixMath.h themselves, compilation fails with "unknown type" errors.

The Solution:
Moved the #include <FixMath.h> directive inside mozzi_fixmath.h.

Consequently, removed the explicit #include <FixMath.h> from:

  • AudioOutput.h
  • Line.h
  • MetaOscil.h
  • Oscil.h

Why this is safe and better:

  1. Encapsulation: mozzi_fixmath.h acts as the interface for fixed-point math in Mozzi. It effectively "owns" the relationship with the underlying FixMath library. Consuming files shouldn't need to manually import the backend library.
  2. Robustness: Any file including mozzi_fixmath.h is now guaranteed to have the necessary FixMath types defined, preventing subtle ordering bugs.
  3. Compatibility: Since FixMath.h uses standard include guards, this change does not negatively impact existing platforms (AVR, ESP, STM32, etc.), but it fixes the build path issues on newer/stricter platforms.

@NoNamedCat NoNamedCat closed this by deleting the head repository Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant