Compare commits

..

No commits in common. "47429c2df255966d105bee3280b112dbef0abbb0" and "32734f31d56d16f0e3bc06d51fcfcde0957ac38d" have entirely different histories.

3 changed files with 23 additions and 23 deletions

View File

@ -2,17 +2,14 @@ kind: pipeline
type: docker type: docker
name: default name: default
environment:
DEPENDENCIES: cmake pkg-config libx11-dev libasound2-dev libudev-dev libxcb-xfixes0-dev libwayland-dev libxkbcommon-dev libvulkan-dev libpulse-dev
steps: steps:
- name: test - name: test
image: rust:bullseye image: rust:bullseye
pull: always pull: always
commands: commands:
- apt-get update -qq
- apt-get install -qqy $DEPENDENCIES
- rustup component add clippy rustfmt - rustup component add clippy rustfmt
- apt-get update -qq
- apt-get install -qqy cmake pkg-config libx11-dev libasound2-dev libudev-dev libxcb-xfixes0-dev libwayland-dev libxkbcommon-dev libvulkan-dev libpulse-dev
- cargo fmt --check - cargo fmt --check
- cargo test - cargo test
- cargo clippy - cargo clippy
@ -21,7 +18,7 @@ steps:
pull: always pull: always
commands: commands:
- apt-get update -qq - apt-get update -qq
- apt-get install -qqy $DEPENDENCIES - apt-get install -qqy cmake pkg-config libx11-dev libasound2-dev libudev-dev libxcb-xfixes0-dev libwayland-dev libxkbcommon-dev libvulkan-dev libpulse-dev
- cargo publish --no-verify - cargo publish --no-verify
when: when:
ref: ref:

View File

@ -64,11 +64,12 @@ fn rotate_listener(time: Res<Time>, mut query: Query<(&mut RotationTimer, &mut T
fn main() { fn main() {
App::new() App::new()
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)
.add_plugin(SynthizerPlugin { .insert_resource(SynthizerConfig {
default_panner_strategy: Some(bevy_synthizer::syz::PannerStrategy::Hrtf), default_panner_strategy: Some(bevy_synthizer::syz::PannerStrategy::Hrtf),
default_distance_model: Some(bevy_synthizer::syz::DistanceModel::Inverse), default_distance_model: Some(bevy_synthizer::syz::DistanceModel::Inverse),
..default() ..default()
}) })
.add_plugin(SynthizerPlugin)
.add_system(bevy::window::close_on_esc) .add_system(bevy::window::close_on_esc)
.init_resource::<AssetHandles>() .init_resource::<AssetHandles>()
.add_startup_system(setup) .add_startup_system(setup)

View File

@ -563,6 +563,19 @@ fn remove_sound(mut last_buffer: ResMut<LastBuffer>, removed: RemovedComponents<
} }
} }
#[derive(Resource, Clone, Default, Debug)]
pub struct SynthizerConfig {
pub default_panner_strategy: Option<syz::PannerStrategy>,
pub default_distance_model: Option<syz::DistanceModel>,
pub default_distance_ref: Option<f64>,
pub default_distance_max: Option<f64>,
pub default_rolloff: Option<f64>,
pub default_closeness_boost: Option<f64>,
pub default_closeness_boost_distance: Option<f64>,
pub log_level: syz::LogLevel,
pub log_to_stderr: bool,
}
#[derive(Resource, Debug)] #[derive(Resource, Debug)]
pub struct SynthizerDefaults { pub struct SynthizerDefaults {
pub panner_strategy: syz::PannerStrategy, pub panner_strategy: syz::PannerStrategy,
@ -576,7 +589,7 @@ pub struct SynthizerDefaults {
fn sync_config( fn sync_config(
context: Res<Context>, context: Res<Context>,
config: Res<SynthizerPlugin>, config: Res<SynthizerConfig>,
defaults: Res<SynthizerDefaults>, defaults: Res<SynthizerDefaults>,
) { ) {
if config.is_changed() { if config.is_changed() {
@ -669,25 +682,14 @@ pub enum SynthizerSystems {
#[derive(Resource)] #[derive(Resource)]
struct InitializationGuard(syz::InitializationGuard); struct InitializationGuard(syz::InitializationGuard);
#[derive(Resource, Clone, Default, Debug)] pub struct SynthizerPlugin;
pub struct SynthizerPlugin {
pub default_panner_strategy: Option<syz::PannerStrategy>,
pub default_distance_model: Option<syz::DistanceModel>,
pub default_distance_ref: Option<f64>,
pub default_distance_max: Option<f64>,
pub default_rolloff: Option<f64>,
pub default_closeness_boost: Option<f64>,
pub default_closeness_boost_distance: Option<f64>,
pub log_level: syz::LogLevel,
pub log_to_stderr: bool,
}
impl Plugin for SynthizerPlugin { impl Plugin for SynthizerPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
if !app.world.contains_resource::<SynthizerPlugin>() { if !app.world.contains_resource::<SynthizerConfig>() {
app.insert_resource(self.clone()); app.insert_resource(SynthizerConfig::default());
} }
let config = app.world.get_resource::<SynthizerPlugin>().unwrap().clone(); let config = app.world.get_resource::<SynthizerConfig>().unwrap().clone();
let mut syz_config = syz::LibraryConfig::new(); let mut syz_config = syz::LibraryConfig::new();
syz_config.log_level(config.log_level); syz_config.log_level(config.log_level);
if config.log_to_stderr { if config.log_to_stderr {