Skip to content

Commit

Permalink
🐛 volume default
Browse files Browse the repository at this point in the history
  • Loading branch information
Roms1383 committed Nov 29, 2024
1 parent 238bbfc commit 90d67b3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/audioware/reds/Settings.reds
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class AudioSettingsExt {
public let startPosition: Float = 0.;
public let region: ref<AudioRegion>;
public let loop: Bool = false;
public let volume: Float = 100.;
public let volume: Float = 1.;
public let fadeIn: ref<Tween>;
public let panning: Float = 0.5;
public let playbackRate: Float = 1.;
Expand Down
4 changes: 2 additions & 2 deletions crates/audioware/src/abi/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl Default for AudioSettingsExt {
start_position: 0.,
region: Ref::default(),
r#loop: false,
volume: 100.,
volume: 1.,
fade_in: Ref::default(),
panning: 0.5,
playback_rate: 1.,
Expand Down Expand Up @@ -165,7 +165,7 @@ impl ToSettings for Ref<AudioSettingsExt> {
if r#loop {
settings.r#loop = Some(true);
}
if volume != 100. {
if volume != 1.0 {
settings.volume = Some(volume as f64);
}
settings.fade_in_tween = fade_in.into_interpolation();
Expand Down
4 changes: 3 additions & 1 deletion crates/audioware/src/engine/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::fmt::Debug;
use std::{fmt::Debug, ops::Div};

use audioware_bank::{BankData, Banks, Id, Initialization, InitializationOutcome};
use audioware_core::With;
Expand Down Expand Up @@ -536,6 +536,8 @@ where
}

pub fn set_volume(&mut self, setting: CName, value: f64) {
// default volume from game settings is 100.
let value = value.div(100.).clamp(0., 1.);
match setting.as_str() {
"MasterVolume" => self.manager.main_track().set_volume(value, DEFAULT),
"SfxVolume" => self.modulators.sfx_volume.update(value, DEFAULT),
Expand Down

0 comments on commit 90d67b3

Please sign in to comment.