fix: cargo fmt
This commit is contained in:
@@ -2,7 +2,7 @@ use super::scenegraph::Scenegraph;
|
||||
use crate::{
|
||||
core::{registry::OwnedRegistry, task},
|
||||
nodes::{
|
||||
data, drawable, fields, hmd, input, items, audio,
|
||||
audio, data, drawable, fields, hmd, input, items,
|
||||
root::Root,
|
||||
spatial,
|
||||
startup::{self, StartupSettings, STARTUP_SETTINGS},
|
||||
|
||||
@@ -5,7 +5,7 @@ mod objects;
|
||||
mod wayland;
|
||||
|
||||
use crate::core::destroy_queue;
|
||||
use crate::nodes::{drawable, hmd, input, audio};
|
||||
use crate::nodes::{audio, drawable, hmd, input};
|
||||
use crate::objects::input::mouse_pointer::MousePointer;
|
||||
use crate::objects::input::sk_controller::SkController;
|
||||
use crate::objects::input::sk_hand::SkHand;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use super::Node;
|
||||
use crate::core::client::Client;
|
||||
use crate::core::destroy_queue;
|
||||
use crate::core::resource::ResourceID;
|
||||
use crate::core::registry::Registry;
|
||||
use crate::nodes::spatial::{Spatial, find_spatial_parent, parse_transform};
|
||||
use crate::core::resource::ResourceID;
|
||||
use crate::nodes::spatial::{find_spatial_parent, parse_transform, Spatial};
|
||||
use color_eyre::eyre::{ensure, eyre, Result};
|
||||
use glam::Vec4Swizzles;
|
||||
use glam::{vec3a, Vec4Swizzles};
|
||||
use once_cell::sync::OnceCell;
|
||||
use parking_lot::Mutex;
|
||||
use send_wrapper::SendWrapper;
|
||||
@@ -13,7 +13,7 @@ use serde::Deserialize;
|
||||
use stardust_xr::schemas::flex::deserialize;
|
||||
use stardust_xr::values::Transform;
|
||||
use std::ops::DerefMut;
|
||||
use std::{sync::Arc, path::PathBuf, ffi::OsStr, fmt::Error};
|
||||
use std::{ffi::OsStr, fmt::Error, path::PathBuf, sync::Arc};
|
||||
use stereokit::sound::Sound as SKSound;
|
||||
use stereokit::sound::SoundInstance;
|
||||
|
||||
@@ -55,7 +55,7 @@ impl Sound {
|
||||
.base_resource_prefixes
|
||||
.lock()
|
||||
.clone(),
|
||||
&[OsStr::new("wav"), OsStr::new("mp3")]
|
||||
&[OsStr::new("wav"), OsStr::new("mp3")],
|
||||
)
|
||||
.ok_or_else(|| eyre!("Resource not found"))?,
|
||||
);
|
||||
@@ -70,7 +70,7 @@ impl Sound {
|
||||
}
|
||||
|
||||
fn play_flex(node: &Node, _calling_client: Arc<Client>, _data: &[u8]) -> Result<()> {
|
||||
let sound =node.sound.get().unwrap();
|
||||
let sound = node.sound.get().unwrap();
|
||||
let sk_sound = sound
|
||||
.sk_sound
|
||||
.get_or_try_init(|| -> color_eyre::eyre::Result<SendWrapper<SKSound>> {
|
||||
@@ -81,7 +81,14 @@ impl Sound {
|
||||
})
|
||||
.ok();
|
||||
if let Some(sk_sound) = sk_sound {
|
||||
sound.instance.lock().replace(sk_sound.play_sound(sound.space.global_transform().to_scale_rotation_translation().2, sound.volume));
|
||||
let position = sound
|
||||
.space
|
||||
.global_transform()
|
||||
.transform_point3a(vec3a(0.0, 0.0, 0.0));
|
||||
sound
|
||||
.instance
|
||||
.lock()
|
||||
.replace(sk_sound.play_sound(position, sound.volume));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -133,5 +140,4 @@ impl Drop for Sound {
|
||||
}
|
||||
SOUND_REGISTRY.remove(self);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod alias;
|
||||
pub mod audio;
|
||||
pub mod data;
|
||||
pub mod drawable;
|
||||
pub mod fields;
|
||||
@@ -8,7 +9,6 @@ pub mod items;
|
||||
pub mod root;
|
||||
pub mod spatial;
|
||||
pub mod startup;
|
||||
pub mod audio;
|
||||
|
||||
use color_eyre::eyre::{eyre, Result};
|
||||
use nanoid::nanoid;
|
||||
@@ -33,13 +33,13 @@ use crate::core::registry::Registry;
|
||||
use self::alias::Alias;
|
||||
use self::data::{PulseReceiver, PulseSender};
|
||||
|
||||
use self::audio::Sound;
|
||||
use self::drawable::lines::Lines;
|
||||
use self::drawable::model::Model;
|
||||
use self::drawable::text::Text;
|
||||
use self::fields::Field;
|
||||
use self::input::{InputHandler, InputMethod};
|
||||
use self::items::{Item, ItemAcceptor, ItemUI};
|
||||
use self::audio::Sound;
|
||||
use self::spatial::zone::Zone;
|
||||
use self::spatial::Spatial;
|
||||
use self::startup::StartupSettings;
|
||||
|
||||
Reference in New Issue
Block a user