120 {
121
122 int sampleOffset = PlayCursor / _blockAlign;
123
124 int byteOffset = sampleOffset * _blockAlign;
125
126 int sampleDifference = ((byteOffset < _readOffset ? byteOffset + _dataLength : byteOffset) - _readOffset) /
127 _blockAlign;
128
129
130
131
132 if (sampleDifference == 0)
133 {
134 return;
135 }
136
137
138 _readOffset = byteOffset;
139
140
141 if (_source != null)
142 {
144 {
147 int newSample = _readSample + sampleDifference;
148
149 if (newSample >= end && _writeSample < _readSample)
150 {
151 _readSample = start + (newSample - start) % (end - start);
152 }
153 else
154 {
155 _readSample = Math.Min(newSample, _source.
Samples);
156 }
157 }
158 else
159 {
160 _readSample = Math.Min(_readSample + sampleDifference, _source.
Samples);
161
162
163 }
164 }
165 else
166 {
167 _readSample += sampleDifference;
168 }
169 }
int LoopStartSample
Definition: IAudioStream.cs:13
int Samples
Definition: IAudioStream.cs:9
int LoopEndSample
Definition: IAudioStream.cs:14
bool IsLooping
Definition: IAudioStream.cs:12