khora_lanes/audio_lane/mixing/
mod.rs

1// Copyright 2025 eraflo
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Groups different audio mixing lanes.
16
17mod spatial_mixing_lane;
18
19pub use spatial_mixing_lane::*;
20
21/// A trait defining the behavior of an audio mixing lane.
22pub trait AudioMixingLane: Send + Sync {
23    /// Mixes audio into the provided output buffer based on the current state of the ECS `World`.
24    ///
25    /// # Arguments
26    /// * `world`: A reference to the ECS `World` containing audio sources and their states.
27    /// * `output_buffer`: The buffer to write mixed audio samples into.
28    /// * `stream_info`: Information about the audio stream (e.g., sample rate, channels).
29    fn mix(
30        &self,
31        world: &mut khora_data::ecs::World,
32        output_buffer: &mut [f32],
33        stream_info: &khora_core::audio::device::StreamInfo,
34    );
35}