mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
configurable sample rate for fyrox-sound
This commit is contained in:
@@ -315,7 +315,6 @@ pub struct Engine {
|
||||
|
||||
model_events_receiver: Receiver<ResourceEvent>,
|
||||
|
||||
#[allow(dead_code)] // Keep engine instance alive.
|
||||
sound_engine: SoundEngine,
|
||||
|
||||
// A set of plugins used by the engine.
|
||||
@@ -1501,6 +1500,17 @@ impl Engine {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns current sample rate of the sound engine.
|
||||
pub fn sound_sample_rate(&self) -> u32 {
|
||||
self.sound_engine.sample_rate()
|
||||
}
|
||||
|
||||
/// Normalizes given frequency using sampling rate of the sound output device. Normalized frequency
|
||||
/// then can be used to create filters.
|
||||
pub fn normalize_sound_frequency(&self, f: f32) -> f32 {
|
||||
self.sound_engine.normalize_frequency(f)
|
||||
}
|
||||
|
||||
/// Tries to destroy current graphics context. It will succeed only if the `graphics_context` is fully initialized.
|
||||
/// The method will try to save all possible runtime changes of the window, so the next [`Engine::initialize_graphics_context`]
|
||||
/// will result in the almost exact copy of the context that was made before destruction.
|
||||
|
||||
@@ -80,12 +80,6 @@ impl SoundContextGuard<'_> {
|
||||
self.guard.distance_model()
|
||||
}
|
||||
|
||||
/// Normalizes given frequency using context's sampling rate. Normalized frequency then can be used
|
||||
/// to create filters.
|
||||
pub fn normalize_frequency(&self, f: f32) -> f32 {
|
||||
self.guard.normalize_frequency(f)
|
||||
}
|
||||
|
||||
/// Returns amount of time context spent on rendering all sound sources.
|
||||
pub fn full_render_duration(&self) -> Duration {
|
||||
self.guard.full_render_duration()
|
||||
|
||||
@@ -47,7 +47,7 @@ pub use fyrox_sound::{
|
||||
DataSource, SoundBuffer, SoundBufferResource, SoundBufferResourceLoadError,
|
||||
},
|
||||
bus::*,
|
||||
context::{DistanceModel, SAMPLE_RATE},
|
||||
context::DistanceModel,
|
||||
dsp::{filters::*, DelayLine},
|
||||
effects::*,
|
||||
engine::SoundEngine,
|
||||
|
||||
Reference in New Issue
Block a user