@@ -25,15 +25,15 @@ package com.ryanberdeen.soundtouch {
25
25
public class SimpleFilter extends FilterSupport {
26
26
private var sourceSound: Sound ;
27
27
private var historyBufferSize: int ;
28
- private var sourcePosition : int ;
28
+ private var _sourcePosition : int ;
29
29
private var outputBufferPosition: int ;
30
30
private var _position : int ;
31
31
32
32
public function SimpleFilter (sourceSound :Sound , pipe :IFifoSamplePipe ) {
33
33
super (pipe);
34
34
this . sourceSound = sourceSound;
35
35
this . historyBufferSize = 22050 ;
36
- sourcePosition = 0 ;
36
+ _sourcePosition = 0 ;
37
37
outputBufferPosition = 0 ;
38
38
}
39
39
@@ -53,10 +53,19 @@ package com.ryanberdeen.soundtouch {
53
53
_position = position ;
54
54
}
55
55
56
+ public function get sourcePosition ():int {
57
+ return _sourcePosition ;
58
+ }
59
+
60
+ public function set sourcePosition (sourcePosition :int ):void {
61
+ clear ();
62
+ _sourcePosition = sourcePosition;
63
+ }
64
+
56
65
override protected function fillInputBuffer (numFrames :int ):void {
57
66
var bytes : ByteArray = new ByteArray ();
58
- var numFramesExtracted: uint = sourceSound. extract(bytes , numFrames , sourcePosition );
59
- sourcePosition += numFramesExtracted;
67
+ var numFramesExtracted: uint = sourceSound. extract(bytes , numFrames , _sourcePosition );
68
+ _sourcePosition += numFramesExtracted;
60
69
inputBuffer. putBytes(bytes );
61
70
}
62
71
0 commit comments