joelle-o-world / naive-instruments

Clueless audio synthesis library in C++
0 stars 0 forks source link

Extract examples from doc comments and use these as audio file tests #74

Open joelle-o-world opened 1 year ago

joelle-o-world commented 1 year ago

sounds like a faff but could be easier enough.

  1. Grep the source code for ``example {FILENAME}
  2. create a cpp test file with each of the examples as a function. Generate a sample pack. NOTE: This should be separate from the main catch2 unit tests.
  3. Think of some way to link the audio files back to the documentation? Perhaps a plugin for the documentation generator, or perhaps a we use a link (or embedded audio file) to determine the write path of the example files.
/**
 * ```example
 * saw(constant(440));
 * ```
 */
inline mono saw(mono frequency) { ... }

Perhaps a convention that the last line of the example is an expression for the signal to record.