@@ -17,33 +17,9 @@ pub struct OfflineAudioContext {
17
17
/// the size of the buffer in sample-frames
18
18
length : usize ,
19
19
/// the rendering 'thread', fully controlled by the offline context
20
- renderer : SingleUseRenderThread ,
20
+ renderer : RenderThread ,
21
21
}
22
22
23
- mod private {
24
- use super :: * ;
25
-
26
- pub ( crate ) struct SingleUseRenderThread ( RenderThread ) ;
27
-
28
- impl SingleUseRenderThread {
29
- pub fn new ( rt : RenderThread ) -> Self {
30
- Self ( rt)
31
- }
32
-
33
- pub fn render_audiobuffer ( self , buffer_size : usize ) -> AudioBuffer {
34
- self . 0 . render_audiobuffer_sync ( buffer_size)
35
- }
36
- }
37
-
38
- // SAFETY:
39
- // The RenderThread is not Sync since it contains `AudioRenderQuantum`s (which use Rc) and `dyn
40
- // AudioProcessor` which may not allow sharing between threads. However we mark the
41
- // SingleUseRenderThread as Sync because it can only run once (and thus on a single thread)
42
- // NB: the render thread should never hand out the contained `Rc` and `AudioProcessor`s
43
- unsafe impl Sync for SingleUseRenderThread { }
44
- }
45
- use private:: SingleUseRenderThread ;
46
-
47
23
impl BaseAudioContext for OfflineAudioContext {
48
24
fn base ( & self ) -> & ConcreteBaseAudioContext {
49
25
& self . base
@@ -98,7 +74,7 @@ impl OfflineAudioContext {
98
74
Self {
99
75
base,
100
76
length,
101
- renderer : SingleUseRenderThread :: new ( renderer ) ,
77
+ renderer,
102
78
}
103
79
}
104
80
@@ -107,7 +83,7 @@ impl OfflineAudioContext {
107
83
/// This function will block the current thread and returns the rendered `AudioBuffer`
108
84
/// synchronously. An async version is currently not implemented.
109
85
pub fn start_rendering_sync ( self ) -> AudioBuffer {
110
- self . renderer . render_audiobuffer ( self . length )
86
+ self . renderer . render_audiobuffer_sync ( self . length )
111
87
}
112
88
113
89
/// get the length of rendering audio buffer
0 commit comments