1
1
//! Communicates with the control thread and ships audio samples to the hardware
2
2
3
- use std:: borrow:: Cow ;
4
3
use std:: cell:: Cell ;
5
4
use std:: sync:: atomic:: { AtomicU64 , Ordering } ;
6
5
use std:: sync:: Arc ;
@@ -258,14 +257,12 @@ impl RenderThread {
258
257
node_id : Cell :: new ( AudioNodeId ( 0 ) ) , // placeholder value
259
258
} ;
260
259
261
- // render audio graph, and use a Cow in case we need to mutate/store the value later
262
- let mut rendered = Cow :: Borrowed ( self . graph . as_mut ( ) . unwrap ( ) . render ( & scope) ) ;
260
+ // render audio graph, clone it in case we need to mutate/store the value later
261
+ let mut rendered = self . graph . as_mut ( ) . unwrap ( ) . render ( & scope) . clone ( ) ;
263
262
264
263
// online AudioContext allows channel count to be less than no of hardware channels
265
264
if rendered. number_of_channels ( ) != self . number_of_channels {
266
- rendered
267
- . to_mut ( )
268
- . mix ( self . number_of_channels , ChannelInterpretation :: Discrete ) ;
265
+ rendered. mix ( self . number_of_channels , ChannelInterpretation :: Discrete ) ;
269
266
}
270
267
271
268
// copy rendered audio into output slice
@@ -282,7 +279,7 @@ impl RenderThread {
282
279
// this is the last chunk, and it contained less than RENDER_QUANTUM_SIZE samples
283
280
let channel_offset = data. len ( ) / self . number_of_channels ;
284
281
debug_assert ! ( channel_offset < RENDER_QUANTUM_SIZE ) ;
285
- self . buffer_offset = Some ( ( channel_offset, rendered. into_owned ( ) ) ) ;
282
+ self . buffer_offset = Some ( ( channel_offset, rendered) ) ;
286
283
}
287
284
288
285
// handle addition/removal of nodes/edges
0 commit comments