Byte Engine Docs
View on docs.rs

graph

Generated Rust API reference for byte_engine.

byte_engine / audio / graph


Module graph

Inline-authored audio processing graphs.

Build a graph with the functions in fns, then publish it through crate::gameplay::world::DefaultWorld::audio_graph_factory. The default audio worker validates and compiles each graph before its sample resources cross to the audio thread.

Quick Reference

ItemKindDescription
fnsmodConcise functions for authoring an [super::AudioGraph].
AudioGraphstruct
AudioGraphFactorystruct
AudioGraphTimestruct

Modules

  • fns — Concise functions for authoring an [super::AudioGraph].

Structs

AudioGraph

struct AudioGraph {
    // [REDACTED: Private Fields]
}

Defined in crates/byte-engine/src/audio/graph/authoring.rs:17-20

The AudioGraph struct describes resource-backed sources and the nodes that select and process one source for the default audio output.

Build it with fns::sample, fns::round_robin, fns::random, loop, fns::gain, fns::varispeed, fns::pitch_shift, and fns::custom. Next, submit the same mutable graph again through crate::gameplay::world::DefaultWorld::audio_graph_factory to advance its selector nodes. Stop its current playback through crate::gameplay::world::DefaultWorld::delete.

Trait Implementations

impl ArchivePointee for AudioGraph
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for AudioGraph
impl Clone for AudioGraph
  • fn clone(&self) -> AudioGraph

    Related: AudioGraph

impl Debug for AudioGraph
  • fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for AudioGraph
  • fn into_any(self: Box<T>) -> Box<dyn Any>
  • fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
  • fn as_any(&self) -> &dyn Any
  • fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSend for AudioGraph
  • fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for AudioGraph
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Instrument for AudioGraph
impl LayoutRaw for AudioGraph
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for AudioGraph
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for AudioGraph
  • fn eq(&self, other: &AudioGraph) -> bool

    Related: AudioGraph

impl Pointable for AudioGraph
  • const ALIGN: usize
  • type Init = T
  • unsafe fn init(init: <T as Pointable>::Init) -> usize
  • unsafe fn deref<'a>(ptr: usize) -> &'a T
  • unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
  • unsafe fn drop(ptr: usize)
impl Pointee for AudioGraph
  • type Metadata = ()
impl Read for AudioGraph
impl StructuralPartialEq for AudioGraph
impl WithSubscriber for AudioGraph

AudioGraphFactory

struct AudioGraphFactory {
    // [REDACTED: Private Fields]
}

Defined in crates/byte-engine/src/audio/graph/authoring.rs:210-212

The AudioGraphFactory struct validates authored graphs before publishing their prepared resource and render plans.

Create graphs through Self::create. The default audio setup consumes the prepared plans at hardware-period boundaries.

Implementations

  • fn new() -> Self

    Creates a standalone empty graph factory.

    Use this constructor for isolated tests. Applications normally use

    crate::gameplay::world::DefaultWorld::audio_graph_factory instead.

  • fn create(&self, graph: &mut AudioGraph) -> Handle

    Related: AudioGraph

    Compiles and publishes a graph with a new lifecycle handle.

    This commits each selector node on the selected path. Keep the graph and

    submit it again to play its next selection.

    Pass the returned handle to

    crate::gameplay::world::DefaultWorld::delete to stop the graph.

  • fn derive(&self, handle: Handle, graph: &mut AudioGraph)

    Related: AudioGraph

    Compiles and publishes a replacement with an existing lifecycle handle.

    This commits each selector node on the selected path.

    Use this to replace a graph while preserving the identity returned by

    Self::create.

Trait Implementations

impl ArchivePointee for AudioGraphFactory
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for AudioGraphFactory
impl Clone for AudioGraphFactory
impl Default for AudioGraphFactory
  • fn default() -> Self
impl Downcast for AudioGraphFactory
  • fn into_any(self: Box<T>) -> Box<dyn Any>
  • fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
  • fn as_any(&self) -> &dyn Any
  • fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSend for AudioGraphFactory
  • fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for AudioGraphFactory
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Instrument for AudioGraphFactory
impl LayoutRaw for AudioGraphFactory
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for AudioGraphFactory
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointable for AudioGraphFactory
  • const ALIGN: usize
  • type Init = T
  • unsafe fn init(init: <T as Pointable>::Init) -> usize
  • unsafe fn deref<'a>(ptr: usize) -> &'a T
  • unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
  • unsafe fn drop(ptr: usize)
impl Pointee for AudioGraphFactory
  • type Metadata = ()
impl Read for AudioGraphFactory
impl<R> ReadPrimitive for AudioGraphFactory
impl WithSubscriber for AudioGraphFactory

AudioGraphTime

struct AudioGraphTime {
    // [REDACTED: Private Fields]
}

Defined in crates/byte-engine/src/audio/graph/time.rs:12-15

The AudioGraphTime struct identifies when a processed block starts in one graph playback.

