Skip to content

Link the SDK

After building and installing, point the consumer at the isolated prefix and ask CMake for the exact package version. The package exports the Treefall:: compatibility targets over the installed SDK libraries.

Use find_package in the consumer’s CMakeLists.txt:

cmake_minimum_required(VERSION 3.22)
project(treefall_consumer LANGUAGES CXX)
find_package(TreefallSDK 0.9.0 EXACT REQUIRED CONFIG)
add_executable(transport-consumer main.cpp)
target_compile_features(transport-consumer PRIVATE cxx_std_20)
target_link_libraries(transport-consumer PRIVATE Treefall::transport)

Configure with the clean prefix:

Terminal window
cmake -S . -B build -DCMAKE_PREFIX_PATH=/tmp/treefall-sdk-0.9.0-install
cmake --build build

Treefall::transport supplies the transport controller and its public dependencies. Include installed public headers such as <treefall/transport_controller.h> and <treefall/version.h>; do not include build-directory paths or private implementation headers. The transport configuration fixes the sample rate, output channel count, maximum block size, and other capacities for the controller lifetime. Call processAudio() with the exact configured planar output buffers and a bounded frame count.

The bundle’s transport smoke artifact creates a 48 kHz, two-channel controller with a 64-frame maximum block, renders one preallocated silent block, checks every output sample, and prints the expected success line. Render the exact checked-in source below rather than copying a local code sample:

example.transport-smoke · Product 0.9.0 · Unreleased preview
Source revision: 0238eac1721d820d16ba5390e0e4641391be1d59
// SPDX-License-Identifier: MIT
#include <treefall/transport_controller.h>
#include <treefall/version.h>

#include <array>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <memory>
#include <span>

int main() {
  try {
    constexpr std::uint32_t kSampleRate = 48000;
    constexpr std::uint32_t kChannels = 2;
    constexpr std::size_t kFrames = 64;

    const orpheus::TransportConfig config{
        .sampleRate = kSampleRate,
        .outputChannels = kChannels,
        .maxBlockFrames = static_cast<std::uint32_t>(kFrames),
        .maxActiveVoices = 1,
        .numGroups = 1,
        .maxSourceChannels = kChannels,
        .sourceChannelPolicy = orpheus::SourceChannelPolicy::Discrete,
    };
    auto transport = orpheus::createTransportController(nullptr, config);
    if (!transport || transport->getRenderConfig().maxBlockFrames != kFrames) {
      throw std::runtime_error("transport creation failed");
    }

    std::array<float, kFrames> left{};
    std::array<float, kFrames> right{};
    float* outputs[] = {left.data(), right.data()};
    transport->processAudio(outputs, kChannels, kFrames);
    for (const auto* channel : outputs) {
      for (const float sample : std::span<const float>(channel, kFrames)) {
        if (sample != 0.0f) throw std::runtime_error("non-silent output");
      }
    }

    std::cout << "Treefall SDK " << TREEFALL_SDK_VERSION << " transport smoke: 64 silent frames\n";
    return 0;
  } catch (const std::exception& error) {
    std::cerr << "transport smoke failed: " << error.what() << '\n';
    return 1;
  }
}
Treefall SDK 0.9.0 transport smoke: 64 silent frames
Source and producer-reported verification
Source-relative path
examples/transport-smoke.cpp
SHA-256
143beab36becdd09611b260f2e87d6a6ec354231173f2ad20dac625a2217ce07
Producer-reported verification
executed
Environment
os=darwin/arm64; cmake=cmake version 4.1.0; compiler=Apple clang version 21.0.0 (clang-2100.0.123.102)
Command
./examples-build/transport-smoke

The rendered artifact includes its source-relative path, SHA-256 digest, source revision, and the exact executable command used for producer-reported verification. A failure to create the controller, a changed block capacity, or any nonzero output exits before the success line.

For file-backed sources, complete the audio-file preflight and read/write flow before preparing transport input. For callback ownership, bounded command ingress, and output lifetime rules, read realtime hosting.

The installed-package discovery contract and target checks are exercised by the pinned package smoke project, while the transport API contract is declared in the transport controller header.