Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
6f18f7ffbc | |||
888a9e78fc | |||
7738cdb27c | |||
0c8f557886 | |||
78e5bf2c45 | |||
3c557fa5ab |
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -2,6 +2,18 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## Version 0.9.1 - 2025-01-07
|
||||||
|
|
||||||
|
### Miscellaneous Tasks
|
||||||
|
|
||||||
|
- Don't set position if values are NaN.
|
||||||
|
|
||||||
|
## Version 0.9.0 - 2024-12-06
|
||||||
|
|
||||||
|
### Miscellaneous Tasks
|
||||||
|
|
||||||
|
- Upgrade to Bevy 0.15.
|
||||||
|
|
||||||
## Version 0.8.0 - 2024-12-02
|
## Version 0.8.0 - 2024-12-02
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "bevy_synthizer"
|
name = "bevy_synthizer"
|
||||||
version = "0.8.0"
|
version = "0.9.1"
|
||||||
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
||||||
description = "A Bevy plugin for Synthizer, a library for 3D audio and synthesis with a focus on games and VR applications"
|
description = "A Bevy plugin for Synthizer, a library for 3D audio and synthesis with a focus on games and VR applications"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
@ -10,12 +10,12 @@ repository = "https://labs.lightsout.games/projects/bevy_synthizer"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = { version = "0.14", default-features = false, features = ["bevy_asset"] }
|
bevy = { version = "0.15", default-features = false, features = ["bevy_asset"] }
|
||||||
synthizer = "0.5.6"
|
synthizer = "0.5.6"
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bevy = { version = "0.14", default-features = true }
|
bevy = { version = "0.15", default-features = true }
|
||||||
|
|
||||||
[package.metadata.release]
|
[package.metadata.release]
|
||||||
publish = false
|
publish = false
|
||||||
|
|
|
@ -31,14 +31,10 @@ fn load_and_create(
|
||||||
if !listeners.is_empty() {
|
if !listeners.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
commands.spawn((
|
commands.spawn((Transform::default(), Listener, RotationTimer::default()));
|
||||||
TransformBundle::default(),
|
|
||||||
Listener,
|
|
||||||
RotationTimer::default(),
|
|
||||||
));
|
|
||||||
let handle = asset_server.load("footstep.wav");
|
let handle = asset_server.load("footstep.wav");
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
TransformBundle::from(Transform::from_translation(Vec3::new(10., 0., 0.))),
|
Transform::from_translation(Vec3::new(10., 0., 0.)),
|
||||||
Source::default(),
|
Source::default(),
|
||||||
Sound {
|
Sound {
|
||||||
audio: handle.into(),
|
audio: handle.into(),
|
||||||
|
|
|
@ -13,16 +13,12 @@ impl Default for RotationTimer {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup(mut commands: Commands, context: Res<Context>) {
|
fn setup(mut commands: Commands, context: Res<Context>) {
|
||||||
commands.spawn((
|
commands.spawn((Transform::default(), Listener, RotationTimer::default()));
|
||||||
TransformBundle::default(),
|
|
||||||
Listener,
|
|
||||||
RotationTimer::default(),
|
|
||||||
));
|
|
||||||
let generator: syz::Generator = syz::FastSineBankGenerator::new_sine(&context, 440.)
|
let generator: syz::Generator = syz::FastSineBankGenerator::new_sine(&context, 440.)
|
||||||
.expect("Failed to create generator")
|
.expect("Failed to create generator")
|
||||||
.into();
|
.into();
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
TransformBundle::from(Transform::from_translation(Vec3::new(10., 0., 0.))),
|
Transform::from_translation(Vec3::new(10., 0., 0.)),
|
||||||
Source::default(),
|
Source::default(),
|
||||||
Sound {
|
Sound {
|
||||||
audio: generator.into(),
|
audio: generator.into(),
|
||||||
|
|
31
src/lib.rs
31
src/lib.rs
|
@ -2,9 +2,8 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use bevy::{
|
use bevy::{
|
||||||
asset::{io::Reader, AssetLoader, AsyncReadExt, LoadContext},
|
asset::{io::Reader, AssetLoader, LoadContext},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
reflect::TypePath,
|
|
||||||
transform::TransformSystem,
|
transform::TransformSystem,
|
||||||
};
|
};
|
||||||
pub use synthizer as syz;
|
pub use synthizer as syz;
|
||||||
|
@ -30,11 +29,11 @@ impl AssetLoader for BufferAssetLoader {
|
||||||
type Settings = ();
|
type Settings = ();
|
||||||
type Error = BufferAssetLoaderError;
|
type Error = BufferAssetLoaderError;
|
||||||
|
|
||||||
async fn load<'a>(
|
async fn load(
|
||||||
&'a self,
|
&self,
|
||||||
reader: &'a mut Reader<'_>,
|
reader: &mut dyn Reader,
|
||||||
_settings: &'a (),
|
_settings: &(),
|
||||||
_load_context: &'a mut LoadContext<'_>,
|
_load_context: &mut LoadContext<'_>,
|
||||||
) -> Result<Self::Asset, Self::Error> {
|
) -> Result<Self::Asset, Self::Error> {
|
||||||
let mut bytes = Vec::new();
|
let mut bytes = Vec::new();
|
||||||
reader.read_to_end(&mut bytes).await?;
|
reader.read_to_end(&mut bytes).await?;
|
||||||
|
@ -442,14 +441,16 @@ fn update_source_properties(
|
||||||
if let Some(source) = handle.cast_to::<syz::Source3D>().expect("Failed to cast") {
|
if let Some(source) = handle.cast_to::<syz::Source3D>().expect("Failed to cast") {
|
||||||
if let Some(transform) = transform {
|
if let Some(transform) = transform {
|
||||||
let translation = transform.translation();
|
let translation = transform.translation();
|
||||||
source
|
if !translation.x.is_nan() && !translation.y.is_nan() && !translation.z.is_nan() {
|
||||||
.position()
|
source
|
||||||
.set((
|
.position()
|
||||||
translation.x as f64,
|
.set((
|
||||||
translation.y as f64,
|
translation.x as f64,
|
||||||
translation.z as f64,
|
translation.y as f64,
|
||||||
))
|
translation.z as f64,
|
||||||
.expect("Failed to set position");
|
))
|
||||||
|
.expect("Failed to set position");
|
||||||
|
}
|
||||||
let distance_model = distance_model
|
let distance_model = distance_model
|
||||||
.cloned()
|
.cloned()
|
||||||
.map(|v| *v)
|
.map(|v| *v)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user