AUDIO
Source snapshot · 12 October 2026

Tutorial package and platform entry point

examples/tutorials/src/lib.rs · 20 source lines

Read the chapters in source order. Select a numbered source line to expand its explanation; the line numbers and code match this snapshot exactly.

cargo check -p ravet-examples --no-default-features --locked
Chapters
  1. Separate portable modules from the native UI lines 1–9
  2. Launch with an explicit platform boundary lines 10–20

Separate portable modules from the native UI

delay and synth are always public modules. ui is compiled only on macOS when live-ui is enabled. This keeps offline processors available without the native window/device dependency graph.

1//! Example processors and, on macOS, a live window built from RAVET components.

Source note: Example processors and, on macOS, a live window built from RAVET components.

Link to line 1
2//!

Source note:

Link to line 2
3//! The portable subtractive synth is distinct from the existing Sine CLAP export.

Source note: The portable subtractive synth is distinct from the existing Sine CLAP export.

Link to line 3
4//! UI and device ownership remain outside its audio processing implementation.

Source note: UI and device ownership remain outside its audio processing implementation.

Link to line 4
5pub mod delay;

Bring these module/type names into scope for “Separate portable modules from the native UI”; the surrounding chapter explains their responsibilities.

Link to line 5
6pub mod synth;

Bring these module/type names into scope for “Separate portable modules from the native UI”; the surrounding chapter explains their responsibilities.

Link to line 6
7#[cfg(all(target_os = "macos", feature = "live-ui"))]

Apply this Rust attribute to the following item. cfg selects which target/feature/test build contains it; derive generates the named trait implementations.

Link to line 7
8pub mod ui;

Bring these module/type names into scope for “Separate portable modules from the native UI”; the surrounding chapter explains their responsibilities.

Link to line 8
9

Blank line separating the surrounding statements.

Link to line 9

Launch with an explicit platform boundary

launch returns a boxed-error Result. On macOS with live-ui it delegates to ui::run. The complementary cfg branch returns an explanatory error; it does not silently replace the native UI with an unrelated backend.

10/// Open an interactive example on macOS, or explain the current native UI limit.

Source note: Open an interactive example on macOS, or explain the current native UI limit.

Link to line 10
11pub fn launch(mode: &str) -> Result<(), Box<dyn std::error::Error>> {

Define launch. launch returns a boxed-error Result. On macOS with live-ui it delegates to ui::run. The complementary cfg branch returns an explanatory error; it does not silently replace the native UI with an unrelated backend.

Link to line 11
12 #[cfg(all(target_os = "macos", feature = "live-ui"))]

Apply this Rust attribute to the following item. cfg selects which target/feature/test build contains it; derive generates the named trait implementations.

Link to line 12
13 {

Close the surrounding scope, value or argument list in “Launch with an explicit platform boundary”.

Link to line 13
14 ui::run(mode)

Define or initialize ui with the displayed type/value. Its ownership and use are described in “Launch with an explicit platform boundary”.

Link to line 14
15 }

Close the surrounding scope, value or argument list in “Launch with an explicit platform boundary”.

Link to line 15
16 #[cfg(not(all(target_os = "macos", feature = "live-ui")))]

Apply this Rust attribute to the following item. cfg selects which target/feature/test build contains it; derive generates the named trait implementations.

Link to line 16
17 {

Close the surrounding scope, value or argument list in “Launch with an explicit platform boundary”.

Link to line 17
18 Err(format!("{mode}: native UI currently requires macOS and the live-ui feature; offline fixtures remain available").into())

Construct the success/error variant selected by the surrounding match or function return. The enclosed value becomes its payload.

Link to line 18
19 }

Close the surrounding scope, value or argument list in “Launch with an explicit platform boundary”.

Link to line 19
20}

Close the surrounding scope, value or argument list in “Launch with an explicit platform boundary”.

Link to line 20

Source SHA-256: d138ae66cdbb46b9c5ef0a8ad52912fb669244bd7592aea788dc6cb0a6bb6a1c

All tutorial walkthroughs