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

Method draw

samples/_audio/NodeAdvanced/src/NodeAdvancedApp.cpp:98–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void NodeAdvancedApp::draw()
99{
100 gl::clear();
101
102 // Draw the Scope's recorded Buffer in the upper right.
103 if( mMonitor && mMonitor->getNumConnectedInputs() ) {
104 Rectf scopeRect( getWindowWidth() - 210, 10, getWindowWidth() - 10, 110 );
105 drawAudioBuffer( mMonitor->getBuffer(), scopeRect, true );
106 }
107
108 // Visualize the Gen's current pitch with a circle.
109
110 float pitchMin = mCPentatonicScale.front();
111 float pitchMax = mCPentatonicScale.back();
112 float currentPitch = audio::freqToMidi( mGen->getFreq() ); // MIDI values do not have to be integers for us.
113
114 float percent = ( currentPitch - pitchMin ) / ( pitchMax - pitchMin );
115
116 float circleX = percent * getWindowWidth();
117
118 gl::color( 0, 0.8f, 0.8f );
119 gl::drawSolidCircle( vec2( circleX, getWindowCenter().y ), 50 );
120}
121
122CINDER_APP( NodeAdvancedApp, RendererGl( RendererGl::Options().msaa( 4 ) ), []( App::Settings *settings ) {
123 settings->setMultiTouchEnabled( false );

Callers

nothing calls this directly

Calls 11

getWindowWidthFunction · 0.85
drawAudioBufferFunction · 0.85
freqToMidiFunction · 0.85
drawSolidCircleFunction · 0.85
getWindowCenterFunction · 0.85
getNumConnectedInputsMethod · 0.80
getBufferMethod · 0.80
backMethod · 0.80
clearFunction · 0.50
colorFunction · 0.50
frontMethod · 0.45

Tested by

no test coverage detected