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

Method draw

test/_audio/AudioTests/src/SamplePlayerTest.cpp:293–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293void SamplePlayerTest::draw()
294{
295 gl::clear();
296
297 if( mSubTests[mCurrentSubTest] == "recorder" ) {
298 audio::BufferRef recordedBuffer = mRecorder->getRecordedCopy();
299 drawAudioBuffer( *recordedBuffer, app::getWindowBounds() );
300 }
301 else if( mSamplePlayerNode ) {
302 auto bufferPlayer = dynamic_pointer_cast<audio::BufferPlayerNode>( mSamplePlayerNode );
303 if( bufferPlayer )
304 mWaveformPlot.draw();
305 else if( mMonitor && mMonitor->isInitialized() )
306 drawAudioBuffer( mMonitor->getBuffer(), app::getWindowBounds() );
307
308 float readPos = (float)app::getWindowWidth() * mSamplePlayerNode->getReadPosition() / mSamplePlayerNode->getNumFrames();
309 gl::color( ColorA( 0, 1, 0, 0.7f ) );
310 gl::drawSolidRect( Rectf( readPos - 2, 0, readPos + 2, (float)app::getWindowHeight() ) );
311 }
312
313 if( mUnderrunFade > 0.0001f ) {
314 gl::color( ColorA( 1, 0.5f, 0, mUnderrunFade ) );
315 gl::drawSolidRect( mUnderrunRect );
316 gl::drawStringCentered( "play underrun", mUnderrunRect.getCenter(), Color::black() );
317 }
318 if( mOverrunFade > 0.0001f ) {
319 gl::color( ColorA( 1, 0.5f, 0, mOverrunFade ) );
320 gl::drawSolidRect( mOverrunRect );
321 gl::drawStringCentered( "play overrun", mOverrunRect.getCenter(), Color::black() );
322 }
323 if( mRecorderOverrunFade > 0.0001f ) {
324 gl::color( ColorA( 1, 0.5f, 0, mRecorderOverrunFade ) );
325 gl::drawSolidRect( mRecorderOverrunRect );
326 gl::drawStringCentered( "rec overrun", mRecorderOverrunRect.getCenter(), Color::black() );
327 }
328}
329
330void SamplePlayerTest::testConverter()
331{

Callers

nothing calls this directly

Calls 13

drawAudioBufferFunction · 0.85
getWindowBoundsFunction · 0.85
getWindowWidthFunction · 0.85
drawSolidRectFunction · 0.85
getWindowHeightFunction · 0.85
drawStringCenteredFunction · 0.85
blackFunction · 0.85
getRecordedCopyMethod · 0.80
getBufferMethod · 0.80
clearFunction · 0.50
colorFunction · 0.50
isInitializedMethod · 0.45

Tested by

no test coverage detected