File tree Expand file tree Collapse file tree 1 file changed +21
-15
lines changed Expand file tree Collapse file tree 1 file changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -745,23 +745,29 @@ impl AudioProcessor for AudioBufferSourceRenderer {
745745 {
746746 Some ( val) => * val,
747747 None => {
748- // @todo - handle playback_rate < 0.
749- //
750- // find first sample >= to start loop point
751- if is_looping {
752- let start_playhead =
753- actual_loop_start * sample_rate;
754- let start_index =
755- if start_playhead. floor ( ) == start_playhead {
756- start_playhead as usize
757- } else {
758- start_playhead as usize + 1
759- } ;
760-
761- buffer_channel[ start_index]
748+ let sample = if is_looping {
749+ if playback_rate >= 0. {
750+ let start_playhead =
751+ actual_loop_start * sample_rate;
752+ let start_index =
753+ if start_playhead. floor ( ) == start_playhead {
754+ start_playhead as usize
755+ } else {
756+ start_playhead as usize + 1
757+ } ;
758+
759+ buffer_channel[ start_index]
760+ } else {
761+ let end_playhead =
762+ actual_loop_end * sample_rate;
763+ let end_index = end_playhead as usize ;
764+ buffer_channel[ end_index]
765+ }
762766 } else {
763767 0.
764- }
768+ } ;
769+
770+ sample
765771 }
766772 } ;
767773
You can’t perform that action at this time.
0 commit comments