Compare commits
2 Commits
32734f31d5
...
47429c2df2
Author | SHA1 | Date | |
---|---|---|---|
47429c2df2 | |||
5f2881d1c8 |
|
@ -2,14 +2,17 @@ kind: pipeline
|
|||
type: docker
|
||||
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:
|
||||
- name: test
|
||||
image: rust:bullseye
|
||||
pull: always
|
||||
commands:
|
||||
- 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
|
||||
- apt-get install -qqy $DEPENDENCIES
|
||||
- rustup component add clippy rustfmt
|
||||
- cargo fmt --check
|
||||
- cargo test
|
||||
- cargo clippy
|
||||
|
@ -18,7 +21,7 @@ steps:
|
|||
pull: always
|
||||
commands:
|
||||
- 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
|
||||
- apt-get install -qqy $DEPENDENCIES
|
||||
- cargo publish --no-verify
|
||||
when:
|
||||
ref:
|
||||
|
|
|
@ -64,12 +64,11 @@ fn rotate_listener(time: Res<Time>, mut query: Query<(&mut RotationTimer, &mut T
|
|||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.insert_resource(SynthizerConfig {
|
||||
.add_plugin(SynthizerPlugin {
|
||||
default_panner_strategy: Some(bevy_synthizer::syz::PannerStrategy::Hrtf),
|
||||
default_distance_model: Some(bevy_synthizer::syz::DistanceModel::Inverse),
|
||||
..default()
|
||||
})
|
||||
.add_plugin(SynthizerPlugin)
|
||||
.add_system(bevy::window::close_on_esc)
|
||||
.init_resource::<AssetHandles>()
|
||||
.add_startup_system(setup)
|
||||
|
|
34
src/lib.rs
34
src/lib.rs
|
@ -563,19 +563,6 @@ 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)]
|
||||
pub struct SynthizerDefaults {
|
||||
pub panner_strategy: syz::PannerStrategy,
|
||||
|
@ -589,7 +576,7 @@ pub struct SynthizerDefaults {
|
|||
|
||||
fn sync_config(
|
||||
context: Res<Context>,
|
||||
config: Res<SynthizerConfig>,
|
||||
config: Res<SynthizerPlugin>,
|
||||
defaults: Res<SynthizerDefaults>,
|
||||
) {
|
||||
if config.is_changed() {
|
||||
|
@ -682,14 +669,25 @@ pub enum SynthizerSystems {
|
|||
#[derive(Resource)]
|
||||
struct InitializationGuard(syz::InitializationGuard);
|
||||
|
||||
pub struct SynthizerPlugin;
|
||||
#[derive(Resource, Clone, Default, Debug)]
|
||||
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 {
|
||||
fn build(&self, app: &mut App) {
|
||||
if !app.world.contains_resource::<SynthizerConfig>() {
|
||||
app.insert_resource(SynthizerConfig::default());
|
||||
if !app.world.contains_resource::<SynthizerPlugin>() {
|
||||
app.insert_resource(self.clone());
|
||||
}
|
||||
let config = app.world.get_resource::<SynthizerConfig>().unwrap().clone();
|
||||
let config = app.world.get_resource::<SynthizerPlugin>().unwrap().clone();
|
||||
let mut syz_config = syz::LibraryConfig::new();
|
||||
syz_config.log_level(config.log_level);
|
||||
if config.log_to_stderr {
|
||||
|
|
Loading…
Reference in New Issue
Block a user