[LAD] [experimental] Simple C++20 JACK Client wrapper

Mario Lang mlang at delysid.org
Sun May 22 18:22:07 CEST 2022


Hi.

std::span<>, std::lerp, std::clamp, just to name some, C++
standardisation has been good to audio devs in recent years.

I always wanted to have a concise modern C++ wrapper class for a JACK client.
Here is my latest (very incomplete) attempt:

  https://github.com/mlang/ladxx20

#include <algorithms>
#include <processor.hpp>

using namespace std;

struct null : lad::processor {
  null(): lad::processor("null", 0, 1) {}
  void process(audio_buffers audio) override {
    for (auto buffer: audio.out) ranges::fill(buffer, 0.0);
  }
};

int main() {
  null client;

  client.start();

  this_thread::sleep_for(chrono::seconds(5));

  return EXIT_SUCCESS;
}

The idea is to make it as easy as possible to write custom JACK clients.
No callback registration, no port naming, no remembering flags.
Just declare a class and implement a single method.
Buffers are passed to you as spans, so modern for-loop and
all stl algorithms can be used immediately.

This is sort of like a template project for now.
Clone and write your own tool to experiment with DSP.
If you have productive feedback, I am all ears.
I am not looking for language flamewar activity though.
If you are not into C++ for some reason, just go on, there is nothing to see here...

-- 
CYa,
  ⡍⠁⠗⠊⠕


More information about the Linux-audio-dev mailing list