MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / DrawModule

Method DrawModule

Source/NoteChance.cpp:65–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void NoteChance::DrawModule()
66{
67 if (Minimized() || IsVisible() == false)
68 return;
69
70 mChanceSlider->Draw();
71 mDeterministicCheckbox->Draw();
72
73 if (gTime - mLastAcceptTime > 0 && gTime - mLastAcceptTime < 200)
74 {
75 ofPushStyle();
76 ofSetColor(0, 255, 0, 255 * (1 - (gTime - mLastAcceptTime) / 200));
77 ofFill();
78 ofRect(106, 2, 10, 7);
79 ofPopStyle();
80 }
81
82 if (gTime - mLastRejectTime > 0 && gTime - mLastRejectTime < 200)
83 {
84 ofPushStyle();
85 ofSetColor(255, 0, 0, 255 * (1 - (gTime - mLastRejectTime) / 200));
86 ofFill();
87 ofRect(106, 9, 10, 7);
88 ofPopStyle();
89 }
90
91 mLengthSlider->SetShowing(mDeterministic);
92 mLengthSlider->Draw();
93 mSeedEntry->SetShowing(mDeterministic);
94 mSeedEntry->Draw();
95 mPrevSeedButton->SetShowing(mDeterministic);
96 mPrevSeedButton->Draw();
97 mReseedButton->SetShowing(mDeterministic);
98 mReseedButton->Draw();
99 mNextSeedButton->SetShowing(mDeterministic);
100 mNextSeedButton->Draw();
101
102 if (mDeterministic)
103 {
104 ofRectangle lengthRect = mLengthSlider->GetRect(true);
105 ofPushStyle();
106 ofSetColor(0, 255, 0);
107 ofFill();
108 float pos = fmod(TheTransport->GetMeasureTime(gTime) * TheTransport->GetTimeSigTop() / mLength, 1);
109 const float kPipSize = 3;
110 float moduleWidth, moduleHeight;
111 GetModuleDimensions(moduleWidth, moduleHeight);
112 ofRect(ofMap(pos, 0, 1, 0, moduleWidth - kPipSize), lengthRect.y - 5, kPipSize, kPipSize);
113 ofPopStyle();
114 }
115}
116
117void NoteChance::PlayNote(double time, int pitch, int velocity, int voiceIdx, ModulationParameters modulation)
118{

Callers

nothing calls this directly

Calls 11

ofPushStyleFunction · 0.85
ofSetColorFunction · 0.85
ofFillFunction · 0.85
ofRectFunction · 0.85
ofPopStyleFunction · 0.85
ofMapFunction · 0.85
GetMeasureTimeMethod · 0.80
GetTimeSigTopMethod · 0.80
DrawMethod · 0.45
SetShowingMethod · 0.45
GetRectMethod · 0.45

Tested by

no test coverage detected