Skip to content

Commit

Permalink
🐛 stereo and adjust tracks routing
Browse files Browse the repository at this point in the history
  • Loading branch information
Roms1383 committed Nov 29, 2024
1 parent c9f9cf5 commit df2314c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
7 changes: 6 additions & 1 deletion crates/audioware/src/engine/tracks/car_radio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ impl CarRadio {
) -> Result<Self, Error> {
let track = manager.add_sub_track(
TrackBuilder::new()
.routes(TrackRoutes::parent(ambience.environmental()))
.routes(
// sum must be 1.0 otherwise sounds crackle
TrackRoutes::empty()
.with_route(ambience.environmental(), 0.75)
.with_route(ambience.reverb(), 0.25),
)
.with_effect(modulators.car_radio_volume.try_effect()?),
)?;
Ok(Self(track))
Expand Down
13 changes: 11 additions & 2 deletions crates/audioware/src/engine/tracks/holocall.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use kira::{
effect::filter::{FilterBuilder, FilterMode},
manager::{backend::Backend, AudioManager},
track::{TrackBuilder, TrackHandle},
track::{TrackBuilder, TrackHandle, TrackRoutes},
OutputDestination,
};

Expand All @@ -13,15 +13,24 @@ use crate::{
error::Error,
};

use super::ambience::Ambience;

pub struct Holocall(TrackHandle);

impl Holocall {
pub fn try_new<B: Backend>(
manager: &mut AudioManager<B>,
ambience: &Ambience,
modulators: &Modulators,
) -> Result<Self, Error> {
let main = manager.main_track().id();
let track = manager.add_sub_track({
let mut builder = TrackBuilder::new();
let mut builder = TrackBuilder::new().routes(
// sum must be 1.0 otherwise sounds crackle
TrackRoutes::empty()
.with_route(main, 1.)
.with_route(ambience.reverb(), 0.),
);
builder.add_effect(
FilterBuilder::default()
.cutoff(EQ_LOW_PASS_PHONE_CUTOFF)
Expand Down
2 changes: 1 addition & 1 deletion crates/audioware/src/engine/tracks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Tracks {
) -> Result<Self, Error> {
let ambience = Ambience::try_new(manager, modulators)?;
let v = V::try_new(manager, &ambience, modulators)?;
let holocall = Holocall::try_new(manager, modulators)?;
let holocall = Holocall::try_new(manager, &ambience, modulators)?;
let sfx = Sfx::try_new(manager, &ambience, modulators)?;
let radioport = Radioport::try_new(manager, &ambience, modulators)?;
let music = Music::try_new(manager, &ambience, modulators)?;
Expand Down
10 changes: 8 additions & 2 deletions crates/audioware/src/engine/tracks/music.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ pub struct Music(TrackHandle);
impl Music {
pub fn try_new<B: Backend>(
manager: &mut AudioManager<B>,
#[allow(unused_variables, reason = "check routing")] ambience: &Ambience,
ambience: &Ambience,
modulators: &Modulators,
) -> Result<Self, Error> {
let main = manager.main_track().id();
let track = manager.add_sub_track(
TrackBuilder::new()
.routes(TrackRoutes::new())
.routes(
// sum must be 1.0 otherwise sounds crackle
TrackRoutes::empty()
.with_route(main, 1.)
.with_route(ambience.reverb(), 0.),
)
.with_effect(modulators.music_volume.try_effect()?),
)?;
Ok(Self(track))
Expand Down
10 changes: 8 additions & 2 deletions crates/audioware/src/engine/tracks/radioport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ pub struct Radioport(TrackHandle);
impl Radioport {
pub fn try_new<B: Backend>(
manager: &mut AudioManager<B>,
#[allow(unused_variables, reason = "check routing")] ambience: &Ambience,
ambience: &Ambience,
modulators: &Modulators,
) -> Result<Self, Error> {
let main = manager.main_track().id();
let track = manager.add_sub_track(
TrackBuilder::new()
.routes(TrackRoutes::new())
.routes(
// sum must be 1.0 otherwise sounds crackle
TrackRoutes::empty()
.with_route(main, 1.)
.with_route(ambience.reverb(), 0.),
)
.with_effect(modulators.radioport_volume.try_effect()?),
)?;
Ok(Self(track))
Expand Down

0 comments on commit df2314c

Please sign in to comment.