File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -193,22 +193,28 @@ impl ConcreteBaseAudioContext {
193193 } ;
194194
195195 ( listener_params, destination_channel_config)
196- } ; // nodes will drop now, so base.inner has no copies anymore
196+ } ; // Nodes will drop now, so base.inner has no copies anymore
197197
198198 let mut base = base;
199199 let inner_mut = Arc :: get_mut ( & mut base. inner ) . unwrap ( ) ;
200200 inner_mut. listener_params = Some ( listener_params) ;
201201 inner_mut. destination_channel_config = destination_channel_config;
202202
203- // validate if the hardcoded node IDs line up
203+ // Validate if the hardcoded node IDs line up
204204 debug_assert_eq ! (
205205 base. inner. node_id_inc. load( Ordering :: Relaxed ) ,
206206 LISTENER_PARAM_IDS . end,
207207 ) ;
208208
209- // (?) only for online context
209+ // For an online AudioContext, pre-create the HRTF-database for panner nodes
210+ if !offline {
211+ crate :: node:: load_hrtf_processor ( sample_rate as u32 ) ;
212+ }
213+
214+ // Boot the event loop thread that handles the events spawned by the render thread
215+ // (we don't do this for offline rendering because it makes little sense, the graph cannot
216+ // be mutated once rendering has started anyway)
210217 if let Some ( event_channel) = event_recv {
211- // init event loop
212218 event_loop. run ( event_channel) ;
213219 }
214220
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ use super::{
2020/// The included data contains the impulse responses at 44100 Hertz, so it needs to be resampled
2121/// for other values (which can easily take 100s of milliseconds). Therefore cache the result (per
2222/// sample rate) in a global variable and clone it every time a new panner is created.
23- fn load_hrtf_processor ( sample_rate : u32 ) -> ( HrtfProcessor , usize ) {
23+ pub ( crate ) fn load_hrtf_processor ( sample_rate : u32 ) -> ( HrtfProcessor , usize ) {
2424 static INSTANCE : OnceLock < Mutex < HashMap < u32 , ( HrtfProcessor , usize ) > > > = OnceLock :: new ( ) ;
2525 let cache = INSTANCE . get_or_init ( || Mutex :: new ( HashMap :: new ( ) ) ) ;
2626 let mut guard = cache. lock ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments