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
| Item | Kind | Description |
|---|---|---|
fns | mod | Concise functions for authoring an [super::AudioGraph]. |
AudioGraph | struct | |
AudioGraphFactory | struct | |
AudioGraphTime | struct |
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) -> AudioGraphRelated:
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) -> boolRelated:
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() -> SelfCreates a standalone empty graph factory.
Use this constructor for isolated tests. Applications normally use
crate::gameplay::world::DefaultWorld::audio_graph_factoryinstead. -
fn create(&self, graph: &mut AudioGraph) -> HandleRelated:
AudioGraphCompiles 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::deleteto stop the graph. -
fn derive(&self, handle: Handle, graph: &mut AudioGraph)Related:
AudioGraphCompiles 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
-
fn clone(&self) -> AudioGraphFactoryRelated:
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) -> u64Returns the output sample index at the start of the block.
-
const fn sample_rate(self) -> u32Returns the output sample rate in samples per second.
-
fn seconds(self) -> f64Returns the time at the start of the block in seconds.
-
fn seconds_at(self, sample_offset: usize) -> f64Returns the time of one sample in the block in seconds.
-
fn periodic_phase_step(self, frequency_hz: f32) -> f32Returns one bounded phase step for a periodic waveform.
Calculate this once per custom-processor block, then pass it to
Self::advance_periodic_phasefor every sample. This avoids deriving aperiodic phase from an ever-growing absolute time value.
-
fn advance_periodic_phase(phase: f32, phase_step: f32) -> f32Advances a periodic phase while retaining it in
0.0..TAU.Pass a phase step returned by
Self::periodic_phase_step. The functionuses 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
-
fn clone(&self) -> AudioGraphTimeRelated:
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) -> boolRelated:
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 = ()