Add audio buffer setting

This commit is contained in:
DaforLynx
2025-02-18 00:11:21 +00:00
committed by Joshua Barretto
parent 2253266542
commit 6cfee5c787
55 changed files with 129 additions and 120 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -68,7 +68,7 @@
],
sites: [Void],
music_state: Activity(Explore),
artist: ("DaforLynx", "https://daforlynx.neocities.org/"),
artist: ("DaforLynx", "https://dafor.link/"),
)),
Individual((
title: "Song of the Eldwood",
@ -81,7 +81,7 @@
],
sites: [Void],
music_state: Activity(Explore),
artist: ("DaforLynx", "https://daforlynx.neocities.org/"),
artist: ("DaforLynx", "https://dafor.link/"),
)),
Individual((
title: "Torii",
@ -239,7 +239,7 @@
],
sites: [Void],
music_state: Activity(Explore),
artist: ("DaforLynx", "https://daforlynx.neocities.org/"),
artist: ("DaforLynx", "https://dafor.link/"),
)),
Individual((
title: "Jungle Ambient",
@ -334,7 +334,7 @@
],
sites: [Void],
music_state: Activity(Explore),
artist: ("DaforLynx", "https://daforlynx.neocities.org/"),
artist: ("DaforLynx", "https://dafor.link/"),
)),
Individual((
title: "Winter Falls",
@ -347,7 +347,7 @@
],
sites: [Void],
music_state: Activity(Explore),
artist: ("DaforLynx", "https://daforlynx.neocities.org/"),
artist: ("DaforLynx", "https://dafor.link/"),
)),
Individual((
title: "Short Meandering",
@ -664,7 +664,7 @@
Settlement(SavannahTown),
],
music_state: Activity(Explore),
artist: ("DaforLynx", "https://daforlynx.neocities.org/"),
artist: ("DaforLynx", "https://dafor.link/"),
)),
Individual((
title: "Starlit Pathways",
@ -680,7 +680,7 @@
Settlement(SavannahTown),
],
music_state: Activity(Explore),
artist: ("DaforLynx", "https://daforlynx.neocities.org/"),
artist: ("DaforLynx", "https://dafor.link/"),
)),
Individual((
title: "Fiesta Del Pueblo",
@ -954,7 +954,7 @@
// ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-loop", 54.545, Activity(Combat(High)), None),
// ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-end", 6.0, Transition(Combat(High), Explore), None),
// ],
// artist: ("DaforLynx", "https://daforlynx.neocities.org/"),
// artist: ("DaforLynx", "https://dafor.link/"),
// ),
// Segmented(
// title: "Reversal",
@ -969,7 +969,7 @@
// ("voxygen.audio.soundtrack.combat.reversal.reversal-loop", 60.0, Activity(Combat(High)), None),
// ("voxygen.audio.soundtrack.combat.reversal.reversal-end", 3.666, Transition(Combat(High), Explore), None),
// ],
// artist: ("DaforLynx", "https://daforlynx.neocities.org/"),
// artist: ("DaforLynx", "https://dafor.link/"),
// ),
// Segmented(
// title: "Clash",

View File

@ -64,11 +64,6 @@ pub fn to_decibels(amplitude: f32) -> Decibels {
}
}
pub enum MasterEffect {
SfxFilter(FilterHandle),
AmbienceFilter(FilterHandle),
}
struct Tracks {
music: TrackHandle,
ui: TrackHandle,
@ -166,8 +161,16 @@ enum AudioCreationError {
}
impl AudioFrontendInner {
fn new(num_sfx_channels: usize, num_ui_channels: usize) -> Result<Self, AudioCreationError> {
let mut manager = AudioManager::<DefaultBackend>::new(AudioManagerSettings::default())
fn new(
num_sfx_channels: usize,
num_ui_channels: usize,
buffer_size: usize,
) -> Result<Self, AudioCreationError> {
let manager_settings = AudioManagerSettings {
internal_buffer_size: buffer_size,
..Default::default()
};
let mut manager = AudioManager::<DefaultBackend>::new(manager_settings)
.map_err(AudioCreationError::Manager)?;
let mut clock = manager
@ -296,8 +299,9 @@ impl AudioFrontend {
num_ui_channels: usize,
subtitles: bool,
combat_music_enabled: bool,
buffer_size: usize,
) -> Self {
let inner = AudioFrontendInner::new(num_sfx_channels, num_ui_channels)
let inner = AudioFrontendInner::new(num_sfx_channels, num_ui_channels, buffer_size)
.inspect_err(|err| match err {
AudioCreationError::Manager(e) => {
#[cfg(unix)]

View File

@ -160,6 +160,7 @@ fn main() {
settings.audio.subtitles,
// settings.audio.combat_music_enabled,
false, // We're disabling combat music for now
settings.audio.buffer_size,
),
// AudioOutput::Device(ref dev) => Some(dev.clone()),
};

View File

@ -49,6 +49,9 @@ pub struct AudioSettings {
pub music_spacing: f32,
pub subtitles: bool,
pub combat_music_enabled: bool,
/// The size of the sample buffer Kira uses. Increasing this may improve
/// audio performance at the cost of audio latency.
pub buffer_size: usize,
/// Audio Device that Voxygen will use to play audio.
pub output: AudioOutput,
@ -62,12 +65,13 @@ impl Default for AudioSettings {
music_volume: AudioVolume::new(0.5, false),
sfx_volume: AudioVolume::new(0.8, false),
ambience_volume: AudioVolume::new(0.8, false),
num_sfx_channels: 64,
num_sfx_channels: 48,
num_ui_channels: 16,
music_spacing: 1.0,
subtitles: false,
output: AudioOutput::Automatic,
combat_music_enabled: false,
buffer_size: 256,
}
}
}