Use Self::seconds_at for non-periodic timing inside crate::audio::graph::fns::custom. For periodic waveforms, use Self::periodic_phase_step and Self::advance_periodic_phase to retain a bounded phase.

Implementations

  • const fn sample_index(self) -> u64

    Returns the output sample index at the start of the block.

  • const fn sample_rate(self) -> u32

    Returns the output sample rate in samples per second.

  • fn seconds(self) -> f64

    Returns the time at the start of the block in seconds.

  • fn seconds_at(self, sample_offset: usize) -> f64

    Returns the time of one sample in the block in seconds.

  • fn periodic_phase_step(self, frequency_hz: f32) -> f32

    Returns one bounded phase step for a periodic waveform.

    Calculate this once per custom-processor block, then pass it to

    Self::advance_periodic_phase for every sample. This avoids deriving a

    periodic phase from an ever-growing absolute time value.

  • fn advance_periodic_phase(phase: f32, phase_step: f32) -> f32

    Advances a periodic phase while retaining it in 0.0..TAU.

    Pass a phase step returned by Self::periodic_phase_step. The function

    uses only one addition and one conditional correction per sample.

Trait Implementations

impl ArchivePointee for AudioGraphTime
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for AudioGraphTime
impl Clone for AudioGraphTime
impl Copy for AudioGraphTime
impl Debug for AudioGraphTime
  • fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for AudioGraphTime
  • fn into_any(self: Box<T>) -> Box<dyn Any>
  • fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
  • fn as_any(&self) -> &dyn Any
  • fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSend for AudioGraphTime
  • fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for AudioGraphTime
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Eq for AudioGraphTime
impl<K> Equivalent for AudioGraphTime
  • fn equivalent(&self, key: &K) -> bool
impl Instrument for AudioGraphTime
impl LayoutRaw for AudioGraphTime
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for AudioGraphTime
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for AudioGraphTime
  • fn eq(&self, other: &AudioGraphTime) -> bool

    Related: AudioGraphTime

impl Pointable for AudioGraphTime
  • const ALIGN: usize
  • type Init = T
  • unsafe fn init(init: <T as Pointable>::Init) -> usize
  • unsafe fn deref<'a>(ptr: usize) -> &'a T
  • unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
  • unsafe fn drop(ptr: usize)
impl Pointee for AudioGraphTime
  • type Metadata = ()
impl Read for AudioGraphTime
impl StructuralPartialEq for AudioGraphTime
impl WithSubscriber for AudioGraphTime

On this page

Module graphQuick ReferenceModulesStructsAudioGraphTrait Implementationsimpl ArchivePointee for AudioGraphimpl<ST> CastableFrom for AudioGraphimpl Clone for AudioGraphimpl Debug for AudioGraphimpl Downcast for AudioGraphimpl DowncastSend for AudioGraphimpl DowncastSync for AudioGraphimpl Instrument for AudioGraphimpl LayoutRaw for AudioGraphimpl<T, N1> Niching for AudioGraphimpl PartialEq for AudioGraphimpl Pointable for AudioGraphimpl Pointee for AudioGraphimpl Read for AudioGraphimpl StructuralPartialEq for AudioGraphimpl WithSubscriber for AudioGraphAudioGraphFactoryImplementationsTrait Implementationsimpl ArchivePointee for AudioGraphFactoryimpl<ST> CastableFrom for AudioGraphFactoryimpl Clone for AudioGraphFactoryimpl Default for AudioGraphFactoryimpl Downcast for AudioGraphFactoryimpl DowncastSend for AudioGraphFactoryimpl DowncastSync for AudioGraphFactoryimpl Instrument for AudioGraphFactoryimpl LayoutRaw for AudioGraphFactoryimpl<T, N1> Niching for AudioGraphFactoryimpl Pointable for AudioGraphFactoryimpl Pointee for AudioGraphFactoryimpl Read for AudioGraphFactoryimpl<R> ReadPrimitive for AudioGraphFactoryimpl WithSubscriber for AudioGraphFactoryAudioGraphTimeImplementationsTrait Implementationsimpl ArchivePointee for AudioGraphTimeimpl<ST> CastableFrom for AudioGraphTimeimpl Clone for AudioGraphTimeimpl Copy for AudioGraphTimeimpl Debug for AudioGraphTimeimpl Downcast for AudioGraphTimeimpl DowncastSend for AudioGraphTimeimpl DowncastSync for AudioGraphTimeimpl Eq for AudioGraphTimeimpl<K> Equivalent for AudioGraphTimeimpl Instrument for AudioGraphTimeimpl LayoutRaw for AudioGraphTimeimpl<T, N1> Niching for AudioGraphTimeimpl PartialEq for AudioGraphTimeimpl Pointable for AudioGraphTimeimpl Pointee for AudioGraphTimeimpl Read for AudioGraphTimeimpl StructuralPartialEq for AudioGraphTimeimpl WithSubscriber for AudioGraphTime