pub struct MemoryManager { /* private fields */ }Expand description
Memory manager for spatial audio processing
Implementations§
Source§impl MemoryManager
impl MemoryManager
Sourcepub fn new(config: MemoryConfig) -> Self
pub fn new(config: MemoryConfig) -> Self
Create new memory manager
Sourcepub async fn get_buffer(&self, size: usize) -> Array1<f32>
pub async fn get_buffer(&self, size: usize) -> Array1<f32>
Get buffer from pool or create new one
Sourcepub async fn return_buffer(&self, buffer: Array1<f32>)
pub async fn return_buffer(&self, buffer: Array1<f32>)
Return buffer to pool
Sourcepub async fn get_array2d(&self, rows: usize, cols: usize) -> Array2<f32>
pub async fn get_array2d(&self, rows: usize, cols: usize) -> Array2<f32>
Get 2D array from pool or create new one
Sourcepub async fn return_array2d(&self, array: Array2<f32>)
pub async fn return_array2d(&self, array: Array2<f32>)
Return 2D array to pool
Sourcepub async fn cache_hrtf(
&self,
key: (i32, i32, f32),
left_hrir: Array1<f32>,
right_hrir: Array1<f32>,
)
pub async fn cache_hrtf( &self, key: (i32, i32, f32), left_hrir: Array1<f32>, right_hrir: Array1<f32>, )
Cache HRTF interpolation result
Sourcepub async fn get_cached_hrtf(
&self,
key: (i32, i32, f32),
) -> Option<(Array1<f32>, Array1<f32>)>
pub async fn get_cached_hrtf( &self, key: (i32, i32, f32), ) -> Option<(Array1<f32>, Array1<f32>)>
Get cached HRTF result
Sourcepub async fn cache_distance_attenuation(
&self,
distance: f32,
model_type: u8,
attenuation: f32,
)
pub async fn cache_distance_attenuation( &self, distance: f32, model_type: u8, attenuation: f32, )
Cache distance attenuation result
Sourcepub async fn get_cached_distance_attenuation(
&self,
distance: f32,
model_type: u8,
) -> Option<f32>
pub async fn get_cached_distance_attenuation( &self, distance: f32, model_type: u8, ) -> Option<f32>
Get cached distance attenuation
Sourcepub async fn get_memory_stats(&self) -> MemoryStatistics
pub async fn get_memory_stats(&self) -> MemoryStatistics
Get memory statistics
Sourcepub async fn check_memory_pressure(&self) -> bool
pub async fn check_memory_pressure(&self) -> bool
Check memory pressure and trigger cleanup if needed
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemoryManager
impl !RefUnwindSafe for MemoryManager
impl Send for MemoryManager
impl Sync for MemoryManager
impl Unpin for MemoryManager
impl UnsafeUnpin for MemoryManager
impl !UnwindSafe for MemoryManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more