MCPcopy Create free account
hub / github.com/cinder/Cinder / process

Method process

src/cinder/audio/SamplePlayerNode.cpp:182–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182void BufferPlayerNode::process( Buffer *buffer )
183{
184 const auto &frameRange = getProcessFramesRange();
185
186 size_t readPos = mReadPos;
187 size_t numFrames = frameRange.second - frameRange.first;
188 size_t readEnd = mLoop ? mLoopEnd.load() : mNumFrames;
189
190 size_t readCount = 0;
191 if( readPos <= readEnd ) {
192 readCount = min( readEnd - readPos, numFrames );
193 buffer->copyOffset( *mBuffer, readCount, frameRange.first, readPos );
194 }
195
196 if( readCount < numFrames ) {
197 // End of File. If looping copy from beginning, otherwise disable and mark mIsEof.
198 if( mLoop ) {
199 size_t readBegin = mLoopBegin;
200 size_t readLeft = min( numFrames - readCount, mNumFrames - readBegin );
201
202 buffer->copyOffset( *mBuffer, readLeft, readCount, readBegin );
203 mReadPos.store( readBegin + readLeft );
204 }
205 else {
206 mIsEof = true;
207 mReadPos = mNumFrames;
208 disable();
209 }
210 }
211 else
212 mReadPos += readCount;
213}
214
215// ----------------------------------------------------------------------------------------------------
216// FilePlayerNode

Callers

nothing calls this directly

Calls 11

getContextFunction · 0.85
copyOffsetMethod · 0.80
getAvailableReadMethod · 0.80
getChannelMethod · 0.80
minFunction · 0.50
disableFunction · 0.50
loadMethod · 0.45
storeMethod · 0.45
getNumFramesMethod · 0.45
getNumChannelsMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected