File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -168,21 +168,17 @@ impl Iterator for MixerSource {
168168}
169169
170170impl MixerSource {
171- // Samples from the # next() function are interlaced for each of the channels.
172- // We need to ensure we start playing sources so that their samples are
173- // in-step with the modulo of the samples produced so far . Otherwise, the
174- // sound will play on the wrong channels, e.g. left / right will be reversed.
171+ // Samples from the ` next()` function are interlaced for each of the channels.
172+ // New sources are held in `still_pending` until a frame boundary so their
173+ // samples stay in-step with the channel layout . Otherwise the sound will
174+ // play on the wrong channels, e.g. left / right will be reversed.
175175 fn start_pending_sources ( & mut self ) {
176176 while let Ok ( source) = self . pending_rx . try_recv ( ) {
177- // Only start sources at frame boundaries (when current_channel == 0)
178- // to ensure correct channel alignment
179- let in_step = self . current_channel == 0 ;
180-
181- if in_step {
182- self . current_sources . push ( source) ;
183- } else {
184- self . still_pending . push ( source) ;
185- }
177+ self . still_pending . push ( source) ;
178+ }
179+
180+ if self . current_channel == 0 {
181+ self . current_sources . append ( & mut self . still_pending ) ;
186182 }
187183 }
188184
You can’t perform that action at this time.
0 commit comments