File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
core/src/avm2/globals/flash/media Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,10 @@ use crate::avm2::value::Value;
6
6
use crate :: avm2:: Error ;
7
7
use crate :: avm2_stub_getter;
8
8
use crate :: display_object:: SoundTransform ;
9
- use std:: sync:: { Arc , OnceLock } ;
9
+ use std:: {
10
+ ops:: Deref ,
11
+ sync:: { Arc , LazyLock } ,
12
+ } ;
10
13
11
14
/// Implements `soundTransform`'s getter
12
15
///
@@ -107,11 +110,11 @@ pub fn compute_spectrum<'gc>(
107
110
} ;
108
111
109
112
if fft {
110
- // TODO: Use `std::sync::LazyLock` once it's stabilized?
111
- static FFT : OnceLock < Arc < dyn realfft :: RealToComplex < f32 > > > = OnceLock :: new ( ) ;
113
+ static FFT : LazyLock < Arc < dyn realfft :: RealToComplex < f32 > > > =
114
+ LazyLock :: new ( || realfft :: RealFftPlanner :: new ( ) . plan_fft_forward ( 2048 ) ) ;
112
115
113
116
// Flash Player appears to do a 2048-long FFT with only the first 512 samples filled in...
114
- let fft = FFT . get_or_init ( || realfft :: RealFftPlanner :: new ( ) . plan_fft_forward ( 2048 ) ) ;
117
+ let fft = FFT . deref ( ) ;
115
118
116
119
let mut in_left = fft. make_input_vec ( ) ;
117
120
let mut in_right = fft. make_input_vec ( ) ;
You can’t perform that action at this time.
0 commit comments