Feedback on SDK v2.1

I’m working on SDK v2.1 which has some features I saw requested on this forum, plus it has some helpers for supporting streaming wav files from disk and drawing a waveform in native plugins.

This still under development and all file and function names are subject to changing. I share it to see if there are other helpful features requested that I missed. Here’s what I have so far:

  • uint32_t Audio::get_block_size(): returns the current audio block size (16-512)
  • void notify_user(std::string_view message, int duration_ms) tells the GUI to pop up a message for the given duration. Non-blocking
  • Patch::mark_patch_modified() tells the patch manager that the patch file has been modified internally (e.g. if the user loads a different file in a sampler)
  • uint32_t System::total_memory(): returns the maximum bytes of memory set aside for modules (may vary from FW version to version, but is always the same number for a session)
  • uint32_t System::free_memory(): returns the bytes of memory available/free for modules to use.
  • uint32_t System::hardware_random(): returns an actual random number (not just pseudo-random) generated by cryptography hardware. Takes 2-3 times as long as System::random().
  • bool System::hardware_random_ready(): call this before calling hardware_random(). If it returns true then a new random number is available, otherwise the hardware has not generated a new value yet.
  • uint32_t System::random(): returns a pseudo-random number
  • System::get_ticks(): number of milliseconds since power on
  • System::delay_ms(uint32_t): block/pause for the given period.
  • Patch::patch_path(): returns the path to the currently playing patch file (WIP)
  • Patch::patch_volume(): returns the currently playing patch’s volume (WIP)

And dr_wav is now included in the API so you don’t have to include it in your project separately.

There are also some helper classes.

  • WavFileStream: helper class to stream .wav files from disk
  • StreamingWaveformDisplay: helper class to draw a waveform to a graphical display, when only one sample is known at a time (e.g. the file is being streamed). Useful for native plugins but can also be used in VCV plugins without much fuss.
  • BlockResampler: efficient block-based resampler
  • StreamResampler: efficient stream-based resampler (basically BlockResampler but with a block size of 1 sample). Useful when an AsyncThread is filling a buffer while the audio thread is concurrently reading from.

api-v2.1 also brings with it some changes to the directory structure of the plugin-sdk. Mainly – I got rid of the metamodule-core-interface and metamodule-rack-interface submodules!
The files formerly in these submodule are now just part of the metamodule-plugin-sdk repo, inside core-interface/ and rack-interface/ directories, respectively. This makes navigating git submodules a lot easier. Some other files/directories have moved (and I might move some more).

3 Likes